#include #include #define llint long long using namespace std; int n; int a, b; int main(void) { ios::sync_with_stdio(0); cin.tie(0); cin >> n; int x, y; for(int i = 2; i <= n; i++){ cin >> x >> y; a += x, b += y; } if(n == 2){ cout << 1 << endl; return 0; } if(a <= b) cout << b - max(b-a, 0) + 1 << endl; else cout << a - max(a-b, 0) + 1 << endl; return 0; }