#include <bits/stdc++.h>   using namespace std;   namespace IO {   const int sz = 1 << 15;   char inbuf[sz], outbuf[sz];   char *pinbuf = inbuf + sz;   char *poutbuf = outbuf;   inline char _getchar() {     if (pinbuf == inbuf + sz) fread(inbuf, 1, sz, stdin), pinbuf = inbuf;     return *(pinbuf++);   }   inline void _putchar(char x) {     if (poutbuf == outbuf + sz) fwrite(outbuf, 1, sz, stdout), poutbuf = outbuf;     *(poutbuf++) = x;   }   inline void flush() {     if (poutbuf != outbuf)       fwrite(outbuf, 1, poutbuf - outbuf, stdout), poutbuf = outbuf;   }   }  // namespace IO   inline int read() {     int x = 0, p = 1;     char c = IO::_getchar();     while (c <  0  || c >  9 ) {       if (c ==  - ) p = -1;       c = IO::_getchar();     }     while (c >=  0  && c <=  9 ) x = x * 10 + c - 48, c = IO::_getchar();     return x * p;   }   namespace Mymath {   long long qp(long long x, long long p, long long mod) {     long long ans = 1;     while (p) {       if (p & 1) ans = ans * x % mod;       x = x * x % mod;       p >>= 1;     }     return ans;   }   long long inv(long long x, long long mod) { return qp(x, mod - 2, mod); }   long long C(long long N, long long K, long long fact[], long long mod) {     return fact[N] * inv(fact[K], mod) % mod * inv(fact[N - K], mod) % mod;   }   template <typename Tp>   Tp gcd(Tp A, Tp B) {     if (B == 0) return A;     return gcd(B, A % B);   }   template <typename Tp>   Tp lcm(Tp A, Tp B) {     return A * B / gcd(A, B);   }   };  // namespace Mymath   const int Maxn = 705;   const long long mod = 1e9 + 7;   int dp[Maxn][3][Maxn][11];   int tot[11][Maxn];   char c[Maxn];   int n;   void Add(int &x, int y) {     x += y;     if (x >= mod) x -= mod;   }   int main() {     scanf( %s , c);     n = strlen(c);     for (int i = 0; i <= 9; i++) dp[0][1][0][i] = 1;     for (int i = 0; i < n; i++) {       int curv = c[i] -  0 ;       for (int j = 0; j <= i; j++) {         for (int k = 0; k <= 9; k++) {           if (i)             for (int l = 0; l < 3; l++) Add(tot[k][j], dp[i][l][j][k]);           Add(dp[i + 1][1][j + (curv >= k)][k], dp[i][1][j][k]);           for (int l = 0; l <= 9; l++) {             if (!i && !l) continue;             if (l == curv) continue;             Add(dp[i + 1][(l < curv) ? 0 : 2][j + (l >= k)][k], dp[i][1][j][k]);           }           for (int l = 0; l <= 9; l++) {             if (!i && !l) continue;             Add(dp[i + 1][0][j + (l >= k)][k], dp[i][0][j][k]);             Add(dp[i + 1][2][j + (l >= k)][k], dp[i][2][j][k]);           }         }       }     }     for (int j = 0; j <= n; j++) {       for (int k = 0; k <= 9; k++) {         for (int l = 0; l < 2; l++) Add(tot[k][j], dp[n][l][j][k]);       }     }     for (int i = 0; i <= 9; i++) {       for (int j = n; j >= 0; j--) {         Add(tot[i][j], tot[i][j + 1]);       }     }     long long ans = 0;     int w = 1;     for (int i = 0; i < n; i++) {       for (int j = 1; j <= 9; j++) {         int cnt = tot[j][i + 1] - tot[j + 1][i + 1];         if (cnt < 0) cnt += mod;         ans += 1ll * cnt * w % mod * j;         ans %= mod;       }       w = 1ll * w * 10 % mod;     }     printf( %I64d n , ans);     return 0;   }   