#include <stdio.h>

int main()
{
    char c[2]; int n, d, v = 0; bool ok = true;
    
    scanf("%d", &n);
    
    for(int i = 0; i < n; i++)
    {
        scanf("%s%d", c, &d);
        
        v += (c[0] == '(' ? 1 : -1) * d;
        
        if(v < 0) { ok = false; }
    }
    
    printf("%s\n", v == 0 && ok ? "YES" : "NO");
    
    return 0;
}