def isqrt(n): if n == 0: return 0 x = 1 << (n.bit_length() + 1) // 2 y = (x + n // x) // 2 while y < x: x = y y = (x + n // x) // 2 return x import sys input = sys.stdin.readline MOD = 998244353 N, M = map(int, input().split()) dp = N*M%MOD if N<=isqrt(M) or N<=10**6: for i in range(1, N+1): cnt = M//i dp -= i*cnt%MOD dp %= MOD print(dp) else: dp = N*M%MOD tmp = [] for i in range(1, isqrt(M)+1): cnt = M//i tmp.append(cnt) dp -= i*cnt%MOD dp %= MOD #print(tmp) for i in range(len(tmp)-1): cnt = min(tmp[i], N)-tmp[i+1] st = tmp[i+1]+1 if cnt>0: dp -= (i+1)*((st+st+cnt-1)*cnt//2)%MOD dp %= MOD cnt = tmp[-1]-len(tmp) st = len(tmp)+1 if cnt>0: dp -= len(tmp)*((st+st+cnt-1)*cnt//2)%MOD dp %= MOD print(dp)