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

int main(){

  int n;
  int m;
  string s;
  long long int ans = 0;
  bool d = false;

  cin >> n;

  for(int i=0;i<n;i++){
    cin >> s >> m;

    if(s == "(") ans += m;
    if(s == ")") ans -=m;

    if(ans < 0) d = true;
  }

  if(ans == 0 && !d) cout << "YES" << endl;
  else cout << "NO" << endl;

}