A natural number is special if it consists of only digits 4 and 7. Find the number of pairs of сoprime special numbers (x, y) such that 1⩽x⩽y⩽N.
Input format
The first line contains an integer N (1⩽N⩽109).
Output format
Print a single number denoting the answer to the problem.
Clarification: https://en.wikipedia.org/wiki/Coprime_integers
Answer = 1 because 4 and 7 ≤ 10 and gcd(4,7) = 1