#include using namespace std; using ll=long long; #pragma GCC target ("avx") #pragma GCC optimize("O3") #pragma GCC optimize("unroll-loops") //#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native") #define rep(i,a,b) for(it i=(it)(a);i<=(it)b;i++) #define irep(i,a,b) for(int i=(int)(a);i<=(int)b;i++) #define nrep(i,a,b) for(it i=(it)(a);i>=(it)b;i--) #define inrep(i,a,b) for(int i=(int)(a);i>=(int)b;i--) #define all(v) v.begin(), v.end() #define rall(v) v.rbegin(), v.rend() #define moda 998244353LL #define modb 1000000007LL #define modc 968244353LL #define dai 2500000000000000000LL #define sho -dai #define aoi 1e+18 #define tyu 2500000000 #define giri 1000000000 #define en 3.14159265358979 #define eps 1e-14 #define endl '\n' #define yn(x) cout<<(x?"Yes\n":"No\n"); #define YN(x) cout<<(x?"YES\n":"NO\n"); #define ci(x) cin>>x; #define fi(x) cout<; using ip=pair; using vi=vector; using ivi=vector; using vd=vector; using vs=vector; using vc=vector; using vb=vector; using vp=vector

; using ivp=vector; using sp=set

; using isp=set; using ss=set; using sca=set; using si=set; using isi=set; using svi=set; using vvi=vector; using ivvi=vector; using vvd=vector; using vvs=vector; using vvb=vector; using vvc=vector; using vvp=vector; using ivvp=vector; using vsi=vector; using ivsi=vector; using vsp=vector; using ivsp=vector; using vvsi=vector; using ivvsi=vector; using vvsp=vector; using ivvsp=vector; using vvvi=vector; using ivvvi=vector; using vvvd=vector; using vvvb=vector; using ivvvp=vector; using vvvvi=vector; using ivvvvi=vector; using vvvvd=vector; const it dx[4]={0,1,0,-1}; const it dy[4]={1,0,-1,0}; st abc="abcdefghijklmnopqrstuvwxyz"; st ABC="ABCDEFGHIJKLMNOPQRSTUVWXYZ"; st num="0123456789"; st mb="xo"; st MB="XO"; #include using namespace atcoder; using mints=modint998244353; using mint=modint; using minto=modint1000000007; using vm=vector; using vms=vector; using vmo=vector; using vvm=vector; using vvms=vector; using vvmo=vector; using vvvm=vector; using vvvms=vector; using vvvmo=vector; using vvvvm=vector; using vvvvms=vector; using vvvvmo=vector; using vvvvvm=vector; using vvvvvms=vector; using vvvvvmo=vector; using vvvvvvm=vector; using vvvvvvms=vector; using vvvvvvmo=vector; template void scan(vector &a){ rep(i,0,a.size()-1)cin>>a[i]; } template void scan(vector &a,vector&b){ rep(i,0,a.size()-1)cin>>a[i]>>b[i]; } template void scan(vector> &a){ rep(i,0,a.size()-1)cin>>a[i].first>>a[i].second; } template void dec(vector &a){ rep(i,0,a.size()-1)a[i]--; } it gcda(it a,it b){ if(!a||!b){ return max(a,b); } while(a%b&&b%a){ if(a>b)a%=b; else b%=a; } return min(a,b); } it lcma(it a,it b){ return a/gcda(a,b)*b; } const it MOD=modb; vi fact,fact_inv,inv; /* init_nCk :二項係数のための前処理 計算量:O(n) */ void init_nCk(int SIZE){ fact.resize(SIZE+5); fact_inv.resize(SIZE+5); inv.resize(SIZE+5); fact[0]=fact[1]=1; fact_inv[0]=fact_inv[1]=1; inv[1]=1; rep(i,2,SIZE+4){ fact[i]=fact[i-1]*i%MOD; inv[i]=MOD-inv[MOD%i]*(MOD/i)%MOD; fact_inv[i]=fact_inv[i-1]*inv[i]%MOD; } } /* nCk :MODでの二項係数を求める(前処理 int_nCk が必要) 計算量:O(1) */ it nCk(int n, int k){ assert(!(n>n; vi a(n);scan(a); it sum=0,ans=0; for(it i:a)sum+=i; sort(all(a)); it e=sum%n; if(e<0)e+=n; irep(i,0,n-e-1)ans+=abs(a[i]-sum/n); irep(i,n-e,n-1)ans+=abs(a[i]-(sum/n+1)); cout<