{"trustable":false,"sections":[{"title":"","value":{"format":"HTML","content":"\u003cscript type\u003d\u0027text/x-mathjax-config\u0027\u003eMathJax.Hub.Config({tex2jax: { inlineMath: [[\u0027$\u0027,\u0027$\u0027]] } }); \u003c/script\u003e\n\u003cscript type\u003d\u0027text/javascript\u0027 src\u003d\u0027https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.1/MathJax.js?config\u003dTeX-AMS-MML_HTMLorMML\u0027\u003e\u003c/script\u003e\n\u003cscript type\u003d\u0027text/javascript\u0027\u003esetTimeout(function(){MathJax.Hub.Queue([\u0027Typeset\u0027, MathJax.Hub, \u0027left_view\u0027]);}, 2000);\u003c/script\u003e\n\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. \n \u003cbr\u003e \n \u003cbr\u003eNow Pudge wants to do some operations on the hook. \n \u003cbr\u003e \n \u003cbr\u003eLet 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. \n \u003cbr\u003eThe 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: \n \u003cbr\u003e \n \u003cbr\u003eFor each cupreous stick, the value is 1. \n \u003cbr\u003eFor each silver stick, the value is 2. \n \u003cbr\u003eFor each golden stick, the value is 3. \n \u003cbr\u003e \n \u003cbr\u003ePudge wants to know the total value of the hook after performing the operations. \n \u003cbr\u003eYou may consider the original hook is made up of cupreous sticks. \n \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. \n\u003cbr\u003eFor 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. \n\u003cbr\u003eNext 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. \n\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. \n\u003cbr\u003e"}},{"title":"Sample Input","value":{"format":"HTML","content":"\u003cpre\u003e1\n10\n2\n1 5 2\n5 9 3\u003c/pre\u003e"}},{"title":"Sample Output","value":{"format":"HTML","content":"\u003cpre\u003eCase 1: The total value of the hook is 24.\u003c/pre\u003e"}}]}