<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.util.Scanner;

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 *
 * @author mas1991
 */
public class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int n= in.nextInt();
        int[]d= new int[n+1];
        d[1]=1;
        for (int i = 2; i < d.length; i++) {
        int s=(4*(i-1))+1;
        int tot=(3*s)-3;
        d[i]=d[i-1]+tot;


        }
               System.out.println(d[n]);
    }
}
