def solve(): N = int(input()) A = list(map(int, input().split())) B = list(map(int, input().split())) if N==2: if sum(A)!=sum(B): return -1 return abs(A[0]-B[0]) if (sum(A)-sum(B))%(N-2)!=0 or sum(A)