// computes first N fibonacci numbers, N is command line argument 
// also counts reursive calls and gives timings

public class fibonacci3{

public static double fib(int n)
{
  count++;
  if ((n==0) || (n==1)) return 1;
      else return fib(n-1) + fib(n-2);
}
static int count=0;
public static void main(String[] args)
{     
  int num,i;
  double answer;
  num= Integer.parseInt(args[0]);
  TimeInterval t= new TimeInterval();
  for(i=0;i<=num;i++){
    t.startTiming();
    count=0;
    answer=fib(i);
    t.endTiming();
    System.out.println("Fib(" + i+ ") = " + answer + "  " + count + " recursive calls, time = " + t.getElapsedTime());

  }
  }
}





