problem7 in haskell