//template by I_Love_Totoro, inspired by chamow
//interactive comments ahead! : for the love of CP <3
//init had forgotten that vec[i] can be > req, then mis-handling of excess vec[i]
#include <bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define X first
#define Y second
#define ALL(cont) cont.begin(), cont.end()
#define fastread ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
typedef long long ll;
typedef long double ld;
typedef long int li;
/*
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
gp_hash_table<int, int> table;
*/
 
using namespace std;
 
/*	hashTable faster than unmap, ref: https://codeforces.com/blog/entry/60737
 
const int RANDOM = chrono::high_resolution_clock::now().time_since_epoch().count();
struct chash {
    int operator()(int x) const { return x ^ RANDOM; }
};
gp_hash_table<key, int, chash> table;
 
*/
 
int main()
{
 
	fastread;
	/*
	freopen("input.txt","r",stdin);
    freopen("output.txt","w",stdout);
    */
 
    //cout << setprecision(10) << fixed <<
 
    /* make umap faster: 
    unordered_map<int,int>mp;
	mp.reserve(1024);
	mp.max_load_factor(0.25);
    */
	ll t, MX = 1e5 + 5;
	cin>>t;

	while (t--) {
		ll n, x, sum = 0, mx = -1, req = 0, per_unit = 0, extra = 0, mn = 1e12;
		vector<ll>vec, pre(MX), suff(MX);
		cin>>n;

		vec.pb(1e12);
		for (ll i = 0; i < n; i ++) {
			cin>>x;
			sum += x;
			vec.pb(x);
			/*mx = max(mx, x);
			mn = min(mn, x);*/
		}
		vec.pb(1e12);

		/*per_unit = sum/(n-1);
		if (per_unit < mx)
			extra = mx - t, req = extra * (n - 1);
		cout<<req<<'\n';*/

		pre[0] = 0, suff[n + 1] = 0;

		for (ll i = 1; i <= n; i ++)
			pre[i] = max(vec[i], pre[i - 1]);
		for (ll i = n; i >= 1; i --) 
			suff[i] = max(vec[i], suff[i + 1]);

		for (ll i = 1; i <= n; i ++) {
			ll mx_ht = max(pre[i - 1], suff[i + 1]);
			ll tot = mx_ht * (n - 1);
			tot -= (sum - vec[i]);

			
			if (vec[i] > tot && ((vec[i] - tot) % (n - 1) != 0))
				req = max(req, (n - 1) - ((vec[i] - tot) % (n - 1)));
			else
				req = max(tot - vec[i], req);
			//cout<<"at idx "<<i<<" req : "<<req<<"\n";
		
		}

		cout<<req<<'\n';
	}
    return 0;

}