fork download
  1. import java.util.*;
  2. import java.lang.*;
  3. import java.io.*;
  4. import java.util.Scanner;
  5.  
  6. class Main {
  7.  
  8. public static void main (String args[]) {
  9.  
  10. int a1 = 2;
  11. int d = 2;
  12. int sum = 0;
  13.  
  14. Scanner scanner = new Scanner(System.in);
  15. int n = scanner.nextInt();
  16.  
  17. sum = ((2*a1 + d*(n - 1))/2)*n;
  18.  
  19. System.out.println(sum + 1);
  20.  
  21. }
  22. }
Success #stdin #stdout 0.14s 321344KB
stdin
560
stdout
314161