|
|||
Vote
There’s an election in Peter’s city: two parties, A and B are fighting for power. In the city there are districts, in the th district there are voters (). By winning the th district a party can delegate members to the city council. You win the district if you have the majority of the votes in it and you win the election by delegating the majority of the members of the city council. It is known that for the th district, that golden coins are required for one voter to change his voting preferences. From opinion polls, we know that without any interference, in the th district people would vote for party A and people would vote for party B (). Peter wants Party A to win the election. Please calculate : the minimal amount of golden coins party A needs to spend to win the election.Input specificationIn the first line there is a number . Then lines follow with four numbers each - - describing the situation in the th district . Output specificationA single line with the number Constraints
Sample input 1
Sample output 1
Sample input 2
Sample output 2
Sample input 3
Sample output 3
|
|||
University of Debrecen; Faculty of Informatics; v. 09/30/2024 |