Professor Oak is getting old, as he can notice at the gym. Now, when he is on the running machine, he needs some psychological tricks to go on. For instance, supose that he decides to run for minutes. Then, when he has been running for 2 minutes, he thinks “already done”. Similarly, at the minute 17, he thinks “only left”. Note that Prof. Oak solely likes fractions whose only prime factors (when simplified) are 2, 3 and 5. So, for , the minute 7 is not psychologically comforting, because both and have factors other than 2, 3 and 5.
Given , how many psychologically comforting minutes will Prof. Oak enjoy?
Input consists of several cases, each with an between 1 and .
For every , print the number of psychologically comforting minutes between 1 and .
Input
1 10 20 66 81 1000000007 1000000000000000
Output
0 9 17 5 50 0 12909