Calculates nth term of Fibonacci sequence