<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.PrintWriter;
import java.util.Scanner;

public class Main {
	public static void main(String[] argv) {
		new Main().run();
	}

	Scanner in;
	PrintWriter out;

	void run() {
		in = new Scanner(System.in);
		out = new PrintWriter(System.out);
		try {
			solve();
		} finally {
			out.close();
		}
	}

	int rev(String s) {
		String res = "";
		for (int i = 0; i < s.length(); i++) {
			res = s.charAt(i) + res;
		}
		return Integer.parseInt(res);
	}

	void solve() {
		int n = in.nextInt();
		int res = 0;
		res += 2 * n - 1;
		int add = 2 * n;
		int add2 = 1;
		for (int i = 1; i <= n - 1; i++) {
			res += 2 * add2++;
		}
		for (int i = 1; i <= n - 1; i++) {
			res += add++ * 2;
		}
		out.println(res);
	}
}