Time limit
2s
Memory limit
128 MB
Given two natural numbers M and N, find every perfect square between M and N, inclusive. Print the sum of those perfect squares and the smallest one. For example, if M=60 and N=100, the perfect squares in the range are 64, 81, and 100, so their sum is 245 and the smallest is 64.
The first line contains M, and the second line contains N. M and N are natural numbers not greater than 10000, and M is less than or equal to N.
Find all perfect squares between M and N, inclusive. If at least one exists, print their sum on the first line and the smallest one on the second line. If none exists, print -1 on the first line.