func_code_string: #include <bits/stdc++.h>   #include <cmath>   #include <regex>   #define ff first   #define ss second   #define pb push_back   #define mp make_pair   #define ba back   #define ppb pop_back   #define eb emplace_back   #define eps 1e-6   #define vec vector<long long int>   #define sz(x) (int((x.size())))   #define all(x) (x).begin(),(x).end()   #define FAST ios_base :: sync_with_stdio (false); cin.tie (NULL)   #define ll long long   #define loop(i,s,n) for(int i=s;i<n;i++)   using namespace std;   //-----------------------------------------------------------------------------------------------------------------   const ll M = 1e9 + 7;   const ll N = 2e5 + 5;   const ll inf = 2e18;   ll mod(ll x){   return (x%M);}   ll mod_minus(ll a, ll b){ ll ans= (mod(a)-mod(b)); if(ans<0) ans=mod(ans+M); return ans;}       ll mod_mul(ll a,ll b){  return mod(mod(a)*mod(b));}       ll mod_add(ll a,ll b){ return mod(a+b);}       ll power(ll a,ll n){         if(n==0) return 1;         else if(n==1) return a;          ll R=power(a,n/2)%M;           if(n%2==0) {    return mod(mod_mul(R,R));  }                 else {   return mod(mod_mul(mod_mul(R,a),mod(R)));  }       }       ll mod_inv(ll n){  return power(n,M-2);}       // only if M is prime   ll mod_div(ll a,ll b){          ll ans=mod(a);   ll b1=power(b,M-2);           ans= mod(mod_mul(ans,b1));             return ans;           }       ll fact_mod(ll n){        vec fact(n+1);        fact[0]=1;           loop(i,1,n+1){               fact[i]=mod_mul(fact[i-1],i);              }                 return fact[n];       }       unsigned long long nCr_mod(unsigned long long n,  ll r)    {        if (r == 0)            return 1;        unsigned long long fac[n + 1];        fac[0] = 1;        for (int i = 1; i <= n; i++)            fac[i] = (fac[i - 1] * i) % M;             return (fac[n] * mod_inv(fac[r]) % M * mod_inv(fac[n - r]) % M) % M;    }    //--------------------------------------------------------------------------------------------------------------   void solve(){       ll n;       cin>>n;       ll a[n];       ll sum=0;       loop(i,0,n){           cin>>a[i];           sum+=a[i];       }       sort(a,a+n);       ll mx=a[n-1],mn=a[0];       ll z=(n-1)-sum%(n-1);       if(z==(n-1)){           z=0;       }       sum+=z;       if(mx<=sum/(n-1)){           cout<<z<<endl;           return;       }       cout<<mx*(n-1)-sum+z<<endl;   }      int main(){       FAST;       int t;       cin>>t;       while(t--){           solve();         }   }