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


int main(){
	bool ok=true;
	int n,d=0;
	cin>>n;
	while(n--){
		char p;
		int x;
		cin>>p>>x;
		if(p=='('){
			d+=x;
		}else{
			d-=x;
			if(d<0)ok=false;
		}
	}
	if(ok&&!d)cout<<"YES"<<endl;
	else cout<<"NO"<<endl;
	return 0;
}