using System; using System.Linq; using System.Collections.Generic; using System.IO; class MyClass { public static void Solve() { var N = int.Parse(Console.ReadLine()); var A = new int[N]; var B = new int[N]; for (int i = 1; i < N; i++) { var input = Console.ReadLine().Split().Select(int.Parse).ToArray(); A[i] = input[0]; B[i] = input[1]; } var sumA = A.Sum(); var sumB = B.Sum(); var diff = sumB - sumA; if (diff >= 0) { Console.WriteLine(sumB - diff + 1); } else { Console.WriteLine(sumA + diff + 1); } } public static void Main() { var sw = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false }; Console.SetOut(sw); Solve(); Console.Out.Flush(); } }