#include <cstdio>
#include <iostream>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <climits>
#include <cfloat>
#include <functional>
using namespace std;

int main()
{
    int n;
    cin >> n;

    int a = 0;
    while(--n >= 0){
        char c;
        int x;
        cin >> c >> x;

        if(c == '('){
            a += x;
        }else{
            a -= x;
            if(a < 0){
                cout << "NO" << endl;
                return 0;
            }
        }
    }

    if(a == 0)
        cout << "YES" << endl;
    else
        cout << "NO" << endl;

    return 0;
}