#include using namespace std; int main() { int n; cin >> n; int asum = 0; int bsum = 0; for (int i = 0; i < n-1; i++) { int c, d; cin >> c >> d; asum += c; bsum += d; } cout << min(bsum, asum) + 1 << endl; return 0; }