<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
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.Collections;
import java.util.Scanner;


public class Main {

    /**
     * @param args
     * @throws IOException 
     */
    public static void main(String[] args) throws IOException {
        // TODO Auto-generated method stub
        BufferedReader in=new BufferedReader(new InputStreamReader(System.in));
        //Scanner in=new Scanner(System.in);
        PrintWriter out=new PrintWriter(System.out);
        Integer n=Integer.parseInt(in.readLine());
        long sum=1;
        for(int i=2; i<=n; i++){
            sum+=(i-1)*12;
        }
        out.println(sum);
        out.close();
    }

}
