#include<bits/stdc++.h>
using namespace std;
#define IO ios_base::sync_with_stdio(0), cin.tie(0),cout.tie(0)
typedef long long ll;
const int N = 1e5 + 4 , MOD = 1e9 + 7 ;
int n , a[N] , b[N] , ans ;
bool solve(int idx)
{
if(idx == n + 1)
return ans == 0 ;
ans += a[idx] * b[idx] ;
solve(idx + 1) ;
return ans == 0 ;
}
int main() {
IO ;
cin>>n ;
for(int i=1 ; i <= n ; i++)
cin>>a[i] ;
for(int i=1 ; i <= n ; i++)
cin>>b[i] ;
if(solve(1))
cout<<"Yes\n" ;
else
cout<<"No\n" ;
return 0;
}
I2luY2x1ZGU8Yml0cy9zdGRjKysuaD4KdXNpbmcgbmFtZXNwYWNlIHN0ZDsKI2RlZmluZSBJTyBpb3NfYmFzZTo6c3luY193aXRoX3N0ZGlvKDApLCBjaW4udGllKDApLGNvdXQudGllKDApCnR5cGVkZWYgbG9uZyBsb25nIGxsOwpjb25zdCBpbnQgTiA9IDFlNSArIDQgLCBNT0QgPSAxZTkgKyA3IDsKaW50IG4gLCBhW05dICwgYltOXSAsIGFucyA7CmJvb2wgc29sdmUoaW50IGlkeCkKewogICAgaWYoaWR4ID09IG4gKyAxKQogICAgICAgIHJldHVybiBhbnMgPT0gMCA7CiAgICBhbnMgKz0gYVtpZHhdICogYltpZHhdIDsKICAgIHNvbHZlKGlkeCArIDEpIDsKICAgIHJldHVybiBhbnMgPT0gMCA7Cn0KaW50IG1haW4oKSB7CiAgICBJTyA7CiAgICBjaW4+Pm4gOwogICAgZm9yKGludCBpPTEgOyBpIDw9IG4gOyBpKyspCiAgICAgICAgY2luPj5hW2ldIDsKICAgIGZvcihpbnQgaT0xIDsgaSA8PSBuIDsgaSsrKQogICAgICAgIGNpbj4+YltpXSA7CiAgICBpZihzb2x2ZSgxKSkKICAgICAgICBjb3V0PDwiWWVzXG4iIDsKICAgIGVsc2UKICAgICAgICBjb3V0PDwiTm9cbiIgOwogICAgcmV0dXJuIDA7Cn0=