Solution to fib problem.