problem 72 optimized