christmas/Christmas_artur.java

  1 import java.io.BufferedReader;
  2 import java.io.InputStreamReader;
  3 
  4 public class Christmas_artur {
  5 
  6   public static void main(String[] args) throws Exception {
  7     BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
  8     for (long n = Integer.parseInt(in.readLine()); n != 0; n = Integer.parseInt(in.readLine()))
  9       System.out.println(n * (n + 1) / 2 * (n + 2) / 3);
 10   }
 11 }