SRM 589 Div 2 problem 1