{"problem":{"name":"Product","description":{"content":"We have $N$ bags.   Bag $i$ contains $L_i$ balls. The $j$\\-th ball $(1\\leq j\\leq L_i)$ in Bag $i$ has a positive integer $a_{i,j}$ written on it. We will pick out one ball from each bag.   How many wa","description_type":"Markdown"},"platform":"AtCoder","limit":{"time_limit":2000,"memory_limit":262144},"difficulty":"None","is_remote":true,"is_sync":true,"sync_url":null,"sign":"abc233_c"},"statements":[{"statement_type":"Markdown","content":"We have $N$ bags.  \nBag $i$ contains $L_i$ balls. The $j$\\-th ball $(1\\leq j\\leq L_i)$ in Bag $i$ has a positive integer $a_{i,j}$ written on it.\nWe will pick out one ball from each bag.  \nHow many ways are there to pick the balls so that the product of the numbers written on the picked balls is $X$?\nHere, we distinguish all balls, even with the same numbers written on them.\n\n## Constraints\n\n*   $N \\geq 2$\n*   $L_i \\geq 2$\n*   The product of the numbers of balls in the bags is at most $10^5$: $\\displaystyle\\prod_{i=1}^{N}L_i \\leq 10^5$.\n*   $1 \\leq a_{i,j} \\leq 10^9$\n*   $1 \\leq X \\leq 10^{18}$\n*   All values in input are integers.\n\n## Input\n\nInput is given from Standard Input in the following format:\n\n$N$ $X$\n$L_1$ $a_{1,1}$ $a_{1,2}$ $\\ldots$ $a_{1,L_1}$\n$L_2$ $a_{2,1}$ $a_{2,2}$ $\\ldots$ $a_{2,L_2}$\n$\\vdots$\n$L_N$ $a_{N,1}$ $a_{N,2}$ $\\ldots$ $a_{N,L_N}$\n\n[samples]","is_translate":false,"language":"English"}],"meta":{"iden":"abc233_c","tags":[],"sample_group":[["2 40\n3 1 8 4\n2 10 5","2\n\nWhen choosing the $3$\\-rd ball in Bag $1$ and $1$\\-st ball in Bag $2$, we have $a_{1,3} \\times a_{2,1} = 4 \\times 10 = 40$.  \nWhen choosing the $2$\\-nd ball in Bag $1$ and $2$\\-nd ball in Bag $2$, we have $a_{1,2} \\times a_{2,2} = 8 \\times 5 = 40$.  \nThere are no other ways to make the product $40$, so the answer is $2$."],["3 200\n3 10 10 10\n3 10 10 10\n5 2 2 2 2 2","45\n\nNote that we distinguish all balls, even with the same numbers written on them."],["3 1000000000000000000\n2 1000000000 1000000000\n2 1000000000 1000000000\n2 1000000000 1000000000","0\n\nThere may be no way to make the product $X$."]],"created_at":"2026-03-03 11:01:14"}}