#include<bits/stdc++.h>
#include<string>
#include <algorithm>
using namespace std;
const int N=2e5+10;
typedef   long long ll;

int n,k,q,m,h,w;
const ll mod=998244353;

int a[N];
int b[N];

map<int,map<int,int> > mpp;
map<int,int> mp;
set<int> se;
string s;
stack <int> st;
int X[]={0,0,1,-1};
int Y[]={-1,1,0,0};

void solve(){
    cin>>n;
    for(int i=1;i<=n;i++) cin>>a[i];
    for(int i=1;i<=n;i++) cin>>b[i];
    ll ans=0;
    for(int i=1;i<=n;i++){
        ans+=a[i]*b[i];
    }
    if(ans==0) cout<<"Yes";
    else cout<<"No";
}

int main()
{
    solve();
}








#include<bits/stdc++.h>
#include<iostream>
#include<set>
#include<map>
#include<iterator>
#define ll              long long
#define lli             long long int
#define pb              push_back
#define mp              make_pair
#define RIP(i,n)        for(int i=0; i<n; i++)
#define RIP1(i,n)       for(int i=n-1; i>=0; i--)
#define FOR(i,a,b)      for(int i=a;i<(b); i++)
#define FOR1(i,a,b)     for(int i=a; i>=(b); i--)
#define sc(a)           scanf("%lld",&a)
#define SC(a)           scanf("%d",&a)
#define cin(a)          cin >> a
#define cout(a)         cout << a
#define pi              acos(-1)
#define pr(a)           printf("%lld\n",a)
#define PR(a)           printf("%lld ",a)
#define s(a,b)          sort(a,b)
#define sz(x)           (int)(x).size()
#define nl              '\n'
#define Max             110
#define mod             1e9 + 7
using namespace std;
void c_p_c()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    /*#ifdef ONLINE_JUDGE
        freopen("input.txt","r",stdin);
        freopen("output.txt","w",stdout);
    #endif*/
}
int main()
{
    ll n;
    sc(n);
    ll a[n],b[n];
    RIP(i,n)
    {
        sc(a[i]);
    }
    RIP(i,n)
    {
        sc(b[i]);
    }
    ll ans=0;
    RIP(i,n)
    {
        ans+=(a[i]*b[i]);
    }
    if(ans)
    {
        cout << "No" << nl;
    }
    else
    {
        cout << "Yes" << nl;
    }
}
