{"trustable":true,"sections":[{"title":"","value":{"format":"HTML","content":"\u003cdiv class\u003d\"problem_par\"\u003e\u003cdiv class\u003d\"problem_par_normal\"\u003eThe continent of Antagarich was colonized slowly.\r\nLong ago its northern part was inhabited by the elves of Avlee.\r\nLater, the hot southern desert of Bracada was occupied by the white mages.\r\nAt the same time, necromancers settled in Deyja, a land to the north\r\nof Bracada and to the south-west of Avlee.\r\nAlthough white and dark mages didn\u0027t really like each other,\r\neach group had some artifacts that the other group would be happy to buy.\r\nAs a result, the trading relationship between Bracada and Deyja grew stronger,\r\nand soon the mages built a very busy trade route between these lands.\u003c/div\u003e\u003c/div\u003e\u003cdiv class\u003d\"problem_par\"\u003e\u003cdiv class\u003d\"problem_par_normal\"\u003eErathia was founded later, and at first it was stretched along this route.\r\nAt that time Erathia\u0027s economy was based solely on trading,\r\nso new trading guilds appeared all the time.\r\nEach of the guilds was present in a few cities which were consecutively\r\nsituated along the route.\r\nCaravans of each guild travelled between\r\nall pairs of cities of that guild equally often.\u003c/div\u003e\u003c/div\u003e\u003cdiv class\u003d\"problem_par\"\u003e\u003cdiv class\u003d\"problem_par_normal\"\u003eThe state\u0027s treasury was replenished by fees collected from all the caravans\r\nmoving along the trade route.\r\nThere was a fee for each route segment connecting two neighboring cities,\r\nand this fee could change over time.\r\nFor example, the fee could be decreased in the areas of frequent\r\ngoblin attacks, or increased in the areas with high traffic.\u003c/div\u003e\u003c/div\u003e\u003cdiv class\u003d\"problem_par\"\u003e\u003cdiv class\u003d\"problem_par_normal\"\u003eLoins, the royal treasurer, studies Erathia\u0027s economy and tries\r\nto predict the profit of trade guilds.\r\nHe wants to know the amount of money paid in fees by each guild.\r\nHe has a chronologically ordered list of documents that contains all the royal\r\norders changing the fee and all the papers establishing new guilds.\r\nThis data should be used to calculate the average fee paid by a caravan\r\nof a given trade guild.\u003c/div\u003e\u003c/div\u003e"}},{"title":"Input","value":{"format":"HTML","content":"\u003cdiv class\u003d\"problem_par\"\u003e\u003cdiv class\u003d\"problem_par_normal\"\u003eThe first line contains the number \u003ci\u003en\u003c/i\u003e of cities in Erathia and the number \u003ci\u003em\u003c/i\u003e\r\nof documents collected by Loins (2 ≤ \u003ci\u003en\u003c/i\u003e ≤ 10\u003csup\u003e5\u003c/sup\u003e; \u003cnobr\u003e1 ≤ \u003ci\u003em\u003c/i\u003e ≤ 10\u003csup\u003e5\u003c/sup\u003e\u003c/nobr\u003e).\r\nThe following \u003ci\u003em\u003c/i\u003e lines describe the documents of two possible types:\r\n\u003cul\u003e\r\n\u003cli\u003e\r\n“change \u003ci\u003ea\u003c/i\u003e \u003ci\u003eb\u003c/i\u003e \u003ci\u003ed\u003c/i\u003e”: the fee for travelling along each route segment\r\nbetween cities \u003ci\u003ea\u003c/i\u003e and \u003ci\u003eb\u003c/i\u003e changed by \u003ci\u003ed\u003c/i\u003e gold coins (if \u003ci\u003ed\u003c/i\u003e is positive,\r\nthe fee increased; if \u003ci\u003ed\u003c/i\u003e is negative, the fee decreased);\r\n\u003c/li\u003e\u003cli\u003e\r\n“establish \u003ci\u003ea\u003c/i\u003e \u003ci\u003eb\u003c/i\u003e”: a new guild which is present in all cities\r\nbetween \u003ci\u003ea\u003c/i\u003e and \u003ci\u003eb\u003c/i\u003e was established.\r\n\u003c/li\u003e\u003c/ul\u003e\r\nAll numbers are integers; 1 ≤ \u003ci\u003ea\u003c/i\u003e \u0026lt; \u003ci\u003eb\u003c/i\u003e ≤ \u003ci\u003en\u003c/i\u003e; −10\u0026nbsp;000 ≤ \u003ci\u003ed\u003c/i\u003e ≤ 10\u0026nbsp;000.\r\nCities are numbered in the order they are located along the route:\r\nfrom Bracada to Deyja.\r\nThe fee for travelling along a segment was never larger than 10\u0026nbsp;000 gold\r\ncoins, otherwise merchants would protest.\r\nOf course, the fee was always non-negative.\r\nBefore the first royal order changing the fee,\r\nit is equal to zero for all route segments.\u003c/div\u003e\u003c/div\u003e"}},{"title":"Output","value":{"format":"HTML","content":"\u003cdiv class\u003d\"problem_par\"\u003e\u003cdiv class\u003d\"problem_par_normal\"\u003eAfter each document establishing the new guild, output in a single line the\r\naverage amount of fee paid by a caravan of this guild.\r\nThe absolute or relative error should not exceed 10\u003csup\u003e−6\u003c/sup\u003e.\u003c/div\u003e\u003c/div\u003e"}},{"title":"Sample","value":{"format":"HTML","content":"\u003ctable class\u003d\u0027vjudge_sample\u0027\u003e\n\u003cthead\u003e\n \u003ctr\u003e\n \u003cth\u003eInput\u003c/th\u003e\n \u003cth\u003eOutput\u003c/th\u003e\n \u003c/tr\u003e\n\u003c/thead\u003e\n\u003ctbody\u003e\n \u003ctr\u003e\n \u003ctd\u003e\u003cpre\u003e4 5\r\nchange 1 4 2\r\nchange 1 2 -1\r\nestablish 1 2\r\nestablish 2 4\r\nestablish 1 4\r\n\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003e1.00000000\r\n2.66666667\r\n2.83333333\r\n\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n"}}]}