<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.math.BigInteger;
import java.util.Hashtable;
import java.util.Scanner;

public class Main {
    
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        
        Hashtable<BigInteger, BigInteger> t = new Hashtable<BigInteger, BigInteger>();
        t.put(new BigInteger("1"), new BigInteger("1"));
        t.put(new BigInteger("2"), new BigInteger("13"));
        for (int i = 3; i <= 18257; i++) {
            BigInteger a=t.get(new BigInteger(String.valueOf(i-1)));
            BigInteger f=new BigInteger("12").multiply(new BigInteger((i-1)+""));
            t.put(new BigInteger(String.valueOf(i)),a.add(f));
        }
        int n = scan.nextInt();
        System.out.println(t.get(new BigInteger(n+"")));
        
    }
}