#include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define ll long long
const int maxn=1e5+10;
const int mod=1e9+7;
ll a[maxn];



int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    int t;
    cin>>t;
    while(t--)
    {
        int n;
        cin>>n;
        for(int i=1;i<=n;i++)
        {
            cin>>a[i];
        }
        sort(a+1,a+1+n);
        ll ans=0;
        ll sum=0;
        for(int i=2;i<=n;i++)
        {
            sum+=a[n]-a[i];
        }
        if(a[1]<=sum)
        {
            ans=sum-a[1];
        }
        else
        {
            ll temp=a[1]-sum;
            temp%=n-1;
            if(temp!=0)
            ans=n-1-temp;
        }
        cout<<ans<<'\n';
    }



}
