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

public class Solution {
	public static StringTokenizer tok = null;
	public static BufferedReader cin;
	
	public static String nextToken() throws Exception {
		if (tok == null || !tok.hasMoreTokens()) {
			tok = new StringTokenizer(cin.readLine());
		}
		return tok.nextToken();
	}
	
	public static int nextInt() throws Exception {
		return Integer.parseInt(nextToken());
	}
	
	public static double nextDouble() throws Exception {
		return Double.parseDouble(nextToken());
	}
	
	public static void main(String[] args) throws Exception {
		cin = new BufferedReader(new InputStreamReader(System.in));
		int n = nextInt();
		long sum = 0;
		for (int i = 1; i <= n; i++) {
			if (i == 1) {
				sum++;
			} else {
				sum += 6 * (i + i - 2);
			}
		}
		System.out.println(sum);
	}

}
