#include #include using namespace atcoder; using namespace std; using ll = long long; using mint = modint998244353; vector> EnumFloor(ll n) { vector> ret; ll l = 1; while(l <= n) { ll q = n / l, r = n / q; ret.push_back({l, r, q}); l = r + 1; } return ret; } int main() { ios::sync_with_stdio(false); cin.tie(nullptr); ll N, M; cin >> N >> M; const mint inv = mint(2).inv(); mint ans = mint(N) * M; for(auto &[l, r, q] : EnumFloor(M)) { bool fin = false; if(N <= r) { r = N; fin = true; } ans -= mint(l + r) * (r - l + 1) * inv * q; if(fin) { break; } } cout << ans.val() << "\n"; }