{"trustable":true,"sections":[{"title":"","value":{"format":"MD","content":"If you think codes, eat codes then sometimes you may get stressed. In your dreams you may see huge codes, as I have seen once. Here is the code I saw in my dream.\n\n\u003cdiv class\u003d\"haveborder\"\u003e\n\n```cpp\n#include \u003cstdio.h\u003e\n\nint cases, caseno;\nint n, K, MOD;\nint A[1001];\n\nint main() {\n scanf(\"%d\", \u0026cases);\n while( cases-- ) {\n scanf(\"%d %d %d\", \u0026n, \u0026K, \u0026MOD);\n int i, i1, i2, i3, ... , iK;\n for( i \u003d 0; i \u003c n; i++ ) scanf(\"%d\", \u0026A[i]);\n\n int res \u003d 0;\n for( i1 \u003d 0; i1 \u003c n; i1++ ) {\n for( i2 \u003d 0; i2 \u003c n; i2++ ) {\n for( i3 \u003d 0; i3 \u003c n; i3++ ) {\n ...\n for( iK \u003d 0; iK \u003c n; iK++ ) {\n res \u003d ( res + A[i1] + A[i2] + ... + A[iK] ) % MOD;\n }\n ...\n }\n }\n }\n printf(\"Case %d: %d\\n\", ++caseno, res);\n }\n return 0;\n}\n```\n\u003c/div\u003e\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\n\nActually the code was about: \u0027You are given three integers **n**, **K**, **MOD** and **n** integers: **A\u003csub\u003e0\u003c/sub\u003e, A\u003csub\u003e1\u003c/sub\u003e, A\u003csub\u003e2\u003c/sub\u003e ... A\u003csub\u003en-1\u003c/sub\u003e**, you have to write **K** nested loops and calculate the summation of all **A\u003csub\u003ei\u003c/sub\u003e** where **i** is the value of any nested loop variable.\u0027"}},{"title":"Input","value":{"format":"MD","content":"Input starts with an integer **T (\u0026#8804; 100)**, denoting the number of test cases.\n\nEach case starts with three integers: **n (1 \u0026#8804; n \u0026#8804; 1000), K (1 \u0026#8804; K \u0026lt; 2\u003csup\u003e31\u003c/sup\u003e), MOD (1 \u0026#8804; MOD \u0026#8804; 35000)**. The next line contains **n** non-negative integers denoting **A\u003csub\u003e0\u003c/sub\u003e, A\u003csub\u003e1\u003c/sub\u003e, A\u003csub\u003e2\u003c/sub\u003e ... A\u003csub\u003en-1\u003c/sub\u003e**. Each of these integers will be fit into a 32 bit signed integer."}},{"title":"Output","value":{"format":"MD","content":"For each case, print the case number and result of the code."}},{"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\u003e2\n3 1 35000\n1 2 3\n2 3 35000\n1 2\n\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003eCase 1: 6\nCase 2: 36\n\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n"}}]}