#include <bits/stdc++.h>
using namespace std;
int n;
char s[711];
const int mod = 1e9 + 7;
int kk[711][12], f[711][711][2];
int main() {
  scanf("%s", s + 1);
  n = strlen(s + 1);
  for (int j = 0; j <= 9; j++) {
    int num = s[n] - '0';
    if (j > num) {
      f[n][0][0] = num + 1;
      f[n][1][0] = 0;
      f[n][0][1] = j - num - 1;
      f[n][1][1] = 10 - j;
    } else {
      f[n][0][0] = j;
      f[n][1][0] = num - j + 1;
      f[n][0][1] = 0;
      f[n][1][1] = 10 - num - 1;
    }
    for (int a = n - 1; a; a--) {
      int num = s[a] - '0';
      if (j > num) {
        f[a][0][0] =
            (1ll * (f[a + 1][0][0] + f[a + 1][0][1]) * num + f[a + 1][0][0]) %
            mod;
        f[a][0][1] = (1ll * (f[a + 1][0][0] + f[a + 1][0][1]) * (j - num - 1) +
                      f[a + 1][0][1]) %
                     mod;
        for (int b = 1, to = n - a + 1; b <= to; b++) {
          f[a][b][0] =
              (1ll * (f[a + 1][b][0] + f[a + 1][b][1]) * num + f[a + 1][b][0]) %
              mod;
          f[a][b][1] =
              (1ll * (f[a + 1][b - 1][0] + f[a + 1][b - 1][1]) * (10 - j) +
               1ll * (f[a + 1][b][0] + f[a + 1][b][1]) * (j - num - 1) +
               f[a + 1][b][1]) %
              mod;
        }
      } else {
        f[a][0][0] = (1ll * (f[a + 1][0][0] + f[a + 1][0][1]) * j) % mod;
        f[a][0][1] = 0;
        for (int b = 1, to = n - a + 1; b <= to; b++) {
          f[a][b][0] =
              (1ll * (f[a + 1][b][0] + f[a + 1][b][1]) * j +
               1ll * (f[a + 1][b - 1][0] + f[a + 1][b - 1][1]) * (num - j) +
               f[a + 1][b - 1][0]) %
              mod;
          f[a][b][1] = (1ll * (f[a + 1][b - 1][0] + f[a + 1][b - 1][1]) *
                            (10 - num - 1) +
                        f[a + 1][b - 1][1]) %
                       mod;
        }
      }
    }
    for (int i = n; i; i--)
      f[1][i][0] += f[1][i + 1][0], f[1][i][0] -= f[1][i][0] >= mod ? mod : 0,
          kk[i][j] = f[1][i][0];
  }
  int ans = 0;
  for (int i = 1, ten = 1; i <= n; i++) {
    for (int j = 0; j <= 9; j++)
      ans += 1ll * (kk[i][j] - kk[i][j + 1] + mod) * ten % mod * j % mod,
          ans -= ans >= mod ? mod : 0, ans += ans < 0 ? mod : 0;
    ten = 1ll * ten * 10 % mod;
  }
  printf("%d\n", ans);
  return 0;
}
