#include<iostream>
#include<string>
using namespace std;

int main()
{
    int n, m, sum = 0;
    char c;

    cin >> n;

    bool judge = true;
    for( int i = 0; i < n; i++ )
    {
        cin >> c >> m;
        if( c == '(' )
            sum += m;
        else
            sum -= m;
        if( sum < 0 )
            judge = false;
    }

    if( judge == 1 && sum == 0 )
        cout << "YES" << endl;
    else
        cout << "NO" << endl;

    return 0;
}
