<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
//referred professors code
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
 
public class Star {
	static int triangle(int n) {
		return n*(n+1)/2;
	}
	static int hexagon(int n) {
		return triangle(n)*6-n*6+1;
	}
	public static void main(String[] args) throws NumberFormatException, IOException {
    	BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int n = Integer.parseInt(br.readLine());
		System.out.println(triangle(n*3-2)*2-hexagon(n));
	}
}