/*************************************************************************
 *  Compilation:  javac Sum.java
 *  Execution:    java Sum N
 *  
 *  Compute the sum of the first N integers using recursion.
 *  On Windows, this causes a StackOverflowError. Attempts to allocate
 *  more stack space with -Xss fail.
 *
 *  % java Sum 10012
 *  10012

 *  % java Sum 10013
 *  Exception in thread "main" java.lang.StackOverflowError
 * 
 *  % java -Xss10m Sum 10013
 *  % java Sum 10013
 *
 *************************************************************************/


public class Sum {

    // compute the sum of the first n integers using recursion
    public static int sum(int n) {
        if (n == 0) return 0;
        else return 1 + sum(n-1);
    }

   public static void main(String[] args) {
      int N = Integer.parseInt(args[0]);
      System.out.println(sum(N));
   }

}