#include #include using namespace std; using ll = long long; using namespace atcoder; using mint = modint998244353; int main(){ cin.tie(nullptr); ios_base::sync_with_stdio(false); ll M, N, p=0, X; mint Y, ans=0, iv=mint(6).inv(); cin >> M >> N; M++; for (int i=0; i> X; Y = X-p-1; ans += Y*(Y+1)*(Y*2+1)*iv; p = X; } Y = M-p-1; ans += Y*(Y+1)*(Y*2+1)*iv; cout << ans.val() << endl; return 0; }