#include #define rep(i,n) for(int i=0;i pp; const int INF = 1e9; const int MOD = 1000000007; int main() { int n; cin >> n; int ans = 1; rep(i,n-1){ int a,b; cin >> a >> b; ans += b; } cout << ans << endl; return 0; }