#include <iostream>
#include <cstdio>
#include <algorithm>
#include <stack>
#include <cstring>
#define rap(i, a, b) for(int i = (a); i < (b); ++i)
using namespace std;
typedef long long ll;
const int maxn = 100005;

ll a[maxn];
int main() {
	int t; scanf("%d", &t);
	while (t--) {
		int n; scanf("%d", &n);
		ll sum = 0;
		rap(i, 1, n + 1) scanf("%lld", &a[i]), sum += a[i];
		sort(a + 1, a + 1 + n);
		ll Max = 0;
		for (int i = 1; i < n; ++i) {
			ll tmp = sum - a[i];
			ll last = tmp - a[n] * (n - 1) + a[i];
			ll res = 0;
			if (last < 0) res = -last;
			else if(last % (n - 1) != 0)
			res = (n - 1) - last % (n - 1);
			Max = max(Max, res);
		}
		{
			ll tmp = sum - a[n];
			ll last = tmp - a[n - 1] * (n - 1) + a[n];
			ll res = 0;
			if (last < 0) res = -last;
			else if (last % (n - 1) != 0)
				res = (n - 1) - last % (n - 1);
			Max = max(Max, res);
		}
		printf("%lld\n", Max);
	}
	return 0;
}
