<image>

Input

The input contains a single integer a (1 ≤ a ≤ 18257).

Output

Print a single integer output (1 ≤ output ≤ 2·109).

Examples

Input

2


Output

13
/**
 * Created with IntelliJ IDEA.
 * User: alexey
 * Date: 21.03.13
 * Time: 22:13
 * To change this template use File | Settings | File Templates.
 */
import java.io.BufferedReader;
import java.io.IOException;
import java.io.PrintWriter;
import java.io.*;
import java.util.Arrays;
import java.util.Random;
import java.util.StringTokenizer;


public class davay {

    public static void main(String... args)throws  IOException{


        br = new BufferedReader(new InputStreamReader(System.in));
        out = new PrintWriter(System.out);
        int n  = nextInt();
        int res=1,pr =12;
       for (int i =1;i<n;i++){
           res+=pr;  pr+=12;
       }
        out.print(res);
        out.close();
    }




    public static StringTokenizer st;
    public static BufferedReader br;
   public static PrintWriter out;

    public static String nextToken() throws IOException {
        while ( st == null || !st.hasMoreTokens() ) {
            st = new StringTokenizer(br.readLine());
        }
        return st.nextToken();
    }

    public static int nextInt() throws NumberFormatException, IOException {
        return Integer.parseInt(nextToken());
    }

    public static double nextDouble() throws NumberFormatException, IOException {
        return Double.parseDouble(nextToken());
    }

    public static long nextLong() throws NumberFormatException, IOException {
        return Long.parseLong(nextToken());
    }

    public static int[] ReadIntArray(int n) throws IOException {
        int[] a = new int[n];
        for ( int i = 0; i < n; i++ ) {
            a[i] = nextInt();
        }
        return a;

    }
    public static void PrintArray(int[] arr) throws IOException{
             for ( int i = 0; i < arr.length; i++ )
                 out.print(arr[i] + " ");

    }
    public static long[] ShuffleArray(long [] arr)
    {
        Random rnd = new Random();

        int n = arr.length;
        long    temp;
        int     ind;
        while (n > 1)
        {
            ind = rnd.nextInt(n--);
            temp = arr[ind];
            arr[ind] = arr[n];
            arr[n] = temp;
        }

        return arr;
    }
}
