{"trustable":true,"sections":[{"title":"Description","value":{"format":"MD","content":"Given a sequence of numbers, you need to perform the following three operations:\n\n- Multiply each number in a certain range by $x$;\n- Add $x$ to each number in a certain range;\n- Calculate the sum of each number in a certain range."}},{"title":"Input","value":{"format":"MD","content":"The first line contains three integers $n,q,m$, representing the number of numbers in the sequence, the total number of operations, and the modulus.\n\nThe second line contains $n$ integers separated by spaces, where the $i$-th number represents the initial value of the $i$-th item in the sequence.\n\nThe next $q$ lines each contain several integers, representing an operation, as follows:\n\nOperation $1$: Format: `1 x y k` Meaning: Multiply each number in the range $[x,y]$ by $k$\n\nOperation $2$: Format: `2 x y k` Meaning: Add $k$ to each number in the range $[x,y]$\n\nOperation $3$: Format: `3 x y` Meaning: Output the sum of each number in the range $[x,y]$ modulo $m$"}},{"title":"Output","value":{"format":"MD","content":"Output several lines of integers, which are the results of all operations $3$."}},{"title":"Sample 1","value":{"format":"MD","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\u003e5 5 38\n1 5 4 2 3\n2 1 4 1\n3 2 5\n1 2 4 2\n2 3 5 5\n3 1 4\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003e17\n2\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e"}},{"title":"Hint","value":{"format":"MD","content":"【Data Limits】\n\nFor $30\\%$: $n \\le 8$, $q \\le 10$. \nFor $70\\%$: $n \\le 10^3 $, $q \\le 10^4$. \nFor $100\\%$: $1 \\le n \\le 10^5$, $1 \\le q \\le 10^5$.\n\nExcept for the sample, $m \u003d 571373$.\n\nSample explanation:\n\n ![](CDN_BASE_URL/130f1707907f8c289dc77816c21c4fb4?v\u003d1699454522) \n\nTherefore, the output should be $17$, $2$ ($40 \\bmod 38 \u003d 2$)."}}]}