#include<iostream>
#include<algorithm>
using namespace std;
int main(){

    string s;
    int n;
    cin>>n;
    int cnt = 0;
    bool flg = true;
    while(n--){
        char p;
        int x;
        cin>>p>>x;
        if(p == '(')cnt += x;
        else cnt -= x;
        if(cnt < 0){flg = false;break;}
    }
    if(flg&!cnt)cout<<"YES"<<endl;
    else cout<<"NO"<<endl;

}