#include<bits/stdc++.h>
using namespace std;
signed main()
{
  int n,sum=0;
  cin>>n;
  int arr1[n];
  int arr2[n];
  for(int i=0;i<n;i++)
  {
      cin>>arr1[i];
  }
  for(int i=0;i<n;i++)
  {
      cin>>arr2[i];
  }
  for(int i=0;i<n;i++)
  {
      sum+=arr1[i]*arr2[i];
  }
  if(sum==0)cout<<"Yes"<<endl;
  else cout<<"No"<<endl;
    
}
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <math.h>
#include <vector>
using namespace std;
using ll = long long;
using Graph = vector<vector<int> >;
#define INF 500010

int main(){
    int n, A[INF], B[INF], C[INF];
    cin>>n;
    for(int i=1;i<=n;i++) cin>>A[i];
    for(int i=1;i<=n;i++) cin>>B[i];
    for(int i=1;i<=n;i++) cin>>C[i];
    
    ll ac[INF], bc[INF];
    memset(ac, 0, sizeof(ac));
    memset(bc, 0, sizeof(bc));
    
    for(int i=1;i<=n;i++)
        ac[A[i]]++;
    for(int i=1;i<=n;i++)
        bc[B[C[i]]]++;
    ll s=0;
    for(int i=1;i<=n;i++){
        s+=ac[i]*bc[i];
    }
    cout<<s<<endl;
    return 0;
}