import java.util.Scanner; public class Main { public static void main(String[] args) throws Exception { Scanner sc = new Scanner(System.in); char[] s = sc.next().toCharArray(); sc.close(); int[] pj = {0, 0, 1, 0, 2, 0, 1, 0, 3, 0}; int[] pk = {0, 0, 0, 0, 0, 1, 0, 0, 0, 0}; int n = s.length; int mod = 1000000007; long[][][] dp0 = new long[n + 1][3][3]; long[][][] dp1 = new long[n + 1][3][3]; dp0[0][0][0] = 1; for (int i = 0; i < n; i++) { int c = s[i] - '0'; for (int j = 0; j < 3; j++) { for (int k = 0; k < 3; k++) { for (int x = 1; x < c; x++) { int nj = Math.min(j + pj[x], 2); int nk = Math.min(k + pk[x], 2); dp1[i + 1][nj][nk] += dp0[i][j][k]; } int nj = Math.min(j + pj[c], 2); int nk = Math.min(k + pk[c], 2); dp0[i + 1][nj][nk] += dp0[i][j][k]; } } for (int j = 0; j < 3; j++) { for (int k = 0; k < 3; k++) { for (int x = 1; x <= 9; x++) { int nj = Math.min(j + pj[x], 2); int nk = Math.min(k + pk[x], 2); dp1[i + 1][nj][nk] += dp1[i][j][k]; } } } dp1[i + 1][0][0] += 1; for (int j = 0; j < 3; j++) { for (int k = 0; k < 3; k++) { dp0[i + 1][j][k] %= mod; dp1[i + 1][j][k] %= mod; } } } long ans = dp0[n][2][2] + dp1[n][2][2]; ans %= mod; System.out.println(ans); } }