#include <iostream>
#include <cmath>
using namespace std;
//Catfish2's function
unsigned long int your_homework(unsigned long int n)
{
if (n == 0)
return 0;
return pow(n, n) + your_homework(n - 1);
}
int main()
{
unsigned long int n, sum;
n = 4; //replace this value for whatever you want n to be off course
sum = your_homework(n);
cout << "sum= " << sum << endl;
return 0;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgojaW5jbHVkZSA8Y21hdGg+Cgp1c2luZyBuYW1lc3BhY2Ugc3RkOwoKLy9DYXRmaXNoMidzIGZ1bmN0aW9uCnVuc2lnbmVkIGxvbmcgaW50IHlvdXJfaG9tZXdvcmsodW5zaWduZWQgbG9uZyBpbnQgbikKewogICAgaWYgKG4gPT0gMCkKICAgICAgICByZXR1cm4gMDsKCiAgICByZXR1cm4gcG93KG4sIG4pICsgeW91cl9ob21ld29yayhuIC0gMSk7Cn0KCmludCBtYWluKCkKewogICAgdW5zaWduZWQgbG9uZyBpbnQgbiwgc3VtOwogICAgbiA9IDQ7IC8vcmVwbGFjZSB0aGlzIHZhbHVlIGZvciB3aGF0ZXZlciB5b3Ugd2FudCBuIHRvIGJlIG9mZiBjb3Vyc2UKICAgIHN1bSA9IHlvdXJfaG9tZXdvcmsobik7CiAgICBjb3V0IDw8ICJzdW09ICIgPDwgc3VtIDw8IGVuZGw7CiAgICByZXR1cm4gMDsKfQ==