#include using namespace std; using lint = long long; using ull = unsigned long long; int main() { lint N, M; cin >> N >> M; ull ret = ull(M) * ull(N); for (lint k = 1; k <= N;) { lint d = M / k; if (d == 0) break; lint kr = min(M / d, N); ull n = kr - k + 1; ret -= ull(d) * (n * ull(k + kr) / 2); k = kr + 1; } cout << ret % 998244353 << '\n'; }