#include <bits/stdc++.h>   using namespace std;   const long long M = 7e2 + 5;   const long long mod = 1e9 + 7;   char sz[M];   long long a[M], js;   inline long long read() {     register long long x = 0, y = 1;     register char c = getchar();     while (!isdigit(c)) {       if (c ==  - ) y = 0;       c = getchar();     }     while (isdigit(c)) {       x = x * 10 + (c ^ 48);       c = getchar();     }     return y ? x : -x;   }   long long f[M][M][10];   long long dfs(long long pos, long long limit, long long sum, long long l) {     if (!pos) return !sum % mod;     if (!limit && ~f[pos][sum][l]) return f[pos][sum][l] % mod;     long long up = limit ? a[pos] : 9;     long long cnt = 0;     for (long long i = 0; i <= up; i++)       cnt = (cnt + dfs(pos - 1, limit && i == up, sum - (i >= l), l)) % mod;     if (!limit) f[pos][sum][l] = cnt;     return cnt % mod;   }   signed main() {     scanf( %s , sz + 1);     memset(f, -1, sizeof(f));     long long len = strlen(sz + 1);     for (long long i = 1; i <= len; i++) a[i] = sz[len - i + 1] -  0 ;     a[0] = 0;     for (long long i = 1; i <= 9; i++)       for (long long j = 1, puz = 1; j <= len;            j++, puz = (10ll * puz + 1ll) % mod)         js = (js + dfs(len, 1, j, i) * puz % mod) % mod;     printf( %lld n , js);     return 0;   }   