{"trustable":true,"sections":[{"title":"","value":{"format":"HTML","content":"\u003cbr\u003eFrom the very early days of the Kingdom one of the most honorable duties for its citizen was the duty of the Royal Guardian. The Guardians serve as personal bodyguards for the King. At any moment of time exactly one of the Guardians was assigned to perform this duty.\u003cbr\u003eRecently the King have issued the new labour rules. According to these rules the five day working week (from Monday to Friday) became mandatory for all citizens. Each working day starts at 9:00 in the morning and lasts until 18:00 in the evening. Any duties in non-working hours are subject for additional reward, however it is not allowed to work more than \u003ci\u003eT\u003c/i\u003e non-working hours during one calendar week. A week starts on 00:00 on Monday and ends on 24:00 on Sunday.\u003cbr\u003eThe Labour Union of Guardians has decided to check the schedule of duties of the Royal Guardians, and you were chosen to help them.\u003cbr\u003eYou are given the initial schedule of duties, and a list of updates to this schedule. Find the fraction of time during which the entire schedule was valid according to the labour rules. You are only interested in time interval from \u003ci\u003eT\u003c/i\u003e\u003csub\u003e1\u003c/sub\u003e to \u003ci\u003eT\u003c/i\u003e\u003csub\u003e2\u003c/sub\u003e, so you ignore all the duties outside this interval.\u003cbr\u003e\u003cdiv align\u003d\"left\" style\u003d\"margin-top: 1.0em;\"\u003e\u003cb\u003eInput\u003c/b\u003e\u003c/div\u003eThe first line of the input file contains three integers \u003ci\u003eN\u003c/i\u003e, \u003ci\u003eM\u003c/i\u003e and \u003ci\u003eT\u003c/i\u003e. Here \u003ci\u003eN\u003c/i\u003e (1 ≤ \u003ci\u003eN\u003c/i\u003e ≤ 10\u003csup\u003e5\u003c/sup\u003e) is the number of entries in the schedule, \u003ci\u003eM\u003c/i\u003e (0 ≤ \u003ci\u003eM\u003c/i\u003e ≤ 10\u003csup\u003e5\u003c/sup\u003e) is the number of updates to the schedule, and \u003ci\u003eT\u003c/i\u003e (0 ≤ \u003ci\u003eT\u003c/i\u003e ≤ 123) is the number of hours that one is allowed to work during the non-working hours per week.\u003cbr\u003eThe second line contains two dates\u0026nbsp;— \u003ci\u003eT\u003c/i\u003e\u003csub\u003e1\u003c/sub\u003e and \u003ci\u003eT\u003c/i\u003e\u003csub\u003e2\u003c/sub\u003e (It is guaranteed that \u003ci\u003eT\u003c/i\u003e\u003csub\u003e1\u003c/sub\u003e comes earlier than \u003ci\u003eT\u003c/i\u003e\u003csub\u003e2\u003c/sub\u003e).\u003cbr\u003eThe next \u003ci\u003eN\u003c/i\u003e lines describes the initial schedule of the Guardians. Each line consists of a date \u003ci\u003eD\u003c/i\u003e\u003csub\u003e\u003ci\u003ei\u003c/i\u003e\u003c/sub\u003e and the name of the Guardian that starts his duty at time \u003ci\u003eD\u003c/i\u003e\u003csub\u003e\u003ci\u003ei\u003c/i\u003e\u003c/sub\u003e (1 ≤ \u003ci\u003ei\u003c/i\u003e ≤ \u003ci\u003eN\u003c/i\u003e, it is guaranteed that \u003ci\u003eD\u003c/i\u003e\u003csub\u003e\u003ci\u003ei\u003c/i\u003e\u003c/sub\u003es are in ascending order, and \u003ci\u003eD\u003c/i\u003e\u003csub\u003e1\u003c/sub\u003e comes no later than \u003ci\u003eT\u003c/i\u003e\u003csub\u003e1\u003c/sub\u003e). (The name is a case-sensitive sequence of English characters.) After starting his duty at time \u003ci\u003eD\u003c/i\u003e\u003csub\u003e\u003ci\u003ei\u003c/i\u003e\u003c/sub\u003e the Guardian serves until the next Guardian comes to replace him.\u003cbr\u003eEach of the following \u003ci\u003eM\u003c/i\u003e lines describes the schedule of updates. Each update is described by \u003ci\u003eA\u003c/i\u003e\u003csub\u003e\u003ci\u003ei\u003c/i\u003e\u003c/sub\u003e\u0026nbsp;— the date when this update become active, \u003ci\u003eB\u003c/i\u003e\u003csub\u003e\u003ci\u003ei\u003c/i\u003e\u003c/sub\u003e and \u003ci\u003eE\u003c/i\u003e\u003csub\u003e\u003ci\u003ei\u003c/i\u003e\u003c/sub\u003e (the time slot of the update), and the Guarding name (in the same format as above). When this update becomes active, the schedule is modified in the following manner: this guardian will now serve the duties between \u003ci\u003eB\u003c/i\u003e\u003csub\u003e\u003ci\u003ei\u003c/i\u003e\u003c/sub\u003e and \u003ci\u003eE\u003c/i\u003e\u003csub\u003e\u003ci\u003ei\u003c/i\u003e\u003c/sub\u003e, the schedule outside this time slot is not affected (see the note below the example for more explanations). It is guaranteed that \u003ci\u003eA\u003c/i\u003e\u003csub\u003e\u003ci\u003ei\u003c/i\u003e\u003c/sub\u003e comes no later than \u003ci\u003eB\u003c/i\u003e\u003csub\u003e\u003ci\u003ei\u003c/i\u003e\u003c/sub\u003e, and \u003ci\u003eB\u003c/i\u003e\u003csub\u003e\u003ci\u003ei\u003c/i\u003e\u003c/sub\u003e earlier than \u003ci\u003eE\u003c/i\u003e\u003csub\u003e\u003ci\u003ei\u003c/i\u003e\u003c/sub\u003e. All \u003ci\u003eA\u003c/i\u003e\u003csub\u003e\u003ci\u003ei\u003c/i\u003e\u003c/sub\u003es are in non-descending order. When several updates happen at the same time, you should apply them in the order they\u0027re given in the input file. \u003cbr\u003eAll \u003ci\u003eT\u003c/i\u003e\u003csub\u003e\u003ci\u003ei\u003c/i\u003e\u003c/sub\u003e, \u003ci\u003eD\u003c/i\u003e\u003csub\u003e\u003ci\u003ei\u003c/i\u003e\u003c/sub\u003e, \u003ci\u003eA\u003c/i\u003e\u003csub\u003e\u003ci\u003ei\u003c/i\u003e\u003c/sub\u003e, \u003ci\u003eB\u003c/i\u003e\u003csub\u003e\u003ci\u003ei\u003c/i\u003e\u003c/sub\u003e and \u003ci\u003eE\u003c/i\u003e\u003csub\u003e\u003ci\u003ei\u003c/i\u003e\u003c/sub\u003e in the input file are dates in format YYYY-MM-DD hh:mm. All dates are between 2009-01-01 00:00 and 2009-12-31 23:59, inclusive.\u003cbr\u003e\u003cdiv align\u003d\"left\" style\u003d\"margin-top: 1.0em;\"\u003e\u003cb\u003eOutput\u003c/b\u003e\u003c/div\u003eOutput just one number\u0026nbsp;— the fraction of time from \u003ci\u003eT\u003c/i\u003e\u003csub\u003e1\u003c/sub\u003e to \u003ci\u003eT\u003c/i\u003e\u003csub\u003e2\u003c/sub\u003e during which the schedule was valid according to the labour rules. Your answer will be accepted when it\u0027s within 10\u003csup\u003e-6\u003c/sup\u003e absolute or relative error of the correct one.\u003cbr\u003e"}},{"title":"Sample 1","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\u003e2 1 2\n2009-12-07 09:00 2009-12-07 22:00\n2009-12-07 08:00 Vasya\n2009-12-07 14:00 Vanya\n2009-12-07 15:00 2009-12-07 16:00 2009-12-07 20:00 Vasya \u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003e0.53846153846153844 \u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n"}},{"title":"","value":{"format":"HTML","content":"\u003cbr\u003e\n\u003cdiv align\u003d\"left\" style\u003d\"margin-top: 1.0em;\"\u003e\n \u003cb\u003eNote\u003c/b\u003e\n\u003c/div\u003eHere\u0027s what happens in the example case. We\u0027re only interested in a part of a day, from 9 in the morning to 22 in the evening. Initially, Vasya is scheduled to perform the duties from 9 in the morning to 14 in the afternoon, and Vanya is scheduled to perform the duties from 14 in the afternoon to 22 in the evening. This means Vasya works only during the working hours, and Vanya gets all the hard work of 4 non-working hours, which is more than the maximum of 2 allowed. Thus this schedule is invalid according to the labour rules.\n\u003cbr\u003e\nHowever, at 15 in the afternoon the schedule is updated. Now, Vasya is performing the duties from 9 to 14 and from 16 to 20, and Vanya is performing the duties from 14 to 16 and from 20 to 22. This means 2 non-working hours for each of the Guardians, which is allowed under the labour rules.\n\u003cbr\u003e\nSo the schedule was invalid from 9 in the morning to 15 in the afternoon, and valid from 15 in the afternoon to 22 in the evening, which corresponds to the fraction of 7/13.\n\u003cbr\u003e"}}]}