Webgame is a new style of game; you do not need the game client. Users can play through the browser. GuduSanGuo is a strategy type of webgame, in GuduSanGuo you can build your own army to attack other country.
There are many kinds of units you can build. Each unit has its own attributes: attack, hit point (hp), armor. When you own a strong army, you can start the war. Of course before the war, you must detect the military strength you attack against. For a coming war, you have to estimate the cost of the war. In the game the cost of the war is the units you lost which can calculated as follows: the number of lost units = (attacks - armor) / hp. Each war breakout among cities, in a city there are more than one kind of unit. So the damage should distribute to each unit. The damage each unit bear is decided by the number of units in the proportion of total units count. For example, there are two kinds of unit: Footman and Archer. The number of Footman is 70 and Archer is 30.If the total damages is 100,the result is,70% damages to Footman and 30% damages to Archer.
Science and technology played an important role, you can upgrade your army’s defense and attack, and you can assume that each level upgrade 10% of the unit’s initial armor and attack.
Also you can attack one city with many cities simultaneously, but the war is calculated separately and the order of the war is decision by arrive time. Now can you program and calculate the results of the war? You should note that all calculations are based on integer, the decimal is ignored.
First line of input is a integer m(m<10) means the number of units. Then followed by m lines, each line contains the unit name, attack value, armor and hp. The next is the information of the city you attack include city name, technology level, and Military details, first line is city name, next line is technology level, then a integer t means the number of units the city have. Followed by t lines contain each unit's name and the number of unit. You can assume that all the unit names are occurred in the total units before. The last is your cities' information. The beginning is the number of cities n(n<10). Then n blocks of city information follow. The format is the same as before, but each block contain an arriving time (an integer) at last.
You should output all war's result, for each war you should give the Attacking side's and Defensive side's basic information such as city name, each unit's name and the number, total attacks and armors then you have to output the lost unit. The sequence of units is ordered by unit name and the war's sequence is ordered by arriving time, that means which war begin first output first. You can see the simple output for the detail.