#include <bits/stdc++.h> 
#include<cmath>
#include<string>
#define pb push_back
#define x first
#define y second
#define fast ios::sync_with_stdio(0),cin.tie(0),cout.tie(0)
#define all(x) x.begin(),x.end()
#define int long long
#define ll long long
using namespace std;
 
void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
//void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}
 
template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifndef ONLINE_JUDGE
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define debug(x...)
#endif
 
// look for  all edge cases
//search for a pattern

void solve(){
	int n;
	cin >> n;
	vector<int> v(n);
	int sum = 0;
	set<int> s;
	map<int,int> m;
	for(int i =0 ; i< n ;i++){
		cin >> v[i];
		sum += v[i];
		s.insert(v[i]);
		m[v[i]] += 1;
	}
	int ans = 0;
	for(int i =0 ; i <n ;i++){
		int val = sum - v[i];
		if(m[v[i]] == 1){
			s.erase(v[i]);
		}
		int ma = *s.rbegin();
		int req = ma * (n-1);
		int have= v[i];
		//debug(ma , have , req , val);
		if(have + val > req){
			if((have + val) % (n-1) != 0){
				int addi = (n - 1) - ((have + val) % (n-1));
				ans = max(addi , ans);
			}
		}
		ans = max(ans , req - have - val);
		s.insert(v[i]);
	}
	cout << ans << "\n";
	
	
}


signed main(){
	
	ios::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);	
	
	int t;
	cin >> t;
	while(t--){
		solve();
	}
	
	return 0;
	
}
