import java.io.*; import java.util.*; import java.util.function.*; import java.util.stream.*; public class Main { static final int MOD = 1000000007; public static void main(String[] args) throws Exception { Scanner sc = new Scanner(); char[] inputs = sc.next().toCharArray(); int length = inputs.length; int[] values = new int[]{0, 1, 2, 4, 5, 10, 20, 25, 50, 100}; int size = values.length; Map idxes = new HashMap<>(); for (int i = 0; i < size; i++) { idxes.put(values[i], i); } int[][] dp = new int[length][size]; for (int i = 1; i < inputs[0] - '0'; i++) { dp[0][idxes.get(getGCD(i, 100))]++; } int type; if (inputs[0] == '0') { type = 0; } else { type = idxes.get(getGCD(inputs[0] - '0', 100)); } for (int i = 1; i < length; i++) { int x = inputs[i] - '0'; for (int j = 1; j < size; j++) { for (int k = 1; k < 10; k++) { int current = idxes.get(getGCD(values[j] * k, 100)); dp[i][current] += dp[i - 1][j]; dp[i][current] %= MOD; } } for (int j = 1; j < 10; j++) { dp[i][idxes.get(getGCD(j, 100))]++; } if (type >= 1) { for (int j = 1; j < x; j++) { int current = idxes.get(getGCD(values[type] * j, 100)); dp[i][current]++; } if (x == 0) { type = 0; } else { type = idxes.get(getGCD(values[type] * x, 100)); } } } dp[length - 1][type]++; System.out.println(dp[length - 1][size - 1] % MOD); } static int getGCD(int x, int y) { if (y == 0) { return x; } else { return getGCD(y, x % y); } } } class Scanner { BufferedReader br; StringTokenizer st = new StringTokenizer(""); StringBuilder sb = new StringBuilder(); public Scanner() { try { br = new BufferedReader(new InputStreamReader(System.in)); } catch (Exception e) { } } public int nextInt() { return Integer.parseInt(next()); } public long nextLong() { return Long.parseLong(next()); } public double nextDouble() { return Double.parseDouble(next()); } public String next() { try { while (!st.hasMoreTokens()) { st = new StringTokenizer(br.readLine()); } } catch (Exception e) { e.printStackTrace(); } finally { return st.nextToken(); } } }