<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 java.util.zip.*;
import java.io.*;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.nio.charset.Charset;
import java.nio.charset.CharsetDecoder;
import java.nio.charset.CharsetEncoder;

import static java.util.Arrays.sort;
import static java.lang.Math.max;
import static java.lang.Math.min;


public class Main {

    private void solve() throws Exception {
        int n=in.nextInt();
        if (n==1){
            out.println(1);
        } else if(n==2) {
            out.println(13);
        } else {
            int s=13;
            int d=1;
            for(int i=3; i <= n; ++i) {
                s += d*6 + 6 * 3;
                d += 2;
            }
            out.println(s);
        }
    }
    
    
    

    private void run() {
        try {
            long start = System.currentTimeMillis();
            in = new FastScanner("input.txt", "output.txt");
            solve();
            out.flush();
            System.err.print("\n\nrunning time = " + (System.currentTimeMillis() - start) * 1e-3);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
    
    
    public static void main(String[] args) {
        Main main = new Main();
        main.run();
    }
    FastScanner in;
    static PrintWriter out;
    static class FastScanner {
        public BufferedReader reader;
        private StringTokenizer tokenizer;
        public FastScanner(String input, String output) {
            try {
                reader = new BufferedReader(new FileReader(new File(input)));
                out = new PrintWriter(new File(output));
                tokenizer = null;
            } catch (Exception e) {
                reader = new BufferedReader(new InputStreamReader(System.in));
                out = new PrintWriter(System.out);
                tokenizer = null;
            }
        }
        public String nextToken() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (Exception e) {
                    e.printStackTrace();
                }
            }
            return tokenizer.nextToken();
        }
        int nextInt() {
            return Integer.parseInt(nextToken());
        }
        long nextLong() {
            return Long.parseLong(nextToken());
        }
    }
}