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


public class Star {

	public static Scanner in = new Scanner(System.in);
	
	public static void main(String[] args) {
		int numLayers = in.nextInt();
		int total = 0;
		int odd = 3;
		for (int i = 0; i < numLayers; i ++) {
			if (i == 0)
				total += 1;
			else {
				total += odd * 6 - 6;
				odd += 2;
			}
		}
		System.out.println(total);
	}
	
}
