All submissions for this problem are available.
Read problems statements in Mandarin Chinese and Russian as well.
You are given an integer N. For each pair of integers (L, R), where 1 ≤ L ≤ R ≤ N you can find the number of distinct digits that appear in the decimal representation of at least one of the numbers L L+1 ... R.
Find the sum of all that numbers. Since the answer can be large, output it modulo 1000000007.
The only line of the input contains a single integer N without leading zeros.
Output the answer to the problem on the first line.
- 1 ≤ N ≤ 10100
Input: 7 Output: 84
|Tags||cook49, dynamic-programming, medium-hard, witua|
|Time Limit:||3 sec|
|Source Limit:||50000 Bytes|
|Languages:||ADA, ASM, BASH, BF, C, C99 strict, CAML, CLOJ, CLPS, CPP 4.3.2, CPP 6.3, CPP14, CS2, D, ERL, FORT, FS, GO, HASK, ICK, ICON, JAVA, JS, LISP clisp, LISP sbcl, LUA, NEM, NICE, NODEJS, PAS fpc, PAS gpc, PERL, PERL6, PHP, PIKE, PRLG, PYTH, PYTH 3.5, RUBY, SCALA, SCM guile, SCM qobi, ST, TCL, TEXT, WSPC|
Fetching successful submissions
If you are still having problems, see a sample solution here.