<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.*;

public class star{
	public static void main(String args[])throws IOException{
		BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
		int c = 0;
		int p = Integer.parseInt(in.readLine());
		int count=-1;
		for(int i=0;i<p;i++){
			c+=i;
			count++;
		}
		int x = 2*p-1;
		int y = x;
		while (count>0){
			y--;
			int z=y*2;
			x+=z;
			count--;
		}
		c=c*6;
		System.out.println(x+c);
	}
}