for _ in range(int(input())):
	n = int(input())
	f = list(map(int, input().split()))
	print((n - sum(f) + 1) % (n + 1))