#include <iostream>
#include <vector>
#include <numeric>
#include <algorithm>
using namespace std;

int main()
{
  vector<int> v;
  vector<int> u;
  int N,a,b;
  cin>>N;
  for(int i=0;i<N;i++){
      cin>>a;
      v.push_back(a);
  }
  for(int q=0;q<N;q++){
      cin>>b;
      u.push_back(b);
  }
  int result = inner_product(
                v.begin(), v.end(), 
                u.begin(),          
                0.0f);              

  std::cout << (result==0?"Yes":"No") << std::endl;
}
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define rep(i,a)  for(ll i=0; i< a; i++)
#define rep1(i,a)   for(ll i = 1; i< a; i++)
#define foi(i, a, b)    for(ll i = a; i<b ; i++)
#define fod(i, a, b)    for(ll i = a; i>=b ; i--)
#define max3(a, b, c)   max(max(a, b), c)
#define min3(a, b, c)   min(min(a, b), c)
#define MAX 1000005
#define MOD 1000000007

ll findgcd(ll n,ll m){
    return __gcd(n,m);
}
ll findlcm(ll n,ll m){
    return (n*m)/findgcd(n,m);
}

ll nodig(ll n){
    int ans =0;
    while(n!=0){
        ans+=1;
        n=n/10;
    }
    return ans;
}


int main(){
    ios::sync_with_stdio(0);
    cin.tie(0);    
        ll n,temp=0,cnt=0,sum=0,ans=0;
        cin>>n;
        vector<ll> a(n),b(n);
        rep(i,n) cin>>a[i];
        rep(i,n) cin>>b[i];
        rep(i,n){
            sum+=(a[i]*b[i]);
        }
        if(sum==0) cout<<"Yes";
        else cout<<"No";
    
return 0;
}