#include <iostream>
using namespace std;

int solve(int n) {
	long long int count = 0;
	for (int i = 0; i < n; i++) {
		char p;
		int x;
		cin >> p >> x;

		if (p == '(') {
			count += x;
		}
		else {
			count -= x;
		}

		if (count < 0) {
			return 0;
		}
	}
	return count == 0;
}

int main() {
	int n;
	cin >> n;
	if (solve(n))
		cout << "YES" << endl;
	else
		cout << "NO" << endl;
	return 0;
}