Digit Bounded Numbers

All submissions for this problem are available.
###Read problems statements in [Hindi](http://www.codechef.com/download/translated/CK101TST/hindi/INTERVCH.pdf), [Mandarin Chinese](http://www.codechef.com/download/translated/CK101TST/mandarin/INTERVCH.pdf), [Russian](http://www.codechef.com/download/translated/CK101TST/russian/INTERVCH.pdf), [Vietnamese](http://www.codechef.com/download/translated/CK101TST/vietnamese/INTERVCH...) and [Bengali](http://www.codechef.com/download/translated/CK101TST/bengali/INTERVCH.pdf) as well. You are given $N$ intervals $[L_1, R_1], [L_2, R_2], \ldots, [L_N, R_N]$. Consider $N$ integers $x_1, x_2, \ldots, x_N$ such that:  $x_i \in [L_i, R_i]$ for each valid $i$  all decimal digits of $S = x_1 + x_2 + x_3 + \ldots + x_N$ (without leading zeroes) lie between $A$ and $B$ inclusive In how many different ways can you pick the sequence $x_1, x_2, \ldots, x_N$? Since this number may be very large, compute it modulo $10^9+7$. ### Input  The first line of the input contains a single integer $T$ denoting the number of test cases. The description of $T$ test cases follows.  The first line of each test case contains three spaceseparated integers $N$, $A$ and $B$.  $N$ lines follow. For each $i$ ($1 \le i \le N$), the $i$th of these lines contains two spaceseparated integers $L_i$ and $R_i$. ### Output For each test case, print a single line contains one integer — the number of ways to choose $x_1, x_2, \ldots, x_N$, modulo $10^9+7$. ### Constraints  $1 \le T \le 200$  $1 \le N \le 7$  $0 \le A \le B \le 9$  $0 \le L_i \le R_i \lt 10^9$ for each valid $i$  if $T \gt 1$, then $N \le 3$ ### Example Input 1 2 2 4 1 3 1 3 ### Example Output 6Author:  deadwing97 
Editorial  https://discuss.codechef.com/problems/INTERVCH 
Tags  cook101, deadwing97, dynamicprogramming, inclusionexclusion 
Date Added:  19122018 
Time Limit:  3 sec 
Source Limit:  50000 Bytes 
Languages:  C, CPP14, JAVA, PYTH, PYTH 3.6, PYPY, CS2, PAS fpc, PAS gpc, RUBY, PHP, GO, NODEJS, HASK, rust, SCALA, swift, D, PERL, FORT, WSPC, ADA, CAML, ICK, BF, ASM, CLPS, PRLG, ICON, SCM qobi, PIKE, ST, NICE, LUA, BASH, NEM, LISP sbcl, LISP clisp, SCM guile, JS, ERL, TCL, kotlin, PERL6, TEXT, SCM chicken, PYP3, CLOJ, COB, FS 
Comments
 Please login at the top to post a comment.
SUCCESSFUL SUBMISSIONS
Fetching successful submissions
HELP
If you are still having problems, see a sample solution here. 