{"problem":{"name":"Nim","description":{"content":"You are given integers $N,A_1,A_2,A_3$. Find the number, modulo $998244353$, of triples of positive integers $(X_1,X_2,X_3)$ that satisfy all of the following three conditions. *   $1\\leq X_i \\leq N$","description_type":"Markdown"},"platform":"AtCoder","limit":{"time_limit":2000,"memory_limit":262144},"difficulty":"None","is_remote":true,"is_sync":true,"sync_url":null,"sign":"abc317_f"},"statements":[{"statement_type":"Markdown","content":"You are given integers $N,A_1,A_2,A_3$. Find the number, modulo $998244353$, of triples of positive integers $(X_1,X_2,X_3)$ that satisfy all of the following three conditions.\n\n*   $1\\leq X_i \\leq N$ for every $i$.\n*   $X_i$ is a multiple of $A_i$ for every $i$.\n*   $(X_1 \\oplus X_2) \\oplus X_3 = 0$, where $\\oplus$ denotes bitwise xor.\n\nWhat is bitwise xor? The bitwise xor of non-negative integers $A$ and $B$, $A \\oplus B$, is defined as follows.\n\n*   When $A \\oplus B$ is written in binary, the $2^k$s place ($k \\geq 0$) is $1$ if exactly one of the $2^k$s places of $A$ and $B$ is $1$, and $0$ otherwise.\n\nFor instance, $3 \\oplus 5 = 6$ (in binary: $011 \\oplus 101 = 110$).\n\n## Constraints\n\n*   $1 \\leq N \\leq 10^{18}$\n*   $1 \\leq A_i \\leq 10$\n*   All input values are integers.\n\n## Input\n\nThe Input is given from Standard Input in the following format:\n\n$N$ $A_1$ $A_2$ $A_3$\n\n[samples]","is_translate":false,"language":"English"}],"meta":{"iden":"abc317_f","tags":[],"sample_group":[["13 2 3 5","4\n\nFour triples $(X_1,X_2,X_3)$ satisfy the conditions: $(6,3,5),(6,12,10),(12,6,10),(12,9,5)$."],["1000000000000000000 1 1 1","426724011"],["31415926535897932 3 8 4","759934997"]],"created_at":"2026-03-03 11:01:14"}}