The king’s landing is the capital of the seven kingdom’s in Westros, the master of coin in king’s landing has the job of keeping balance between value of commodities in Westros. Common people in westros may either use coin or barter system to trade. To keep the balance the master of coin has to compare the prices at which the various commodities are getting trades in comparision with gold dragons, silver stags and copper groats. One gold dragon is equal to 210 silver stags and one silver stag is equal to 2940 copper groats.
As the master of coin, your will get list of trades that have taken place during that particular day and have to ensure that the trades that have taken place
currency circulation is proper
value of currency is maintained
Input:
Total number of commodities in market is n
100
total number of trades that have taken place
4000
next n lines contain two space seprated integers, the commodity id and the value of each commodity in copper groats
the next t lines contain, three space seprated integers, the id of first commodity, the id of second commodity traded with the first commodity and the number of units of second commodity exchanged for one unit of first commodity.
Output:
Expected output should contain one line having one decimal value upto four digits, maximum difference between the actual price of gold dragon to the price at which gold dragon is getting traded in market.