#include main () {int n, s = 0;scanf ("%d", &n);for (int i = 1; i <= n; i++) {s += pow (i, i);}printf ("%d\n", s);}