{"trustable":true,"sections":[{"title":"","value":{"format":"HTML","content":"\u003cstyle type\u003d\"text/css\"\u003e pre { text-align:left; font-family: \"Courier New\", Courier, monospace; font-size: 16px; white-space: pre; line-height:20px; text-indent: 0px; }\u003c/style\u003e\u003cdiv class\u003d\"pro_desc\"\u003e \n \u003cp\u003e Oaiei is busy working with his graduation design recently. If he can not complete it before the end of the month, and he can not graduate! He will be very sad with that, and he needs your help. There are 24 hours a day, oaiei has different efficiency in different time periods, such as from 0 o’clock to 8 o\u0027clock his working efficiency is one unit per hour, 8 o\u0027clock to 12 o\u0027clock his working efficiency is ten units per hour, from 12 o\u0027clock to 20 o\u0027clock his working efficiency is eight units per hour, from 20 o\u0027clock to 24 o\u0027clock his working efficiency is 5 units per hour. Given you oaiei’s working efficiency in M periods of time and the total time N he has, can you help him calculate his greatest working efficiency in time N. \u003c/p\u003e\n\u003c/div\u003e"}},{"title":"Input","value":{"format":"HTML","content":"\u003cdiv class\u003d\"pro_desc\"\u003e\n \u003cp\u003e There are multiple tests. In each test the first line has two integer N (2 \u0026lt;\u003d N \u0026lt;\u003d 50000) and M (1 \u0026lt;\u003d M \u0026lt;\u003d 500000), N is the length of oaiei’s working hours; M is the number of periods of time. The following M lines, each line has three integer S, T, P (S \u0026lt; T, 0 \u0026lt; P \u0026lt;\u003d 200), represent in the period of time from S to T oaiei’s working efficiency is P units per hour. If we do not give oaiei’s working efficiency in some periods of time, his working efficiency is zero. Oaiei can choose part of the most effective periods of time to replace the less effective periods of time. For example, from 5 o’clock to 10 o’clock his working efficiency is three units per hour and from 1 o’clock to 7 o’clock his working efficiency is five units per hour, he can choose working with five units per hour from 1 o’clocks to 7 o’clock and working with three units per hour from 7 o’clock to 10 o’clock. \u003c/p\u003e\n\u003c/div\u003e"}},{"title":"Output","value":{"format":"HTML","content":"\u003cdiv class\u003d\"pro_desc\"\u003e\n \u003cp\u003e You should output an integer A, which is oaiei’s greatest working efficiency in the period of time from 0 to N. \u003c/p\u003e \n\u003c/div\u003e"}},{"title":"Sample Input","value":{"format":"HTML","content":"\u003cpre\u003e24 4 \r\n0 8 1 \r\n8 12 10 \r\n12 20 8 \r\n20 24 5 \r\n4 3 \r\n0 3 1 \r\n1 2 2 \r\n2 4 5 \r\n10 10\r\n8 9 15\r\n1 7 5\r\n5 10 3\r\n0 7 6\r\n5 8 2\r\n3 7 3\r\n2 9 12\r\n7 8 14\r\n6 7 2\r\n5 6 16\r\n\u003c/pre\u003e"}},{"title":"Sample Output","value":{"format":"HTML","content":"\u003cpre\u003e132 \r\n13\r\n108\r\n\u003c/pre\u003e"}}]}