Solve #77 in Haskell.