#include <bits/stdc++.h>
using namespace std;

int main(){

    string s;
    int n; cin >> n;
    int d = 0;
    bool flag = true;
    for(int i = 0; i < n; i++){
        char c; cin >> c;
        int p; cin >> p;
        if(flag == false) continue;
        
        if(c == '(') d += p;
        else d -= p;

        if(d < 0){
            flag = false;
            continue;
        }
    }

    
    if(d != 0) flag = false;
    
    if(flag) cout << "YES" << endl;
    else cout << "NO" << endl;

    //cout << s << endl;
    
    return 0;
}
