<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.InputStreamReader;
import java.io.PrintWriter;

public class Main {

    public static final long MOD = (long) 1e9 + 7;

    public static void main(String[] args) throws Exception {
        BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
        InputReader inputReader = new InputReader(in);
        PrintWriter out = new PrintWriter(System.out);
        
        int n = inputReader.getNextInt();
        int[] sol = new int[n+1];

        int x = -1;
        int y = 1;
        sol[1] = 1;

        for (int i = 2; i <=n; i++) {
            x = x + 2;
            y = y + 1;
            sol[i] = sol[i-1] + (y + y + x - 1) * 3;
        }

        out.println(sol[n]);

        in.close();
        out.close();
    }

    public static boolean isGoodNumber(int x, int a, int b) {
        while (x > 0) {
            int last = x % 10;
            if (last != a && last != b) {
                return false;
            }
            x = x / 10;
        }
        return true;
    }

    public static long exp(long b, long e, long mod) {
        long sol = 1;
        while(e > 0) {
            if (e % 2 > 0) {
                sol = (sol * b) % mod;
            }

            b = (b * b) % mod;
            e = e / 2;
        }
        return sol;
    }

    public static class InputReader {

        static final String SEPARATOR = " ";

        String[] split;
        int head = 0;
        BufferedReader in;

        public InputReader(BufferedReader in) {
            this.in = in;
        }

        private void fillBuffer() throws RuntimeException {
            try {
                if (split == null || head >= split.length) {
                    head = 0;
                    split = in.readLine().split(SEPARATOR);
                }
            } catch(Exception e) {
                throw new RuntimeException(e);
            }
        }

        public String getNextToken() throws RuntimeException {
            fillBuffer();
            return split[head++];

        }

        public int getNextInt() throws RuntimeException {
            return Integer.parseInt(getNextToken());
        }

        public long getNextLong() throws RuntimeException {
            return Long.parseLong(getNextToken());
        }
    }

    public static <T> String arrayToString(T[] arr) {
        StringBuilder stringBuilder = new StringBuilder();
        for(T x: arr) {
            stringBuilder.append(x + " ");
        }
        return stringBuilder.toString();
    }
}