Олимпиадный тренинг

Задача 32977. Elections in USA


Задача

Темы: Вывод формулы
The presidential elections in the United States are held indirectly. A simplified diagram looks like this. First, elections are held in constituencies, in these elections voters (that is, all citizens who have the right to vote) vote. Then the voting takes place in the Electoral College, in this election each constituency is represented by one elector who votes for the candidate who won the election in this
constituency. There are several presidential candidates, but in reality the struggle is between the two candidates from the main parties, so in order to win the election, the candidate must secure strictly more than half of the votes in the Electoral College. But in order for the elector to vote for this candidate, it is necessary that this candidate also get strictly more than half in his constituency
the votes of the electorate. There are cases (for example, in 2016) when, due to such an indirect electoral system, a candidate won the election for whom fewer voters voted than for another candidate who lost the election. 

Let the electoral college consist of N people, that is, there are N electoral districts. Each electoral district, in turn, consists of K voters. Determine the smallest number of voters who could vote for the candidate who won the election. 

The program receives two integers N and K as input (1 ≤ N ≤ 103 , 1 ≤ K ≤ 106 ) and should output a single integer &ndash ; desired number of voters.

Enter Output Note
5
3
6
For this candidate to receive a majority in the board
electors, it is necessary that 3 out of 5 electors
voted for him, that is, the candidate must win
victory in 3 districts. Each constituency consists of 3 voters,
therefore, to win in the district, you need to get 2 votes
in this district.