#include<bits/stdc++.h>

using namespace std;

typedef long long ll;

int main() {
	ll t;
	cin>>t;
	while(t--) {
		ll n;
		cin>>n;
		ll a[n];
		ll sum = 0;
		for(ll i=0; i<n; i++) {
			cin>>a[i];
			sum += a[i];
		}
		ll ans = sum;
		sort(a,a+n);
		if(sum<a[n-1]*(n-1)) {
			sum = a[n-1]*(n-1);
		}
		while(sum%(n-1)!=0)
			sum++;
		cout<<sum-ans<<endl;
	}
	return 0;
}