text: #include <iostream>
  
  #define MOD 998244353
  
  using namespace std;
  
  int main(int argc, char const *argv[])
  {
      ios::sync_with_stdio(false);
      cin.tie(0);
      cout.tie(0);
  
      unsigned long long n, k;
      cin >> n >> k;
      unsigned long long ans = (n%MOD)*(n%MOD);
      ans %= MOD;
      ans *= k%MOD;
      ans%=MOD;
      ans-=(k-1)%MOD;
  
      ans %= MOD;
      cout << ans;
  
      return 0;
  }
  