#include <cstdio> int main() { int n; while(EOF != scanf("%d", &n)) { printf("%d\n", (n * ( 3*n + 1)) / 2 ); } return 0; }