import strutils, sequtils proc input: auto = stdin.readLine let N = input().parseInt var Z: int for i in 0 ..< N: var X, Y: int (X, Y) = input().split.map parseInt if Z == 0: Z = Y - X else: if Z != Y - X: Z = -1 break [Z, -1][int(Z <= 0)].echo