/* -*- coding: utf-8 -*- * * 1407.cc: No.1407 Kindness - yukicoder */ #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; /* constant */ const int MAX_N = 100000; const int MOD = 1000000007; /* typedef */ typedef long long ll; /* global variables */ char s[MAX_N + 4]; int es[MAX_N + 1], ds[MAX_N + 1]; /* subroutines */ inline void addmod(int &a, int b) { a = (a + b) % MOD; } /* main */ int main() { scanf("%s", s); int n = strlen(s); es[0] = 1; for (int i = 0; i < n; i++) es[i + 1] = (ll)es[i] * 45 % MOD; for (int i = 0, j = n - 1; i < n; i++, j--) ds[i] = s[j] - '0'; ds[0]++; for (int i = 0; i < n; i++) { if (ds[i] == 10) ds[i] = 0, ds[i + 1]++; else break; } if (ds[n] > 0) n++; //for (int i = 0; i < n; i++) printf("%d", ds[i]); putchar('\n'); int sum = 0; for (int i = 1; i < n; i++) addmod(sum, es[i]); for (int i = n - 1, p = 1; i >= 0; i--) { int di = ds[i]; if (di == 0) break; addmod(sum, (ll)p * (di * (di - 1) / 2) % MOD * es[i] % MOD); p = (ll)p * di % MOD; } printf("%d\n", sum); return 0; }