#include <iostream>
using namespace std;

int main(){
  int N;
  cin >> N;
  int a[N], b[N];
  for (int i = 0; i < N; i++) cin >> a[i];
  for (int i = 0; i < N; i++) cin >> b[i];
  long long ans;
  for (int i = 0; i < N; i++){
    ans += a[i] * b[i];
  }
  if (ans == 0)cout << "Yes";
  else cout << "No";
}
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define ff first
#define ss second

int main(){
   
    ll t,n,i;
    cin>>n;
    vector<ll>arr(n);
     set<ll>s;
    for(i=0;i<n;i++)
     {
         cin>>arr[i]; 
         s.insert(arr[i]);
     }
     while(s.size()>=2)
     {
         ll x=*s.begin();
         ll y=*s.rbegin();
        
         s.insert(y-x);
         s.erase(y);
         
     }
     cout<<*s.begin();
     
     
     
         
    return 0;
}
