import java.io.PrintWriter; import java.math.BigInteger; import java.util.Arrays; import java.util.Scanner; class Main implements Runnable { public static void main(String[] args) { new Thread(null, new Main(), "", Runtime.getRuntime().maxMemory()).start(); } final long MODULO1 = 1_000_000_000; final long MODULO2 = 1_000_000_000 + 7; public void run() { Scanner sc = new Scanner(System.in); char[] s = sc.next().toCharArray(); int[] arr = new int[s.length]; for (int i = 0; i < s.length; ++i) { arr[i] = (int) (s[i] - '0'); } solve(arr); } void solve(int[] arr) { int len = arr.length; System.out.println(f(arr, -1, 0, len, MODULO1)); System.out.println(f(arr, -1, 0, len, MODULO2)); } // state==-1:初期状態 // state==0:上位桁を無視 // state==1:上位桁が確定済みかつ上位桁が上限未満 // state==2:上位桁が確定かつ上位桁が上限ぴったりかつ下位桁は上回っていない // state==3:上位桁が確定かつ上位桁が上限ぴったりかつ下位桁が上回っている // [s,d)の範囲のみを考えればよい long f(int[] arr, int state, int s, int d, long MODULO) { long sum = 0; if (d - s < 1) { if (state == 0) { return 0; } else if (state == 1 || state == 2) { return 1; } else if (state == 3) { return 0; } else { throw new AssertionError(); } } if (state == -1) { sum = (sum + f(arr, 0, s + 1, d, MODULO)); for (int i = 1; i <= arr[s]; ++i) { if (i == arr[s]) { if (i <= arr[d - 1]) sum = (sum + f(arr, 2, s + 1, d - 1, MODULO)) % MODULO; else sum = (sum + f(arr, 3, s + 1, d - 1, MODULO)) % MODULO; } else { sum = (sum + f(arr, 1, s + 1, d - 1, MODULO)) % MODULO; } } return sum; } else if (state == 0 || state == 1) { int len = d - s; if (state == 0) { sum = (sum + f(arr, 0, s + 1, d, MODULO)) % MODULO; sum = (sum + 9 * f(arr, 1, s + 1, d - 1, MODULO)) % MODULO; return sum; } else { return pow(10, (len + 1) / 2, MODULO); } } else if (state == 2 || state == 3) { for (int i = 0; i <= arr[s]; ++i) { if (i == arr[s]) { if (i < arr[d - 1] || (state == 2 && i == arr[d - 1])) sum = (sum + f(arr, 2, s + 1, d - 1, MODULO)) % MODULO; else sum = (sum + f(arr, 3, s + 1, d - 1, MODULO)) % MODULO; } else { sum = (sum + f(arr, 1, s + 1, d - 1, MODULO)) % MODULO; } } return sum; } else { throw new AssertionError(); } } long pow(long a, int n, long MODULO) { long ret = 1; for (; n > 0; n >>= 1, a = (a * a) % MODULO) { if (n % 2 == 1) { ret = (ret * a) % MODULO; } } return ret; } static void tr(Object... objects) { System.out.println(Arrays.deepToString(objects)); } }