<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.BufferedReader;
import java.io.InputStreamReader;

public class PrB {

	public static long time;

	public static void main(String[] args) throws Exception {
		time = System.currentTimeMillis();
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		System.out.println(go(br));
		br.close();
		System.exit(0);
	}

	public static int go(BufferedReader br) throws Exception {
		int a = Integer.parseInt(br.readLine());
		a --;
		return 1 + 12 * (a * (a + 1) / 2);
	}

	public static void checkTime() {
		System.out.println(System.currentTimeMillis() - time);
		time = System.currentTimeMillis();
	}
}