推下数学公式f(n) = (1 + 3*n) * n / 2

import java.util.*;

public class Main {

    private int sum(int n) {
        return (1 + 3*n) * n / 2;
    }

    public Main() {
        Scanner in = new Scanner(System.in);
        while (in.hasNextInt()) {
            int n = in.nextInt();
            int res = sum(n);
            System.out.println(res);
        }
   }

    public static void main(String[] args) {
        Main solution = new Main();
    } 
}