#ifdef NACHIA #define _GLIBCXX_DEBUG #else // disable assert #define NDEBUG #endif #include #include #include #include using namespace std; using ll = long long; const ll INF = 1ll << 60; #define REP(i,n) for(ll i=0; i using V = vector; template void chmax(A& l, const B& r){ if(l < r) l = r; } template void chmin(A& l, const B& r){ if(r < l) l = r; } using i128 = __int128_t; ll M = 7000000001; i128 rev(i128 x){ ll h = 0; while(x){ h = h * 10 + x % 10; x /= 10; } return h; } i128 g(i128 x){ i128 ans = 0; REP(i,x) ans += rev(i); return ans % M; } i128 p10[20]; i128 offset = g(10); i128 f(ll x){ if(x <= 15) return g(x); i128 ans = offset; i128 maxdig = to_string(x).size(); for(i128 d=2; d 0){ maxdig--; while(x % 10) ans += rev(--x) * ti % M; h /= 10; x /= 10; if (x == 0) break; ans += i128(h) % M * 45 % M * (x-(h/10)) % M * ti % M; ti = ti * 10 % M; } return ans % M; } void testcase(){ ll l, r; cin >> l >> r; r++; auto fl = f(l); auto fr = f(r); if(fl > fr) fr += M; cout << ll(fr - fl) << "\n"; } int main(){ cin.tie(0)->sync_with_stdio(0); p10[0] = 1; REP(i,19) p10[i+1] = p10[i] * 10; ll T; cin >> T; REP(t,T) testcase(); return 0; }