import java.util.Scanner; public class Main { public static void main(String[] args) throws Exception { Scanner sc = new Scanner(System.in); long k = sc.nextInt(); sc.close(); long v1 = (2 * k + 1) * k; long v2 = (2 * k - 1) * (k - 1); System.out.println(v1 + v2 + k + k + 1); } }