#include using namespace std; struct iofast_t { iofast_t() { ios::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr); } } iofast; struct uns_t {} uns; template auto vec(Element init, Head arg, Args ...args) { if constexpr (sizeof...(Args) == 0) return std::vector(arg, init); else return std::vector(arg, vec(init, args...)); } template auto vec(uns_t, Head arg, Args ...args) { return vec(Element(), arg, args...); } #include using mint = atcoder::modint1000000007; int main() { string s; cin >> s; reverse(begin(s), end(s)); int n = int(size(s)); auto dp1 = vec(uns, n + 1); dp1[0] = 1; for (int i = 1; i <= n; ++i) { dp1[i] = 0; for (int j = 1; j < 10; ++j) { dp1[i] += j * dp1[i - 1]; } } auto dp2 = vec(uns, n + 1); dp2[0] = 1; for (int i = 1; i <= n; ++i) { dp2[i] = 0; for (int j = 1; j < s[i - 1] - '0'; ++j) { dp2[i] += j * dp1[i - 1]; } dp2[i] += (s[i - 1] - '0') * dp2[i - 1]; } auto acc = vec(uns, n + 1); acc[0] = 0; for (int i = 1; i <= n; ++i) { acc[i] = dp1[i] + acc[i - 1]; } mint ans = acc[n - 1]; for (int i = 1; i <= s[n - 1] - '0' - 1; ++i) { ans += i * dp1[n - 1]; } ans += (s[n - 1] - '0') * dp2[n - 1]; cout << ans.val() << endl; }