#include <cstdio>
#include <iostream>
#include <algorithm>
using namespace std;
int n,k;
bool f;
int main(void){
  cin >> n;
  for(int i = 0; i < n; i++){
    char c;
    int m;
    cin >> c >> m;
    k += m * (c=='('?1:-1);
    if(k < 0) f = true;
  }
  if(f || k) cout << "NO" << endl;
  else cout << "YES" << endl;
}