{"trustable":false,"sections":[{"title":"Problem Statement","value":{"format":"MD","content":"\u003cp\u003e\nYou\u0027re given an array $A$ of $N$ positive integers. Find the number of subarrays for which the sum and the product of the elements are equal.\n\u003c/p\u003e"}},{"title":"Input","value":{"format":"MD","content":"The first line of input contains an integer $T$ denoting the number of test cases. $T$ test cases follow.\nThe first line of each test contains the integer $N$. The next line contains $N$ integers — the array $A$."}},{"title":"Output","value":{"format":"MD","content":"For each test case, output a single line with the answer for the instance."}},{"title":"Constraints","value":{"format":"MD","content":"\u003cul\u003e\n\u003cli\u003e$1 \\le T \\le 50$\u003c/li\u003e\n\u003cli\u003e$1 \\le n \\le 50$\u003c/li\u003e\n\u003cli\u003e$1 \\le A_i \\le 10^9$\u003c/li\u003e\n\u003cli\u003e$A_1 \\cdot A_2 \\cdots A_n \\le 10^9$\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"}},{"title":"Note","value":{"format":"MD","content":"\u003cb\u003eExample case $1$:\u003c/b\u003e There are $4$ such subarrays: $A[1..1], A[2..2], A[3..3], A[1..3]$. Consider $A[1..3]$, sum \u003d $1 + 3 + 2 \u003d 6$, product \u003d $1 \\cdot 3 \\cdot 2 \u003d 6$.\n\u003c/p\u003e"}}]}