{"raw_statement":[{"iden":"problem statement","content":"You are given integers $N$ and $X$. Assume that an integer sequence $A = (A_1, \\ldots, A_N)$ satisfies all of the conditions below.\n\n*   $A_1 = X$.\n*   For every $i$ ($1\\leq i\\leq N$), $A_i$ is a multiple of $i$.\n*   $A$ is strictly increasing. In other words, $A_1 < \\cdots < A_N$ holds.\n\nFind the minimum possible value of $\\sum_{i=1}^N A_i$, modulo $998244353$.\nThere are $T$ test cases, each of which should be solved."},{"iden":"constraints","content":"*   $1\\leq T\\leq 10$\n*   $1\\leq N \\leq 10^{18}$\n*   $1\\leq X \\leq 10^{18}$"},{"iden":"input","content":"Input is given from Standard Input from the following format:\n\n$T$\n$\\text{case}_1$\n$\\vdots$\n$\\text{case}_T$\n\nEach case is in the following format:\n\n$N$ $X$"},{"iden":"sample input 1","content":"5\n5 100\n1 10\n10 1\n1000000000000000000 1\n100 100"},{"iden":"sample output 1","content":"525\n10\n55\n75433847\n61074\n\nHere is a sequence $A$ that minimizes $\\sum_{i=1}^N A_i$ for each of the first three test cases.\n\n*   The first test case: $A = (100, 102, 105, 108, 110)$.\n*   The second test case: $A = (10)$.\n*   The third test case: $A = (1, 2, 3, 4, 5, 6, 7, 8, 9, 10)$."}],"translated_statement":null,"sample_group":[],"show_order":["default"],"formal_statement":null,"simple_statement":null,"has_page_source":true}