def Inverse_Proportion(N): retu=[] for i in range(1,N+1): if i==N or N//i>N//(i+1): retu.append(((i,i+1),N//i)) else: for j in range(N//i,0,-1): retu.append(((N//(j+1)+1,N//j+1),j)) break return retu N,M=map(int,input().split()) mod=998244353 ans=N*M for (l,r),x in Inverse_Proportion(M): l=min(l,N+1) r=min(r,N+1) ans-=x*(l+r-1)*(r-l)//2 ans%=mod print(ans)