<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.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.io.StreamTokenizer;


public class B {
    
    private StreamTokenizer in;
    private PrintWriter out;
    
    public static void main (String[] args) throws IOException {
        new B().solve();
    }
    
    int nextInt () throws IOException {
        in.nextToken();
        return (int)in.nval;
    }
    
    void solve () throws IOException {
        in = new StreamTokenizer(new BufferedReader(/*new FileReader("./src/uva/p10003/input.txt")*/ new InputStreamReader(System.in)));
        out = new PrintWriter(new OutputStreamWriter(System.out));
        
        int a = nextInt();
        
        if (a == 1) {
            out.print(1);
            out.flush();
            return;
        }
        
        int sum = 1;
        
        for (int i = 2; i <= a; i++) {
            sum += ((i * 2 - 2) * 6);
            sum %= 2000000000;
        }
        
        out.print(sum);
        
        out.flush();
    }

}
