<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.*;
import java.util.*;

public class Tasks {

    public static void main(String[] args) throws IOException {

        new Tasks().runMain();
    }

    void runMain() {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();

        if (n == 1) System.out.print(1);
        else if(n == 2) System.out.print(13);
        else {
            int i = 3, starC = 5, starT = 13;
            while (i <= n) {
                starT += (6 * starC - 6);
                starC += 2;
                i++;
            }

            System.out.print(starT);
        }
    }
}