a = input().split()
m = int(a[0])
n = int(a[1])
c = 0
su = 0
for i in range(m, n + 1):
    w = i // 10000 % 10
    q = i // 1000 % 10
    b = i // 100 % 10
    s = i // 10 % 10
    g = i // 1 % 10
    if w == g and q == s and i % 2 == 0:
        c += 1
        su += i
print(c)
print(su)

/**************************************************************
	Problem: 1743
	User: admin
	Language: Python
	Result: Accepted
	Time:160 ms
	Memory:34480 kb
****************************************************************/