<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
/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
//package codeforces;

import java.util.Scanner;

/**
 *
 * @author DELL
 */
public class Star {
      public static void solve(){
        Scanner nera = new Scanner(System.in);
        int n = nera.nextInt();
        
        
        if(n==1){
            System.out.println("1");
        }else if(n==2){
            System.out.println("13");
        }else{
            
           // System.out.println(((n-1)/2)*(24+(n-2)*12)+1);
            System.out.println(6*(n-1)*(1+n-1)+1);
        }
          
        
    }
    public static void main(String[] args) {
        
        solve();
    }
}
