import sys input = sys.stdin.readline MOD = 7000000001 class Fp: def __init__(self, x=0): self.x = x % MOD def __add__(self, other): return Fp(self.x + other.x) def __sub__(self, other): return Fp(self.x - other.x) def __mul__(self, other): return Fp(self.x * other.x) def __iadd__(self, other): self.x = (self.x + other.x) % MOD return self def __isub__(self, other): self.x = (self.x - other.x) % MOD return self def __imul__(self, other): self.x = (self.x * other.x) % MOD return self def pow(self, e): return Fp(pow(self.x, e, MOD)) def __repr__(self): return str(self.x) def subtask(x): # <= x if x <= 0: return Fp(0) L = len(str(x)) ret = Fp(0) # 桁数が短いもの for length in range(1, L): ret += Fp(45) * Fp(100).pow(length - 1) dp = [Fp(0), Fp(0)] sub = [Fp(0), Fp(0)] sub[1] = Fp(1) for keta in range(L): cur = (x // (10 ** keta)) % 10 ndp = [Fp(0), Fp(0)] nsub = [Fp(0), Fp(0)] for dig in range(10): if keta == L - 1 and dig == 0: continue for le in range(2): nle = le if cur > dig: nle = 1 elif cur < dig: nle = 0 nsub[nle] += sub[le] ndp[nle] += dp[le] + Fp(10).pow(L - 1 - keta) * Fp(dig) * sub[le] dp, ndp = ndp, dp sub, nsub = nsub, sub ret += dp[1] return ret def main(): n = int(input()) for _ in range(n): L, R = map(int, input().split()) ans = subtask(R) - subtask(L - 1) print(ans.x) if __name__ == "__main__": main()