Problem: Let's call a fraction x/y good if there exists at least one another fraction (x')/(y') such that x/y = (x')/(y'), 1 ≤ x', y' ≤ 9, the digit denoting x' is contained in the decimal representation of x, and the digit denoting y' is contained in the decimal representation of y. For example, 26/13 is a good fraction, because 26/13 = 2/1.

You are given an integer number n. Please calculate the number of good fractions x/y such that 1 ≤ x ≤ n and 1 ≤ y ≤ n. The answer may be really large, so print it modulo 998244353.

Input

The only line of the input contains one integer n (1 ≤ n < 10^{100}).

Output

Print the number of good fractions x/y such that 1 ≤ x ≤ n and 1 ≤ y ≤ n. The answer may be really large, so print it modulo 998244353.

Examples

Input


42


Output


150


Input


3141592653589793238462643383279


Output


459925407

Solution (in CPP):

Solution:
#include <bits/stdc++.h>
using namespace std;
template <typename T>
void maxtt(T& t1, T t2) {
  t1 = max(t1, t2);
}
template <typename T>
void mintt(T& t1, T t2) {
  t1 = min(t1, t2);
}
bool debug = 0;
int n, m, k;
int dx[4] = {0, 1, 0, -1}, dy[4] = {1, 0, -1, 0};
string direc = "URDL";
const long long MOD2 = (long long)998244353 * (long long)998244353;
long long ln, lk, lm;
void etp(bool f = 0) {
  puts(f ? "YES" : "NO");
  exit(0);
}
void addmod(int& x, int y, int mod = 998244353) {
  assert(y >= 0);
  x += y;
  if (x >= mod) x -= mod;
  assert(x >= 0 && x < mod);
}
void et(int x = -1) {
  printf("%d\n", x);
  exit(0);
}
long long fastPow(long long x, long long y, int mod = 998244353) {
  long long ans = 1;
  while (y > 0) {
    if (y & 1) ans = (x * ans) % mod;
    x = x * x % mod;
    y >>= 1;
  }
  return ans;
}
long long gcd1(long long x, long long y) { return y ? gcd1(y, x % y) : x; }
char s[135];
int a[135], X, Y;
int dp[135][20][20][20][2];
int cal(int pos, int cha, int s1, int s2, bool lim) {
  if (pos > n) {
    return cha == 0 && ((s1 & s2) != 0);
  }
  int& tmp = dp[pos][cha + 9][s1][s2][lim];
  if (tmp != -1) return tmp;
  int up = lim ? a[pos] : 9;
  tmp = 0;
  for (int i = 0; i <= up; i++)
    for (int(j) = 0; (j) < (int)(10); (j)++) {
      int nw = cha * 10 + i * X - j * Y;
      if (nw >= Y || nw <= -X) continue;
      int n1 = 0, n2 = 0;
      if (i != 0 && i % Y == 0) n1 = 1 << (i / Y - 1);
      if (j != 0 && j % X == 0 && j / X * Y <= 9) n2 = 1 << (j / X - 1);
      addmod(tmp, cal(pos + 1, nw, s1 | n1, s2 | n2, lim && i == up));
    }
  return tmp;
}
void fmain(int tid) {
  scanf("%s", s + 1);
  n = strlen(s + 1);
  for (int(i) = 1; (i) <= (int)(n); (i)++) a[i] = s[i] - '0';
  int ans = 0;
  for (int(i) = 1; (i) <= (int)(n); (i)++) {
    ans = (long long)ans * 10 % 998244353;
    addmod(ans, a[i]);
  }
  for (X = 1; X < 10; X++)
    for (Y = X + 1; Y < 10; Y++)
      if (gcd1(X, Y) == 1) {
        memset(dp, -1, sizeof dp);
        int tt = cal(1, 0, 0, 0, 1);
        addmod(ans, tt);
        addmod(ans, tt);
      }
  printf("%d\n", ans);
}
int main() {
  int t = 1;
  for (int(i) = 1; (i) <= (int)(t); (i)++) {
    fmain(i);
  }
  return 0;
}