{"trustable":true,"prependHtml":"\u003cstyle type\u003d\"text/css\"\u003e\n #problem-body \u003e pre {\n display: block;\n padding: 9.5px;\n margin: 0 0 10px;\n font-size: 13px;\n line-height: 1.42857143;\n word-break: break-all;\n word-wrap: break-word;\n color: #333;\n background: rgba(255, 255, 255, 0.5);\n border: 1px solid #ccc;\n border-radius: 6px;\n }\n\u003c/style\u003e\n","sections":[{"title":"","value":{"format":"HTML","content":"\u003cdiv id\u003d\"problem-body\"\u003e\n\t\u003cp\u003eA number is said to be a 369 number if\u003c/p\u003e\r\n\u003col\u003e\r\n\u003cli\u003eThe count of 3s is equal to count of 6s and the count of 6s is equal to count of 9s.\u003c/li\u003e\r\n\u003cli\u003eThe count of 3s is at least 1.\u003c/li\u003e\r\n\u003c/ol\u003e\r\n\u003cp\u003eFor Example 12369, 383676989, 396 all are 369 numbers whereas 213, 342143, 111 are not.\u003c/p\u003e\r\n\u003cp\u003eGiven A and B find how many 369 numbers are there in the interval [A, B]. Print the answer modulo 1000000007.\u003c/p\u003e\r\n\u003cp\u003e\u003cstrong\u003eInput\u003c/strong\u003e\u003c/p\u003e\r\n\u003cp\u003eThe first line contains the number of test cases (T) followed by T lines each containing 2 integers A and B.\u003c/p\u003e\r\n\u003cp\u003e\u003cstrong\u003eOutput\u003c/strong\u003e\u003c/p\u003e\r\n\u003cp\u003eFor each test case output the number of 369 numbers between A and B inclusive.\u003c/p\u003e\r\n\u003cp\u003e\u003cstrong\u003eConstraints\u003c/strong\u003e\u003c/p\u003e\r\n\u003cp\u003eT\u0026lt;\u003d100\u003c/p\u003e\r\n\u003cp\u003e1\u0026lt;\u003dA\u0026lt;\u003dB\u0026lt;\u003d10^50\u003c/p\u003e\r\n\u003cp\u003e\u003cstrong\u003eSample Input\u003c/strong\u003e\u003c/p\u003e\r\n\u003cp\u003e3\u003c/p\u003e\r\n\u003cp\u003e121 4325\u003c/p\u003e\r\n\u003cp\u003e432 4356\u003c/p\u003e\r\n\u003cp\u003e4234 4325667\u003c/p\u003e\r\n\u003cp\u003e\u003cstrong\u003eSample Output\u003c/strong\u003e\u003c/p\u003e\r\n\u003cp\u003e60\u003c/p\u003e\r\n\u003cp\u003e58\u003c/p\u003e\r\n\u003cp\u003e207159\u003c/p\u003e\r\n\u003cp\u003e\u0026nbsp;\u003c/p\u003e\n\u003c/div\u003e"}}]}