func main() var n: int :: cui@inputInt() var ans: int :: -1 for(1, n) var x: int :: cui@inputInt() var y: int :: cui@inputInt() if(ans = -1) do ans :: y - x end if if(ans <= 0 | ans <> y - x) do cui@print("-1\n") ret end if end for do cui@print("\{ans}\n") end func