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