Solve SRM 171, Div 2, Problem RPG

- 107.06 pts