SRM 596 Div 2 Problem 1