P28279 [洛谷] [SEERC2018] Numbers
入门
题目描述

Problem Description

A palindromic number is a positive integer that reads the same forwards and backwards. For example, the numbers $142241$ and $102201$ are palindromic numbers, but the numbers $1023401$ and $10510$ are not. You want to decompose a number $n$ into the sum of two palindromic numbers. Calculate the number of ways to decompose $n$ in this form.

Input Format

A single line containing an integer $n$ $(1 \leq n \leq 10^{18})$.

Output Format

Output a single integer representing the number of ways to decompose $n$ into the sum of two palindromic numbers.

Sample Input and Output

Sample Input #1

156

Sample Output #1

4

Sample Input #2

9524

Sample Output #2

4

Sample Input #3

42657

Sample Output #3

6

Sample Input #4

5735832847451

Sample Output #4

28

Notes

In the first example, the following decompositions are possible: $(5, 151), (55, 101), (101, 55), (151, 5)$.

In the second example, the following decompositions are possible: $(515, 9009), (636, 8888), (8888, 636), (9009, 515)$.

In the third example, the following decompositions are possible: $(33, 42624), (333, 42324), (4884, 37773), (37773, 4884), (42324, 333), (42624, 33)$.

输入格式

见题面 Input 部分

输出格式

见题面 Output 部分

样例输入
156
样例输出
4