#include #pragma GCC optimize("Ofast") #pragma GCC optimize("unroll-loops") using namespace std; using ll=long long; const int mod=998244353; const int rev=748683265; ll my_pow(ll a,int b){ ll res=1; while(b){ if(b&1) res=res*a%mod; a=a*a%mod; b>>=1; } return res; } int main(){ ios::sync_with_stdio(false); cin.tie(nullptr); int N,K; cin>>N>>K; cout<<((N+N+N+K+K)+my_pow(N-2,K)*my_pow(N,mod-K)%mod)*rev%mod<<"\n"; }