{"problem":{"name":"Black and White Stones","description":{"content":"There is a regular $N$\\-gon with side length $D$. Starting from a vertex, we place black or white stones on the circumference at intervals of $1$. As a result, each edge of the $N$\\-gon will have $(D+","description_type":"Markdown"},"platform":"AtCoder","limit":{"time_limit":2000,"memory_limit":262144},"difficulty":"None","is_remote":true,"is_sync":true,"sync_url":null,"sign":"abc256_g"},"statements":[{"statement_type":"Markdown","content":"There is a regular $N$\\-gon with side length $D$.\nStarting from a vertex, we place black or white stones on the circumference at intervals of $1$. As a result, each edge of the $N$\\-gon will have $(D+1)$ stones on it, for a total of $ND$ stones.\nHow many ways are there to place stones so that all edges have the same number of white stones on them? Find the count modulo $998244353$.\n\n## Constraints\n\n*   $3 \\leq N \\leq 10^{12}$\n*   $1 \\leq D \\leq 10^4$\n*   All values in input are integers.\n\n## Input\n\nInput is given from Standard Input in the following format:\n\n$N$ $D$\n\n[samples]","is_translate":false,"language":"English"}],"meta":{"iden":"abc256_g","tags":[],"sample_group":[["3 2","10\n\nThere are $10$ ways, as follows:\n![image](https://img.atcoder.jp/abc256/ba2bebe9d374f281e2b44e36231abae2.png)"],["299792458 3141","138897974\n\nFind the count modulo $998244353$."]],"created_at":"2026-03-03 11:01:14"}}