<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.InputStream;
import java.io.PrintStream;
import java.util.Scanner;

public class Star {
    
    public static void main(String[] args) {
        
        InputStream in = System.in;
        PrintStream out = System.out;
        Scanner input = new Scanner(in);
        int a = input.nextInt();
        if(a == 1) {
        out.println(1);
        }else {
        int f = 6 * a * (a - 1) + 1;
        out.println(f);
            
        }
    } 
}