DHONDT
In the beginning of December, parliamentary elections were held in our country. Azerbaijan isdivided in10 election regions . From each region, 14 parliamentary representatives are elected. Each of thevoters is voting for one of the few parties. After voting, the representatives are elected using theD'Hondt (D"Ont) method.By this method, first we select parties which gathered at least 5% of the votes. Number of votes ofeach of the selected parties is then divided by every number from 1 to 14. In this way we assign 14rational numbers - let’s call them ‘scores’ - to each of the parties.First of the 14 representatives in a region is chosen from a party with the largest score. Secondrepresentative is selected from a party with the second largest score. The third... This procedurecontinues until all of the 14 places are elected. Remark: There will always be a unique way to electtherepresentatives, i.e. no two scores will be equal.Write a program that, given the total number of voters and number of votes each party gained,determines how many politicians were elected as region representatives from each party. Somepartieshave gained negligible number of votes and will not be in the input - that is the reason that the totalnumber of voters might not be equal to the sum of list votes in the input.
Input
First line of input contains a positive integer X (1 ≤ X ≤ 2 500 000), total number of voters in theregion.Second line of input contains a positive integer N (0 ≤ N ≤ 10), number of parties we areconsidering. Next N lines contain two positive integers divided by a single space: party identifier(capital letter of English alphabet) and a positive integer G (0 ≤ G ≤ 250 000), number of votesgainedby that party.
Output
Output is consisted of number of lines equal to the number of parties which had at least 5% of thevotes. For each of these parties, print a party identifier and a number of parliamentaryrepresentativeselected from that party. Lines should be sorted by identifiers, alphabeticaly.