#include using namespace std; #include using mint = atcoder::modint998244353; int main() { long long N, M; cin >> N >> M; mint ret = mint(M) * mint(N); for (long long k = 1; k <= N;) { long long d = M / k; if (d == 0) break; long long kr = min(M / d, N); long long n = kr - k + 1; ret -= mint(d) * n * (k + kr) / 2; k = kr + 1; } cout << ret.val() << '\n'; }