#include<iostream>
using namespace std;

int main() {
	int n; char p; int x, count = 0;
	cin >> n;
	for(int i=0; i<n; ++i) {
		cin >> p >> x;
		if(p=='(') count += x;
		else count -= x;
		if(count<0) break;
	}
	cout << (count == 0 ? "YES" : "NO") << endl;
	return 0;
}