#include <iostream>
#include <math.h>
using namespace std;
int m, n;
int main() {
cin >> m >> n;
int s = 0, minimum = INT_MAX;
for (int i = m; i <= n; i++) {
if (sqrt(i) - int(sqrt(i)) == 0) {
s += i;
if (minimum > i) minimum = i;
}
}
cout << s << endl << minimum;
return 0;
}