<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.*;
import static java.lang.Math.*;
import static java.util.Arrays.*;

public class B {

    int INF = 1 << 28;

    void run() {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        long sum = 1;
        if( n == 1 ) {
            System.out.println(1);
            return;
        }
        for(int i=2;i<=n;i++) {
            sum += (long)(i-1) * 12;
        }
        System.out.println(sum);
    }

    public static void main(String[] args) {
        new B().run();
    }

    void debug(Object... os) {
        System.err.println(Arrays.deepToString(os));
    }
}
