MOD = 998244353 N,M = map(int,input().split()) def f1(x): return x * (x+1) // 2 def f2(x): return x * (x+1) * (2*x+1) // 6 ans = N*(N+1)*M i = M while (i): v = N // i j = N // (v+1) ans -= (2*N+2) * v * (f1(i) - f1(j)) ans += (v+1) * v * (f2(i) - f2(j)) ans %= MOD i = j print(ans * pow(2,MOD-2,MOD) % MOD)