Please provide a link where I can get the better explanation of this problem.
Explanation is not clear
@imambujsingh08 Please check this link https://codeforces.com/contest/1172/problem/A and look at the sample cases given. These should help you understand what the problem really wants.