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[][] matrix = new int[size][10]; for (int i = 1; i < size; i++) { for (int j = 1; j < 10; j++) { matrix[i][j] = idxes.get(getGCD(values[i] * j, 100)); } } int[][] dp = new int[length][size]; for (int i = 1; i < inputs[0] - '0'; i++) { dp[0][matrix[1][i]]++; } int type = matrix[1][inputs[0] - '0']; 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++) { dp[i][matrix[j][k]] += dp[i - 1][j]; dp[i][matrix[j][k]] %= MOD; } } for (int j = 1; j < 10; j++) { dp[i][matrix[1][j]]++; } if (type >= 1) { for (int j = 1; j < x; j++) { dp[i][matrix[type][j]]++; } type = matrix[type][x]; } } 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(); } } }