E9.54. Solution: Static and recursive sum method