Solve problem 120 using Haskell.