{"trustable":false,"sections":[{"title":"","value":{"format":"MD","content":"\u003cp\u003e\nAlex likes problems involving arrays. Unfortunately, the last one he tried to solve didn\u0027t quite get solved.\n\u003c/p\u003e\n\n\u003cp\u003e\nAlex has an array \u003cb\u003eA\u003c/b\u003e of \u003cb\u003eN\u003c/b\u003e positive numbers. He wants to find the number of subarrays for which the sum and product of elements are equal.\n\u003c/p\u003e\n\n\u003cp\u003e\nPlease help Alex find this number.\n\u003c/p\u003e\n\n\u003ch3\u003eInput\u003c/h3\u003e\nThe first line of input contains an integer \u003cb\u003eT\u003c/b\u003e denoting the number of test cases. \u003cb\u003eT\u003c/b\u003e test cases follow. The first line of each test contains the integer \u003cb\u003eN\u003c/b\u003e. The next line contains \u003cb\u003eN\u003c/b\u003e integers — \u003cb\u003eA\u003csub\u003e1\u003c/sub\u003e\u003c/b\u003e, \u003cb\u003eA\u003csub\u003e2\u003c/sub\u003e\u003c/b\u003e, ..., \u003cb\u003eA\u003csub\u003eN\u003c/sub\u003e\u003c/b\u003e — denoting the array.\n\n\u003ch3\u003eOutput\u003c/h3\u003e\nFor each test case, output a single line with the answer for the instance.\n\n\u003ch3\u003eConstraints\u003c/h3\u003e\n\u003cul\u003e\u003cli\u003e1 ≤ \u003cb\u003eT\u003c/b\u003e ≤ 50\u003c/li\u003e\n\u003cli\u003e1 ≤ \u003cb\u003en\u003c/b\u003e ≤ 50\u003c/li\u003e\n\u003cli\u003e1 ≤ \u003cb\u003eA\u003csub\u003ei\u003c/sub\u003e\u003c/b\u003e ≤ 10\u003csup\u003e9\u003csup\u003e\u003c/sup\u003e\u003c/sup\u003e\u003c/li\u003e\n\u003cli\u003e\u003cb\u003eA\u003csub\u003e1\u003c/sub\u003e\u003c/b\u003e * \u003cb\u003eA\u003csub\u003e2\u003c/sub\u003e\u003c/b\u003e * ... * \u003cb\u003eA\u003csub\u003en\u003c/sub\u003e\u003c/b\u003e ≤ 10\u003csup\u003e9\u003csup\u003e\u003c/sup\u003e\u003c/sup\u003e\u003c/li\u003e\n\u003c/ul\u003e"}},{"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\u003e3\n3\n1 3 2\n4\n4 1 2 1\n6\n1 2 2 2 2 1\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003e4\n5\n9\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n\u003cp\u003e\n\u003cb\u003eExample case 1.\u003c/b\u003e There are 4 such subarrays: \u003cb\u003eA\u003c/b\u003e[1..1], \u003cb\u003eA\u003c/b\u003e[2..2], \u003cb\u003eA\u003c/b\u003e[3..3], \u003cb\u003eA\u003c/b\u003e[1..3]. Consider \u003cb\u003eA\u003c/b\u003e[1..3], sum \u003d 1 + 3 + 2 \u003d 6, product \u003d 1 * 3 * 2 \u003d 6.\n\u003c/p\u003e"}}]}