#include using namespace std; #define rep(i,N) for(int (i)=0;(i) < (N); (i)++) #define all(V) V.begin(), V.end() using i64 = int_fast64_t; using P = pair; int main(){ int N; cin >> N; i64 out = 0; i64 a,b; rep(i,N-1){ cin >> a >> b; out += b; } cout << out + 1 << endl; }