<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> tabla = new Hashtable<BigInteger, BigInteger>();
		tabla.put(new BigInteger("1"), new BigInteger("1"));
		tabla.put(new BigInteger("2"), new BigInteger("13"));
		for (int i = 3; i <= 18257; i++) {
			BigInteger a=tabla.get(new BigInteger(String.valueOf(i-1)));
			BigInteger f=new BigInteger("12").multiply(new BigInteger((i-1)+""));
			tabla.put(new BigInteger(String.valueOf(i)),a.add(f));
		}
		int n = scan.nextInt();
		System.out.println(tabla.get(new BigInteger(n+"")));
		
	}
}