a,b = list(map(int, input().split()))

cnt = 0

itr = b - a

for i in range(a,b+1):

	m = str(i)

	if m[0] == m[4] and m[1] == m[3]:

			cnt += 1

print(cnt)

a, b = list(map(int, input().split()))

cnt = 0

for i in range(a, b+1):

    si = str(i)

    if si[0] == si[4] and si[1] == si[3]:

        cnt += 1

print(cnt)

a, b = list(map(int, input().split()))
cnt = 0
itr = b - a
for i in range(a, b + 1):
    m = str(i)
    if m[0] == m[4] and m[1] == m[3]:
        cnt += 1
print(cnt)

a, b = list(map(int, input().split()))
cnt = 0
for i in range(a, b + 1):
    si = str(i)
    if si[0] == si[4] and si[1] == si[3]:
        cnt += 1
print(cnt)

-itr = b - a -    m = str(i) -    if m[0] == m[4] and m[1] == m[3]: +    si = str(i) +    if si[0] == si[4] and si[1] == si[3]: