Solve #13 in Haskell.