x = int(input())
y = int(input())
sum = 0
a = 1
l = []
while(1):
    if a**2 > y:
        break
    if a**2 >= x:
        sum += a**2
        l.append(a**2)
    a += 1
if sum != 0:
    print(sum)
    print(l[0])
else:
    print(-1)
47a8b40af6d1c7aa5b06252f4a4b45716d446f7c
<mask token>

<mask token>
while 1:
    if a ** 2 > y:
        break
    if a ** 2 >= x:
        sum += a ** 2
        l.append(a ** 2)
    a += 1
if sum != 0:
    print(sum)
    print(l[0])
else:
    print(-1)

x = int(input())
y = int(input())
sum = 0
a = 1
l = []
while 1:
    if a ** 2 > y:
        break
    if a ** 2 >= x:
        sum += a ** 2
        l.append(a ** 2)
    a += 1
if sum != 0:
    print(sum)
    print(l[0])
else:
    print(-1)

x = int(input())
y = int(input())
sum = 0
a = 1
l = []
while(1):
    if a**2 > y:
        break
    if a**2 >= x:
        sum += a**2
        l.append(a**2)
    a += 1
if sum != 0:
    print(sum)
    print(l[0])
else:
    print(-1)