import * as fs from 'fs' // import * as readline from 'readline' // const rl = readline.createInterface({ input: process.stdin, output: process.stdout }) // const ask = (query: string) => new Promise((resolve) => rl.question(query, resolve)) // // Don't forget `rl.close()`. const INT = Math.floor declare global { interface Array { last(): T | undefined isEmpty(): boolean } } Array.prototype.last = function () { return this.length === 0 ? undefined : this[this.length - 1] } Array.prototype.isEmpty = function () { return this.length === 0 } const bigIntMax = (...args: bigint[]) => args.reduce((m, e) => (e > m ? e : m)) const bigIntMin = (...args: bigint[]) => args.reduce((m, e) => (e < m ? e : m)) const bigIntAbs = (arg: bigint) => (arg < 0 ? -arg : arg) declare const stdin: number function read_stdin() { return fs.readFileSync(process.env.NODE_ENV === 'debug' ? stdin : process.stdin.fd, 'utf8') } class Input { readonly inputs: string[] private index = 0 constructor(str?: string) { this.inputs = (str ? str : read_stdin()).split(/\s+/) } number() { return Number(this.inputs[this.index++]) } numbers(n: number) { return this.inputs.slice(this.index, (this.index += n)).map(Number) } bigint() { return BigInt(this.inputs[this.index++]) } bigints(n: number) { return this.inputs.slice(this.index, (this.index += n)).map(BigInt) } word() { return this.inputs[this.index++] } words(n: number) { return this.inputs.slice(this.index, (this.index += n)) } } function array(len: number, init: T): T[] { return Array(len).fill(init) } function array2(h: number, w: number, init: T): T[][] { return array(h, 0).map(() => array(w, init)) } function Mods(M: number, MAX_N = 0) { function mul(...A: number[]) { return A.reduce((r, a) => { const t = r * a return t < 2 ** 53 ? t % M : ((((r >> 16) * a) % M) * 65536 + (r & 65535) * a) % M }) } function pow(x: number, n: number) { let r = 1 for (; n; x = mul(x, x), n >>= 1) { if (n & 1) r = mul(r, x) } return r } const fac: number[] = Array(MAX_N + 1) const fac_inv: number[] = Array(MAX_N + 1) fac[0] = 1 fac_inv[0] = 1 for (let i = 1; i <= MAX_N; i++) { fac[i] = mul(fac[i - 1], i) fac_inv[i] = mul(fac_inv[i - 1], pow(i, M - 2)) } function nCr(n: number, r: number) { return mul(fac[n], fac_inv[r], fac_inv[n - r]) } function nPr(n: number, r: number) { return mul(fac[n], fac_inv[n - r]) } return { mul, pow, nCr, nPr } } function main() { const input = new Input() const M = 10 ** 9 + 7 const mod = Mods(10 ** 9 + 7) const N = input.word() const pows = array(N.length + 1, 1) for (let i = 1; i <= N.length; i++) { pows[i] = mod.mul(pows[i - 1], 45) } const inv = mod.pow(44, M - 2) let sum = 0 if (N.length > 1) { sum = mod.mul(pows[N.length] - 45, inv) } let tight_mul = 1 for (let i = 0; i < N.length; i++) { const digit = Number(N[i]) if (tight_mul && digit > 1) { sum += mod.mul(tight_mul, (digit * (digit - 1)) / 2, pows[N.length - i - 1]) sum %= M } tight_mul = mod.mul(tight_mul, digit) if (digit === 0) break } const r = (sum + tight_mul) % M console.log(r < 0 ? r + M : r) } main()