#include <cstdio>
#include <algorithm>
#include <iostream>
#include <map>
#include <numeric>
#include <set>
#include <sstream>
#include <string>
#include <string.h>
#include <vector>
#include <queue>
using namespace std;

int main() {
	int n, count = 0;
	cin >> n;
	bool flag = true;
	for (int i = 0; i < n; i++) {
		char c;
		int k;
		cin >> c;
		cin >> k;
		if (c == '(') {
			count += k;
		} else {
			count -= k;
		}

		if (count < 0)
			flag = false;
	}
	if (flag and count == 0)
		cout << "YES" << endl;
	else
		cout << "NO" << endl;
}