简单粗暴,先求所有的数,再累加

import java.util.Scanner;

public class HJ100 {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        while (sc.hasNextInt()) {
            int n = sc.nextInt();
            int[] dp = new int[n];
            dp[0] = 2;
            dp[1] = 5;
            int sum = 7;
            for (int i = 2; i < dp.length; i++) {
                dp[i] = dp[i - 1] + 3;
                sum += dp[i];
            }
            System.out.println(sum);
        }
    }
}