<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.*;

import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import java.util.Set;
import java.util.TreeMap;
import java.util.TreeSet;

public class Main{
	
	public static void main(String[] args) throws Exception {

		int a = nextInt();
		int ans = 1;
		for(int i = 1; i < a; i++){
			ans = ans + 12*i;
		}
		exit(ans);
	}
	
	private static PrintWriter out;
	private static BufferedReader inB;
	private static boolean FILE = false; 
	
	static {
		try {
			out = new PrintWriter(FILE ? (new FileOutputStream("output.txt")) : System.out);
			inB = new BufferedReader(new InputStreamReader(FILE ? new FileInputStream("input.txt") : System.in));
		} catch(Exception e) {e.printStackTrace();}
	}
	
	private static StreamTokenizer in = new StreamTokenizer(inB);
	
	private static void exit(Object o) throws Exception {
		out.println(o);
		out.flush();
		System.exit(0);
	}
	private static void println(Object o) throws Exception{
		out.println(o);
		out.flush();
	}
	private static void print(Object o) throws Exception{
		out.print(o);
		out.flush();
	}
	private static int nextInt() throws Exception {
		in.nextToken();
		return (int)in.nval;
	}  
	private static String nextString() throws Exception {
		in.nextToken();
		return in.sval;        
	}
} 