mod = 7000000001 p = [pow(10, i, mod) for i in range(40)] def calc(x): # print(x) if x <= 0: return 0 s = str(x) n = len(s) ans = 0 for l in range(1, n): ans += 45 * p[l - 1] % mod if l > 1: ans += 45 * p[l - 2] % mod * (p[l] - 10) % mod dpc = [0, 0] dps = [0, 0] for i in range(n): ndpc = [0, 0] ndps = [0, 0] lim = int(s[i]) if i == 0: for d in range(1, lim + 1): sm = (d < lim) ndpc[sm] += 1 ndps[sm] += d else: for sm in range(2): if dpc[sm] == 0: continue limd = 9 if sm else lim for d in range(limd + 1): nsm = sm | (d < limd) ndpc[nsm] += dpc[sm] % mod ndps[nsm] += dps[sm] + d * p[i] % mod * dpc[sm] % mod dpc = ndpc dps = ndps return ans + sum(dps) # import codecs n = int(input().replace('\u202e', '')) for i in range(n): l, r = [int(x.replace('\u202e', '')) for x in input().split()] x = calc(r) - calc(l - 1) # print(l, r) x = x % mod print(str(x))