Recursive function - 2
128 megabytes
Calculate the value of the function:
f(n) = \begin{cases}
1, n \le 2 \\
f(6\cdot n/7) + f(2\cdot n/3), n\bmod 2 = 1\\
f(n-1) + f(n-3), n\bmod 2 = 0
\end{cases}
Input
A natural number n is given (1 \le n \le 10^{12}).
Output
Output the value of f(n) modulo 2^{32}.