{"problem":{"name":"LCM on Whiteboard","description":{"content":"There are $N$ integers $a_1,\\ldots,a_N$ written on a whiteboard.   Here, $a_i$ can be represented as $a_i = p_{i,1}^{e_{i,1}} \\times \\ldots \\times p_{i,m_i}^{e_{i,m_i}}$ using $m_i$ prime numbers $p_{","description_type":"Markdown"},"platform":"AtCoder","limit":{"time_limit":2000,"memory_limit":262144},"difficulty":"None","is_remote":true,"is_sync":true,"sync_url":null,"sign":"abc259_e"},"statements":[{"statement_type":"Markdown","content":"There are $N$ integers $a_1,\\ldots,a_N$ written on a whiteboard.  \nHere, $a_i$ can be represented as $a_i = p_{i,1}^{e_{i,1}} \\times \\ldots \\times p_{i,m_i}^{e_{i,m_i}}$ using $m_i$ prime numbers $p_{i,1} \\lt \\ldots \\lt p_{i,m_i}$ and positive integers $e_{i,1},\\ldots,e_{i,m_i}$.  \nYou will choose one of the $N$ integers to replace it with $1$.  \nFind the number of values that can be the least common multiple of the $N$ integers after the replacement.\n\n## Constraints\n\n*   $1 \\leq N \\leq 2 \\times 10^5$\n*   $1 \\leq m_i$\n*   $\\sum{m_i} \\leq 2 \\times 10^5$\n*   $2 \\leq p_{i,1} \\lt \\ldots \\lt p_{i,m_i} \\leq 10^9$\n*   $p_{i,j}$ is prime.\n*   $1 \\leq e_{i,j} \\leq 10^9$\n*   All values in input are integers.\n\n## Input\n\nInput is given from Standard Input in the following format:\n\n$N$\n$m_1$\n$p_{1,1}$ $e_{1,1}$\n$\\vdots$\n$p_{1,m_1}$ $e_{1,m_1}$\n$m_2$\n$p_{2,1}$ $e_{2,1}$\n$\\vdots$\n$p_{2,m_2}$ $e_{2,m_2}$\n$\\vdots$\n$m_N$\n$p_{N,1}$ $e_{N,1}$\n$\\vdots$\n$p_{N,m_N}$ $e_{N,m_N}$\n\n[samples]","is_translate":false,"language":"English"}],"meta":{"iden":"abc259_e","tags":[],"sample_group":[["4\n1\n7 2\n2\n2 2\n5 1\n1\n5 1\n2\n2 1\n7 1","3\n\nThe integers on the whiteboard are $a_1 =7^2=49, a_2=2^2 \\times 5^1 = 20, a_3 = 5^1 = 5, a_4=2^1 \\times 7^1 = 14$.  \nIf you replace $a_1$ with $1$, the integers on the whiteboard become $1,20,5,14$, whose least common multiple is $140$.  \nIf you replace $a_2$ with $1$, the integers on the whiteboard become $49,1,5,14$, whose least common multiple is $490$.  \nIf you replace $a_3$ with $1$, the integers on the whiteboard become $49,20,1,14$, whose least common multiple is $980$.  \nIf you replace $a_4$ with $1$, the integers on the whiteboard become $49,20,5,1$, whose least common multiple is $980$.  \nTherefore, the least common multiple of the $N$ integers after the replacement can be $140$, $490$, or $980$, so the answer is $3$."],["1\n1\n998244353 1000000000","1\n\nThere may be enormous integers on the whiteboard."]],"created_at":"2026-03-03 11:01:14"}}