{"problem":{"name":"Colorful Star","description":{"content":"There is a tree with $NM+1$ vertices numbered $0$ to $NM$. The $i$\\-th edge ($1 \\le i \\le NM$) connects vertices $i$ and $\\max(i-N,0)$. Initially, vertex $i$ is colored with color $i \\bmod N$. You can","description_type":"Markdown"},"platform":"AtCoder","limit":{"time_limit":2000,"memory_limit":262144},"difficulty":"None","is_remote":true,"is_sync":true,"sync_url":null,"sign":"arc176_f"},"statements":[{"statement_type":"Markdown","content":"There is a tree with $NM+1$ vertices numbered $0$ to $NM$. The $i$\\-th edge ($1 \\le i \\le NM$) connects vertices $i$ and $\\max(i-N,0)$.\nInitially, vertex $i$ is colored with color $i \\bmod N$. You can perform the following operation zero or more times:\n\n*   Choose two vertices $u$ and $v$ connected by an edge. Repaint the color of vertex $u$ with that of vertex $v$.\n\nFind the number, modulo $998244353$, of possible trees after the operations. Two trees are distinguished if and only if some vertex has different colors.\n\n## Constraints\n\n*   $1 \\le N, M \\le 2 \\times 10^5$\n\n## Input\n\nThe input is given from Standard Input in the following format:\n\n$N$ $M$\n\n[samples]","is_translate":false,"language":"English"}],"meta":{"iden":"arc176_f","tags":[],"sample_group":[["3 1","42\n\nOne possible sequence of operations is as follows. Including this one, there are $42$ possible final trees.\n![image](https://img.atcoder.jp/arc176/star.png)"],["4 2","219100"],["20 24","984288778"],["123456 112233","764098676"]],"created_at":"2026-03-03 11:01:13"}}