#P9223. Summing XOR Pairs
Summing XOR Pairs
Summing XOR Pairs
Given two positive integers \(n\) and \(m\), compute the following sum:
\[ S = \sum_{i=1}^{n}\sum_{j=1}^{m}\left(i\oplus j\right) \mod 998244353, \]
where \(\oplus\) denotes the bitwise XOR operation (the same as the '^' operator in C++).
inputFormat
The input consists of a single line that contains two positive integers \(n\) and \(m\) separated by a space.
\(1 \leq n, m \leq 10^{9}\)
outputFormat
Output a single integer, the sum \(S\) modulo \(998244353\).
sample
1 1
0