n = int(input()) a = list(map(int, input().split())) b = list(map(int, input().split())) if sum(a) < sum(b): print(-1) else: c = (sum(a) - sum(b)) // (n - 2) for i in range(n): if abs(a[i] - b[i]) // (n - 2) > c: c = -1 print(c)