import std.stdio, std.algorithm, std.string, std.conv, std.array, std.range, std.math; static immutable int N = 500000; long[] precalc() { long[] d = new long[N]; d[0] = 1; foreach (i; 1..N) d[i] = d[i/3] + d[i/5]; return d; } void main() { static long[] dp = precalc(); writeln(dp[33]); long n; readf("%d\n", &n); long f(long x) { if (x < N) return dp[x.to!int]; return x == 0 ? 1L : f(x/3) + f(x/5); } writeln(f(n)); auto _ = readln(); // dbg }