#jag2018summerday2b. [jag2018summer_day2_b]Coins

[jag2018summer_day2_b]Coins

Problem Statement

There are 11-, 55-, 1010-, 5050-, 100100-, 500500- yen coins, and you have an infinite number of coins of each type.

For a given positive integer xx, let f(x)f(x) be the smallest number of coins you have to use to pay exactly xx yen. For example, f(2018)=9f(2018)= 9 because 2018=1+1+1+5+10+500+500+500+5002018 = 1 + 1 + 1 + 5 + 10 + 500 + 500 + 500 + 500.

You are given a positive integer NN. Count the number of positive integers xx such that f(x)=Nf(x) = N.

Constraints

  • 1leqNleq10181 \\leq N \\leq 10^{18}

Input

Input is given from Standard Input in the following format:

NN

Output

Print the number of positive integers xx such that f(x)=Nf(x) = N.


Sample Input 1

1

Sample Output 1

6

The value of xx is 1,5,10,50,100,1, 5, 10, 50, 100, or 500500.


Sample Input 2

2

Sample Output 2

19

The value of xx is $2, 6, 11, 15, 20, 51, 55, 60, 101, 105, 110, 150, 200, 501, 505, 510, 550, 600,$ or 10001000.


Sample Input 3

1000000000000000000

Sample Output 3

500