{"trustable":true,"prependHtml":"\u003cscript\u003e window.katexOptions \u003d { disable: true }; \u003c/script\u003e\n\u003cscript type\u003d\"text/x-mathjax-config\"\u003e\n MathJax.Hub.Config({\n tex2jax: {\n inlineMath: [[\u0027$$$\u0027,\u0027$$$\u0027], [\u0027$\u0027,\u0027$\u0027]],\n displayMath: [[\u0027$$$$$$\u0027,\u0027$$$$$$\u0027], [\u0027$$\u0027,\u0027$$\u0027]]\n }\n });\n\u003c/script\u003e\n\u003cscript async src\u003d\"https://mathjax.codeforces.org/MathJax.js?config\u003dTeX-AMS-MML_HTMLorMML\" type\u003d\"text/javascript\"\u003e\u003c/script\u003e","sections":[{"title":"","value":{"format":"HTML","content":"\u003cdiv class\u003d\"panel_content\"\u003eOn the last day before the famous mathematician Swan\u0027s death, he left a problem to the world: Given integers $n$ and $a_i$ for $0\\leq i \\leq 4$, calculate the number of $n$-digit integers which have at most $a_i$-digit $i$ in its decimal representation (and have no $5,6,7,8$ or $9$). Leading zeros are not allowed in this problem.\u003c/div\u003e"}},{"title":"Input","value":{"format":"HTML","content":"There is one integer $T~(1\u0026lt;T\\le 10)$ in the beginning of input, which means that you need to process $T$ test cases. In each test case, there is one line containing six integers representing $n$ and $a_0$ to $a_4$, where $2\\leq n\\leq 15000$ and $0\\leq a_i\\leq 30000$."}},{"title":"Output","value":{"format":"HTML","content":"For each test case, you should print first the identifier of the test case and then the answer to the problem, module $10^9+7$."}},{"title":"Sample","value":{"format":"HTML","content":"\u003ctable class\u003d\u0027vjudge_sample\u0027\u003e\n\u003cthead\u003e\n \u003ctr\u003e\n \u003cth\u003eInput\u003c/th\u003e\n \u003cth\u003eOutput\u003c/th\u003e\n \u003c/tr\u003e\n\u003c/thead\u003e\n\u003ctbody\u003e\n \u003ctr\u003e\n \u003ctd\u003e\u003cpre\u003e10\r\n5 0 1 2 3 4\r\n5 1 1 1 1 1\r\n5 2 2 2 2 2\r\n5 3 3 3 3 3\r\n5 3 2 1 3 2\r\n5 3 2 0 0 0\r\n5 0 0 0 5 0\r\n7000 41 2467 6334 2500 3169\r\n7000 7724 3478 5358 2962 464\r\n7000 5705 4145 7281 827 1961\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003eCase #1: 535\r\nCase #2: 96\r\nCase #3: 1776\r\nCase #4: 2416\r\nCase #5: 1460\r\nCase #6: 4\r\nCase #7: 1\r\nCase #8: 459640029\r\nCase #9: 791187801\r\nCase #10: 526649529\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n"}}]}