시간 제한 메모리 제한 제출 정답 맞은 사람 정답 비율
1 초 512 MB 2 1 1 100.000%

문제

A palindrome is an integer which reads the same backward as forward. For example, numbers 142241 and 102201 are palindromes, but 1023401 and 10510 — no. You want to represent a number n as the sum of two palindromes. Find the number of ways to do it.

입력

There is only one line containing the integer n (1 ≤ n ≤ 1018).

출력

Output one number — the number of ways to represent the number n as the sum of two palindromes.

예제 입력 1

156

예제 출력 1

4

예제 입력 2

9524

예제 출력 2

4

예제 입력 3

42657

예제 출력 3

6

예제 입력 4

5735832847451

예제 출력 4

28

힌트

In the first test, the following pairs of numbers are suitable: (5, 151), (55, 101), (101, 55), (151, 5).

In the second test, the following pairs of numbers are suitable: (515, 9009), (636, 8888), (8888, 636), (9009, 515).

In the third test, the following pairs of numbers are suitable: (33, 42624), (333, 42324), (4884, 37773), (37773, 4884), (42324, 333), (42624, 33).