<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;


public class Star {
    public static void main(String[] args) {
        BufferedReader br = null;
        InputStreamReader is = null;
        try {
            is = new InputStreamReader(System.in);
            br = new BufferedReader(is);
            int input = Integer.valueOf(br.readLine());
            if (input == 1) {
                System.out.println("1");
                return;
            }
            if (input == 2) {
                System.out.println("13");
                return;
            }
            int res = 13;
            int buf = 1;
            for (int index = 3; index <= input; ++ index) {
                res += 6 * (3 + buf);
                buf += 2;
            }
            System.out.println(String.valueOf(res));
            return;
        } catch (Exception e) {
            
        }
    }
}
