fibsum prev curr acc max | curr > max = acc
| rem curr 2 == 0 = fibsum curr (prev + curr) (acc + curr) max
| otherwise = fibsum curr (prev + curr) acc max
main = print (fibsum 1 1 0 4000000)