MOD = 10 ** 9 + 7 s = list(map(int, input())) n = len(s) dp = [[0, 0, 0], [0, 0, 0], [0, 0, 0]] cnt2 = cnt5 = cnt0 = 0 for i in range(n): ndp = [[0, 0, 0], [0, 0, 0], [0, 0, 0]] for a in range(3): for b in range(3): ndp[a][b] += 4 * dp[a][b] ndp[2][b] += 2 * dp[a][b] ndp[min(2, a + 1)][b] += 2 * dp[a][b] ndp[a][min(2, b + 1)] += dp[a][b] if i != 0: ndp[1][0] += 2 ndp[2][0] += 2 ndp[0][1] += 1 ndp[0][0] += 4 if not cnt0: for d in range(1, s[i]): t2 = cnt2 t5 = cnt5 while d % 2 == 0: d //= 2 t2 += 1 if d % 5 == 0: d //= 5 t5 += 1 t2 = min(2, t2) t5 = min(2, t5) ndp[t2][t5] += 1 for a in range(3): for b in range(3): ndp[a][b] %= MOD if s[i] == 0: cnt0 += 1 elif s[i] % 4 == 0: cnt2 += 2 elif s[i] % 2 == 0: cnt2 += 1 elif s[i] == 5: cnt5 += 1 dp = ndp ans = dp[2][2] if not cnt0 and cnt2 >= 2 and cnt5 >= 2: ans = (ans + 1) % MOD print(ans)