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 suma = 0; int sumb = 0; int cnt = 0; for (int i = 1; i < n; i++) { String[] sa = br.readLine().split(" "); int a = Integer.parseInt(sa[0]); int b = Integer.parseInt(sa[1]); if (a > 0 || b > 0) { cnt++; } suma += a; sumb += b; } br.close(); if (cnt <= 1) { System.out.println(1); } else { System.out.println(Math.max(suma, sumb) - Math.abs(suma - sumb) + 1); } } }