<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
//  package mainpackage;

import java.io.*;
import java.util.*;

public class Main {
	public static void main(String... args) throws Exception {
		
		out = new PrintWriter(System.out);
		new Main().solve();
		out.close();
	}

	private static PrintWriter out;
	
	private BufferedReader reader;
	private int a;
	
	private void solve() throws Exception {
		
		reader = new BufferedReader(new InputStreamReader(System.in));
		
		a = Integer.parseInt(reader.readLine());
		out.println(6 * a * (a - 1) + 1);
		
		reader.close();
	}
}
