#include<bits/stdc++.h>

using namespace std;

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

  int check[2] = {0};
  int ans = 0;

  for(int i = 0;i < n;++i){
    char pa;
    int x;
    cin>>pa;
    cin>>x;

    if(pa == '('){
      check[0] += x;
    }
    else{
      check[1] += x;
      if(check[1] > check[0]){
        ans = 1;
      }
    }
  }
  if(check[1] != check[0]){
    ans = 1;
  }

  if(ans == 1){
    cout<<"NO"<<endl;
  }
  else{
    cout<<"YES"<<endl;
  }

  return 0;
}
