Add foldr' and modify sum' to use foldr'