<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

// ~/BAU/ACM-ICPC/Teams/A++/BlackBurn95
// ~/sudo apt-get Accpeted

import java.io.*;
import java.util.*;
import java.math.*;
import static java.lang.Math.*;
import static java.lang.Integer.parseInt;
import static java.lang.Long.parseLong;
import static java.lang.Double.parseDouble;
import static java.lang.String.*;

public class Main {
    
    public static void main(String[] args) throws IOException {
        BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
        StringBuilder out = new StringBuilder();
        StringTokenizer tk;
        
        int [] a = new int[18258];
        a[0] = 1;
        a[1] = 12;
        
        for(int i=2; i<a.length; i++) 
            a[i] = a[i-1]+12;
        
        int n = parseInt(in.readLine());
        int sum = 0;
        for(int i=0; i<n; i++)
            sum += a[i];
        
        System.out.println(sum);
    }
    
}