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

#define _CRT_SECURE_NO_WARNINGS
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;typedef long double ld;typedef vector <int> vi;typedef vector <ll> vll;typedef vector <string> vS;typedef vector <vector <int>> vv;typedef map<int, int> mi;typedef map<string, int> ms;typedef map<char, int> mc;typedef string S;typedef map <ll, ll> ml;typedef map <int, bool> mb;
#define FOR(i,N) for(int i = 0 ; i < N;i++)
#define eFOR(i,a,b) for(int i = a; i <=b;i++)
#define dFOR(i,N) for(int i = N - 1; i>=0;i--)
#define edFOR(i,a,b) for(int i = b ; i >=a;i--)
#define all(x) x.begin(),x.end()
#define SORT(x) sort(all(x))
#define RSORT(x) sort(x.rbegin(),x.rend())
#define mine(x) min_element(all(x))
#define maxe(x) max_element(all(x))
#define pb push_back
#define PI 3.14159265359
#define mod 1000000007
int CASE = 1;
void solve()
{
	int n;
	cin >> n;
	vi a(n), b(n);
	FOR(i, n)
		cin >> a[i];
	FOR(i, n)
		cin >> b[i];
	int cnt = 0;
	FOR(i, n)
		cnt += a[i] * b[i];
	cout << (cnt ? "No" : "Yes");
}
int main()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0); 
	int T = 1;
	while (T--)
	{
		solve();
	}
}