#include<bits/stdc++.h>
#define pb push_back
#define pf push_front
#define clr(x) memset(x, 0, sizeof(x))
#define all(a) a.begin(),a.end()
#define s second
#define f first
#define forn(i, a,b) for(int i = int(a); i < int(b); ++i)
#define forn_r(i, b, a) for(int i = int(b); i > int(a); i--)
#define trav(a,x) for (auto& a : x)
#define pA(array, length) for(int i = 0; i < length; i++) cout<< array[i] << (i == length - 1 ? '\n' : ' '); 
#define print(x) cout << x << '\n'
#define print2(x, y) cout << x << ' ' << y << '\n'
#define dbg(x) cout << #x << "=" << x << endl
#define dbg2(x, y) cout << #x << "=" << x << "," << #y << "=" << y << endl
template<class T> bool chmin(T& a, const T& b) { return b < a ? a = b, 1 : 0; }
template<class T> bool chmax(T& a, const T& b) { return a < b ? a = b, 1 : 0; }

using namespace std;
typedef long long ll; 
const int INF = INT_MAX;
const ll LNF  = LONG_LONG_MAX;
inline int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
inline ll  gcd(ll  a, ll  b) { return b ? gcd(b, a % b) : a; }
inline int lcm(int a, int b) { return a * b / gcd(a, b); }


 

void solve() {
	int n;
	cin>>n;
	ll a[n];
	forn(i,0,n)cin>>a[i];
	if(n==2){
		print(0);
	}
	else{
		sort(a,a+n);
		ll mi =a[0];
		ll ma =a[n-1];
		ll sum = accumulate(a,a+n,(ll)0);
		ll ori=sum;
		ll rem = (n-1) - sum%(n-1);
		if(sum/(n-1)< ma){
			sum=ma*(n-1);
		}
		// dbg(sum);
		if(sum%(n-1)!=0){
			sum=((sum/(n-1))+1)*(n-1);
			
		}
		sum=sum-ori;
		print(sum);
	}
	return;
}
 
int main() {
	ios::sync_with_stdio(0), cin.tie(0);
	int tst = 1;
	cin >> tst;
	while (tst--) {
		solve();
	}
}