{"trustable":false,"sections":[{"title":"","value":{"format":"HTML","content":"\u003cp\u003e\r\n\tThere are \u003ci\u003en\u003c/i\u003e chameleons moving along a circle of length \u003ci\u003eL\u003c/i\u003e with speed 1, each moving either clockwise or counter-clockwise. \u003cspan data-scayt_word\u003d\"i-th\" data-scaytid\u003d\"9\"\u003e\u003ci\u003ei\u003c/i\u003e-th\u003c/span\u003e chameleon is initially located at point \u003ci\u003ep\u003c/i\u003e\u003csub\u003e\u003ci\u003ei\u003c/i\u003e\u003c/sub\u003e and has color \u003cspan data-scayt_word\u003d\"ci\" data-scaytid\u003d\"5\"\u003e\u003ci\u003ec\u003c/i\u003e\u003csub\u003e\u003ci\u003ei\u003c/i\u003e\u003c/sub\u003e\u003c/span\u003e, which is represented by an integer number.\u003cbr /\u003e\r\n\t\u003cbr /\u003e\r\n\tWhen two chameleons meet, the following happens:\u003c/p\u003e\r\n\u003cp\u003e\r\n\t\u0026nbsp;\u003c/p\u003e\r\n\u003cp\u003e\r\n\t\u003cli\u003e\r\n\t\tThe one that was traveling counter-clockwise changes color to the color of the clockwise one.\u003c/li\u003e\r\n\u003c/p\u003e\r\n\u003cp\u003e\r\n\t\u0026nbsp;\u003c/p\u003e\r\n\u003cp\u003e\r\n\t\u0026nbsp;\u003c/p\u003e\r\n\u003cp\u003e\r\n\t\u003cli\u003e\r\n\t\tThey turn around, so the one that was traveling counter-clockwise now travels clockwise, and vice versa.\u003cbr /\u003e\r\n\t\t\u003cbr /\u003e\r\n\t\tIt\u0026#39;s not so difficult to figure out that the ordering of chameleons among the circle always stays the same, and it is impossible for more than two chameleons to meet at the same point.\u003cbr /\u003e\r\n\t\t\u003cbr /\u003e\r\n\t\tWhat will be the locations and colors of all chameleons at time \u003ci\u003eT\u003c/i\u003e (the input data describes time 0)?\u003c/li\u003e\r\n\u003c/p\u003e"}},{"title":"Input","value":{"format":"HTML","content":"\u003cp\u003e\r\n\tThe first line of the input file contains an integer \u003ci\u003en\u003c/i\u003e, \u003cimg src\u003d\"http://acm.sgu.ru/cache/33922864e51c97a398d07ef4979f8817.png\" style\u003d\"vertical-align:text-bottom;position:relative;top:-2px;\" /\u003e. The second line contains an integer \u003ci\u003eL\u003c/i\u003e, 1 \u0026le; \u003ci\u003eL\u003c/i\u003e \u0026le; 10\u003csup\u003e9\u003c/sup\u003e. The next \u003ci\u003en\u003c/i\u003e lines contain 3 integers each, \u003ci\u003ep\u003c/i\u003e\u003csub\u003e\u003ci\u003ei\u003c/i\u003e\u003c/sub\u003e, \u003cspan data-scayt_word\u003d\"ci\" data-scaytid\u003d\"1\"\u003e\u003ci\u003ec\u003c/i\u003e\u003csub\u003e\u003ci\u003ei\u003c/i\u003e\u003c/sub\u003e\u003c/span\u003e, \u003cspan data-scayt_word\u003d\"di\" data-scaytid\u003d\"2\"\u003e\u003ci\u003ed\u003c/i\u003e\u003csub\u003e\u003ci\u003ei\u003c/i\u003e\u003c/sub\u003e\u003c/span\u003e\u0026nbsp;\u0026mdash; the location, color and direction of \u003cspan data-scayt_word\u003d\"i-th\" data-scaytid\u003d\"6\"\u003e\u003ci\u003ei\u003c/i\u003e-th\u003c/span\u003e chameleon, 0 \u0026le; \u003ci\u003ep\u003c/i\u003e\u003csub\u003e\u003ci\u003ei\u003c/i\u003e\u003c/sub\u003e \u0026lt; \u003ci\u003eL\u003c/i\u003e, 1 \u0026le; \u003cspan data-scayt_word\u003d\"ci\" data-scaytid\u003d\"3\"\u003e\u003ci\u003ec\u003c/i\u003e\u003csub\u003e\u003ci\u003ei\u003c/i\u003e\u003c/sub\u003e\u003c/span\u003e \u0026le; 10\u003csup\u003e9\u003c/sup\u003e, \u003cspan data-scayt_word\u003d\"di\" data-scaytid\u003d\"4\"\u003e\u003ci\u003ed\u003c/i\u003e\u003csub\u003e\u003ci\u003ei\u003c/i\u003e\u003c/sub\u003e\u003c/span\u003e is either -1 or 1. The last line contains an integer \u003ci\u003eT\u003c/i\u003e, 0 \u0026le; \u003ci\u003eT\u003c/i\u003e \u0026le; 10\u003csup\u003e18\u003c/sup\u003e.\u003cbr /\u003e\r\n\t\u003cbr /\u003e\r\n\tThe coordinate system is chosen in such a way that increasing one\u0026#39;s coordinate means moving clockwise, and points on the circle have coordinates between 0 (inclusive) and \u003ci\u003eL\u003c/i\u003e (exclusive). \u003cspan data-scayt_word\u003d\"di\" data-scaytid\u003d\"13\"\u003e\u003ci\u003ed\u003c/i\u003e\u003csub\u003e\u003ci\u003ei\u003c/i\u003e\u003c/sub\u003e\u003c/span\u003e can take one of two values: 1 for moving clockwise, and -1 for moving counter-clockwise.\u003cbr /\u003e\r\n\t\u003cbr /\u003e\r\n\tAll \u003ci\u003ep\u003c/i\u003e\u003csub\u003e\u003ci\u003ei\u003c/i\u003e\u003c/sub\u003e are different.\u003c/p\u003e"}},{"title":"Output","value":{"format":"HTML","content":"\u003cp\u003e\r\n\tOutput \u003ci\u003en\u003c/i\u003e lines with 3 numbers each, one floating-point (location) and two integers (color and direction), having the same meaning as the input numbers, but describing time \u003ci\u003eT\u003c/i\u003e. The chameleons should be described in the same order as in the input file. It is guaranteed that no chameleons will meet at exactly \u003ci\u003eT\u003c/i\u003e. Your answer will be accepted when each number is within 10\u003csup\u003e-9\u003c/sup\u003e relative or absolute error of the correct answer. Please note that the coordinate you output should always be more than or equal to 0 and strictly less than \u003ci\u003eL\u003c/i\u003e. Your answer will not be accepted when you output a coordinate very close to \u003ci\u003eL\u003c/i\u003e but the correct answer is 0.\u003c/p\u003e"}},{"title":"Hint","value":{"format":"HTML","content":"\u003ctable cellpadding\u003d\"4\" cellspacing\u003d\"0\" style\u003d\"border-style: solid; border-color: black; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; border-collapse: collapse;\"\u003e\r\n\t\u003ctbody\u003e\r\n\t\t\u003ctr\u003e\r\n\t\t\t\u003ctd style\u003d\"border-style: solid; border-color: black; font-size: 11pt; border-collapse: collapse;\" valign\u003d\"top\" width\u003d\"400\"\u003e\r\n\t\t\t\t\u003cpre\u003e\r\n\t\t\t\tsample input\u003c/pre\u003e\r\n\t\t\t\u003c/td\u003e\r\n\t\t\t\u003ctd style\u003d\"border-style: solid; border-color: black; font-size: 11pt; border-collapse: collapse;\" valign\u003d\"top\" width\u003d\"400\"\u003e\r\n\t\t\t\t\u003cpre\u003e\r\n\t\t\t\tsample output\u003c/pre\u003e\r\n\t\t\t\u003c/td\u003e\r\n\t\t\u003c/tr\u003e\r\n\t\t\u003ctr\u003e\r\n\t\t\t\u003ctd style\u003d\"border-style: solid; border-color: black; font-size: 11pt; border-collapse: collapse;\" valign\u003d\"top\" width\u003d\"400\"\u003e\r\n\t\t\t\t\u003cpre\u003e\r\n\t\t\t\t4\r\n13\r\n2 1 1\r\n0 2 -1\r\n12 3 1\r\n5 2 1\r\n23\r\n\u003c/pre\u003e\r\n\t\t\t\u003c/td\u003e\r\n\t\t\t\u003ctd style\u003d\"border-style: solid; border-color: black; font-size: 11pt; border-collapse: collapse;\" valign\u003d\"top\" width\u003d\"400\"\u003e\r\n\t\t\t\t\u003cpre\u003e\r\n\t\t\t\t2.000 2 1\r\n12.000 1 1\r\n9.000 3 1\r\n3.000 3 -1\u003c/pre\u003e\r\n\t\t\t\t\u003cdiv\u003e\r\n\t\t\t\t\t\u0026nbsp;\u003c/div\u003e\r\n\t\t\t\u003c/td\u003e\r\n\t\t\u003c/tr\u003e\r\n\t\u003c/tbody\u003e\r\n\u003c/table\u003e"}}]}