{"trustable":true,"sections":[{"title":"","value":{"format":"HTML","content":"\u003cdiv class\u003d\"panel_content\"\u003e\n In the game of DotA, Pudge’s meat hook is actually the most horrible thing for most of the heroes. The hook is made up of several consecutive metallic sticks which are of the same length.\u003cbr\u003e\u003cbr\u003e\n \u003ccenter\u003e\n \u003cimg style\u003d\"max-width:100%;\" src\u003d\"CDN_BASE_URL/06e06a8171aa23abddf26dca64f45d8c?v\u003d1679380954\"\u003e\n \u003c/center\u003e\u003cbr\u003e\u003cbr\u003e\n Now Pudge wants to do some operations on the hook.\u003cbr\u003e\u003cbr\u003e\n Let us number the consecutive metallic sticks of the hook from 1 to N. For each operation, Pudge can change the consecutive metallic sticks, numbered from X to Y, into cupreous sticks, silver sticks or golden sticks.\u003cbr\u003e\n The total value of the hook is calculated as the sum of values of N metallic sticks. More precisely, the value for each kind of stick is calculated as follows:\u003cbr\u003e\u003cbr\u003e\n For each cupreous stick, the value is 1.\u003cbr\u003e\n For each silver stick, the value is 2.\u003cbr\u003e\n For each golden stick, the value is 3.\u003cbr\u003e\u003cbr\u003e\n Pudge wants to know the total value of the hook after performing the operations.\u003cbr\u003e\n You may consider the original hook is made up of cupreous sticks.\u003cbr\u003e\n\u003c/div\u003e"}},{"title":"Input","value":{"format":"HTML","content":"The input consists of several test cases. The first line of the input is the number of the cases. There are no more than 10 cases.\u003cbr\u003e\nFor each case, the first line contains an integer N, 1\u0026lt;\u003dN\u0026lt;\u003d100,000, which is the number of the sticks of Pudge’s meat hook and the second line contains an integer Q, 0\u0026lt;\u003dQ\u0026lt;\u003d100,000, which is the number of the operations.\u003cbr\u003e\nNext Q lines, each line contains three integers X, Y, 1\u0026lt;\u003dX\u0026lt;\u003dY\u0026lt;\u003dN, Z, 1\u0026lt;\u003dZ\u0026lt;\u003d3, which defines an operation: change the sticks numbered from X to Y into the metal kind Z, where Z\u003d1 represents the cupreous kind, Z\u003d2 represents the silver kind and Z\u003d3 represents the golden kind.\u003cbr\u003e"}},{"title":"Output","value":{"format":"HTML","content":"For each case, print a number in a line representing the total value of the hook after the operations. Use the format in the example.\u003cbr\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\u003e\u003cpre\u003e1\r\n10\r\n2\r\n1 5 2\r\n5 9 3\r\n\u003c/pre\u003e\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003e\u003cpre\u003eCase 1: The total value of the hook is 24.\r\n\u003c/pre\u003e\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n"}}]}