<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
// practice with kaiboy
import java.io.*;
import java.util.*;

public class CF171B extends PrintWriter {
	CF171B() { super(System.out, true); }
	Scanner sc = new Scanner(System.in);
	public static void main(String[] $) {
		CF171B o = new CF171B(); o.main(); o.flush();
	}

	int triangle(int n) {
		return n * (n + 1) / 2;
	}
	int hexagon(int n) {
		return triangle(n) * 6 - n * 6 + 1;
	}
	void main() {
		int n = sc.nextInt();
		println(triangle(n * 3 - 2) * 2 - hexagon(n));
	}
}
