#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #define REP(i,n) for(int i=0;i( \ ( std::ostringstream() << std::dec << x ) ).str() #define ALL(s) (s).begin(), (s).end() using namespace std; typedef long long unsigned int llu; typedef long long ll; int main (){ int n; while (cin >> n){ int score[100]; int* a = new int[n]; int* b = new int[n]; string ans; REP(i,100)score[i] = 0; int rest = 0; REP(i,n){ cin >> a[i]; } REP(i,n){ cin >> b[i]; } REP(i,n){ if(b[i] == 0)rest += a[i]; else{ score[i] += a[i]; } } sort(score,score+100); if(score[99] <= rest)ans = "YES"; else ans = "NO"; cout << ans << endl; } return 0; }