import java.io.BufferedReader; import java.io.InputStreamReader; public class Main { public static void main(String[] args) throws Exception { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); int n = Integer.parseInt(br.readLine()); int a = 0; int b = 0; for (int i = 1; i < n; i++) { String[] sa = br.readLine().split(" "); a += Integer.parseInt(sa[0]); b += Integer.parseInt(sa[1]); } br.close(); System.out.println(Math.max(a, b) - Math.abs(a - b) + 1); } }