#include <stdio.h>
#include <stdlib.h>
#include <string.h>


#define max 3000
#define row 1001
#define col 1001
#define N  8


/*


y = 3x+2;

*/





int main()
{
   char s[max];
   char d[max];
   char ss[N][col];
   int seq[N];
   int cnt[N];

   int i = 0, j = 0, k = 0, m = 0, n = 0;
   char a, b, c;
   int  x = 0, y = 0, z = 0;

   while (scanf("%d", &x) != EOF)
   {
      y = 0;

      for (i = 0; i < x; i++)
      {
         y += 3*i + 2;
      }

      printf("%d\n", y);
   }


   return 0;
}