prob003, 2 optimizations