import sequtils,strutils,algorithm var n = stdin.readline.parseInt A,B : int64 f,g,f2,g2 : seq[int64] if n < 20: f = @[0.int64] for i in 0.. int: result = cmp(x.abs, y.abs) echo f[0].abs else: f = @[0.int64] for i in 1..16: f2 = @[] (A,B) = stdin.readline.split.map(parseBiggestInt) for j in f: f2.add(j - A) f2.add(j + B) f = f2 f.sort(system.cmp) g = @[0.int64] for i in 17..n: (A,B) = stdin.readline.split.map(parseBiggestInt) g2 = @[] for j in g: g2.add(j - A) g2.add(j + B) g = g2 g.sort(system.cmp) g.reverse var p = 0 ans = 5_000_000_001 for j in f: while p <= g.high: if abs(j + g[p]) < ans: ans = abs(j + g[p]) if p < g.high and abs(j + g[p + 1]) <= abs(j + g[p]): p += 1 else: break echo ans