A binary serach problem(BALLOT on spoj).Again u dont know answer but u know that answer will in this range so u can use binary search.