{"problem":{"name":"[SNCPC2019] Digit Product","description":{"content":"Define the ''digit product'' $f(x)$ of a positive integer $x$ as the product of all its digits. For example, $f(1234) = 1 \\times 2 \\times 3 \\times 4 = 24$, and $f(100) = 1 \\times 0 \\times 0 = 0$. Giv","description_type":"Markdown"},"platform":"Luogu","limit":{"time_limit":1000,"memory_limit":262144},"difficulty":{"LuoguStyle":"P1"},"is_remote":true,"is_sync":true,"sync_url":null,"sign":"LGP9651"},"statements":[{"statement_type":"Markdown","content":"Define the ''digit product'' $f(x)$ of a positive integer $x$ as the product of all its digits. For example, $f(1234) = 1 \\times 2 \\times 3 \\times 4 = 24$, and $f(100) = 1 \\times 0 \\times 0 = 0$.\n\nGiven two integers $l$ and $r$, please calculate the following value:\n$$(\\prod_{i=l}^r f(i)) \\mod (10^9+7)$$ \nIn case that you don't know what $\\prod$ represents, the above expression is the same as \n$$(f(l) \\times f(l+1) \\times \\dots \\times f(r)) \\mod (10^9+7)$$\n\n## Input\n\nThere are multiple test cases. The first line of the input contains an integer $T$ (about $10^5$), indicating the number of test cases. For each test case:\n\nThe first and only line contains two integers $l$ and $r$ ($1 \\le l \\le r \\le 10^9$), indicating the given two integers. The integers are given without leading zeros.\n\n## Output\n\nFor each test case output one line containing one integer indicating the answer.\n\n[samples]\n\n## Note\n\nFor the first sample test case, the answer is $9! \\mod (10^9+7) = 362880$.\n\nFor the second sample test case, the answer is $(f(97) \\times f(98) \\times f(99)) \\mod (10^9+7) = (9 \\times 7 \\times 9 \\times 8 \\times 9 \\times 9) \\mod (10^9+7) = 367416$.","is_translate":false,"language":"English"}],"meta":{"iden":"LGP9651","tags":["2019","O2优化","陕西","省赛/邀请赛"],"sample_group":[["2\n1 9\n97 99\n","362880\n367416\n"]],"created_at":"2026-03-03 11:09:25"}}