Solved 347. It takes 83 seconds.
Sped up 347.hs to 44 seconds. Still super slow.