#include<iostream>
using namespace std;

int main(){
  int n;
  cin >> n;
  int sum = 0;
  bool f = true;

  for(int i=0;i<n;i++){
    char c;
    int x;
    cin >> c >> x;
    if(c=='(')sum += x;
    else sum -= x;
    if(sum<0)f = false;
  }

  if(sum!=0)f = false;

  cout << (f?"YES":"NO") << endl;
}