import java.io.*; import java.util.*; import java.util.function.*; import java.util.stream.*; public class Main { static final int MOD = 998244353; public static void main(String[] args) throws Exception { Scanner sc = new Scanner(); char[] num = sc.next().toCharArray(); int length = num.length; if (length <= 2) { System.out.println(num); return; } int[] idxes = new int[]{1, 0, 0, 0, 2, 0, 0, 0, 0, 0}; int prepre = num[0] - '0'; int pre = num[1] - '0'; boolean has404 = false; int[][][] dp = new int[length][3][3]; for (int i = 0; i < prepre * 10 + pre; i++) { dp[1][idxes[i / 10]][idxes[i % 10]]++; } for (int i = 2; i < length; i++) { int x = num[i] - '0'; for (int a = 0; a < 3; a++) { for (int b = 0; b < 3; b++) { for (int c = 0; c < 10; c++) { if (a == 2 && b == 1 && c == 4) { continue; } dp[i][b][idxes[c]] += dp[i - 1][a][b]; dp[i][b][idxes[c]] %= MOD; } } } if (has404) { continue; } for (int j = 0; j < x; j++) { if (prepre == 4 && pre == 0 && j == 4) { continue; } dp[i][idxes[pre]][idxes[j]]++; } has404 = (prepre == 4 && pre == 0 && x == 4); prepre = pre; pre = x; } int ans = 0; for (int[] arr : dp[length - 1]) { for (int x : arr) { ans += x; ans %= MOD; } } if (has404) { ans--; } System.out.println(ans); } } 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(); } } }