370. Legal Fraud

Problem Statement:
Bank X decided to collect percentage of cents from all accounts as transaction fee. For example, Adam Smith has \$100.50 in his bank account and he decided to make a withdraw of \$20.00, the bank will take from the 50 cents the same percentage as he took from 100 dollars which is %20. so the bank will take 10 cents as a transaction fee.

It's easy to collect the percentage, 50 cents * 20 dollars / 100 dollars = 10 cents

Another example, Peter Eric has \$780.87 in his bank account and he withdraw \$150, then the bank will take 87*150/780 = 16 cents for the bank.

now after these two operations, Adam has \$80.40 left in his bank account and Peter has \$630.71 left in his account while the bank has total revenue of \$0.26

Input Format:
Integer number BA, the number of bank accounts
Followed by BA lines, each line contains; First Name, Last Name, Balance
Then given W the number of withdraws
Followed by W lines each contains; First Name, Last Name, Withdraw Amount
Write the new Balance for each customer after subtracting the withdraws

1<BA<2000
1<W<100,000

Output Format:
BA + 1 Lines
Each line of the first BA lines contains, First Name, Last Name and the new Balance note that balance must have two digits after the point
The last line contains the total revenue of the Bank from all transaction fees

Sample Input:
3 Adam Smith \$100.50 Peter Eric \$780.87 Mahmoud ElKarargy \$34562.00 6 Mahmoud ElKarargy \$100.00 Adam Smith \$20.00 Mahmoud ElKarargy \$62.00 Mahmoud ElKarargy \$1000.00 Peter Eric \$150.00 Mahmoud ElKarargy \$70.00

Sample Output:
Adam Smith \$80.40 Peter Eric \$630.71 Mahmoud ElKarargy \$33330.00 \$0.26

 Added by: gammal Added at: 2015-03-04 23:12:07 UTC Time Limit: 1 second Partial score: No