<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 B {

    public void solve() throws IOException {
        int n = nextInt();
        int ans = 1;
        for (int i = 2; i <= n; i++) {
            ans += (2 * i - 2) * 6;
        }
        writer.println(ans);
    }

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

    BufferedReader reader;
    StringTokenizer tokenizer;
    PrintWriter writer;

    public void run() {
        try {
            long tbegin = System.currentTimeMillis();
            reader = new BufferedReader(new InputStreamReader(System.in));
            //reader = new BufferedReader(new InputStreamReader(new FileInputStream("input.txt")));
            tokenizer = null;
            writer = new PrintWriter(System.out);
            //writer = new PrintWriter(new FileOutputStream("output.txt"));
            solve();
            //reader.close();
            //System.out.println(System.currentTimeMillis() - tbegin + "ms");
            writer.close();
        } catch (Exception e) {
            e.printStackTrace();
            System.exit(1);
        }
    }

    int nextInt() throws IOException {
        return Integer.parseInt(nextToken());
    }

    long nextLong() throws IOException {
        return Long.parseLong(nextToken());
    }

    double nextDouble() throws IOException {
        return Double.parseDouble(nextToken());
    }

    String nextToken() throws IOException {
        while (tokenizer == null || !tokenizer.hasMoreTokens()) {
            tokenizer = new StringTokenizer(reader.readLine());
        }
        return tokenizer.nextToken();
    }

}
