#include <iostream>
using namespace std;
int main() {
long int s = 0;
int N;
cin >> N;
for (int i = 1; i <= N; i++) {
s += i * i;
cout << i * i << " ";
}
cout << endl << s;
return 0;
#include <iostream>
using namespace std;
int main() {
long int s = 0;
int N;
cin >> N;
for (int i = 1; i <= N; i++) {
s += i * i;
cout << i * i << " ";
}
cout << endl << s;
return 0;
}