#include <bits/stdc++.h>

using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
#define N 2114514
const ll mod = 998244353;
const ll inf = 1000000000000000000;
ll a[N],b[N];
int main() {
    ll n;
    cin >> n;
    ll sum = 0;
    for(int i=0;i<n;i++)cin>>a[i];
    for(int i=0;i<n;i++)cin>>b[i];
    for(int i=0;i<n;i++)sum+=a[i]*b[i];
    if (sum)
        cout << "No";
    else
        cout << "Yes";
    return 0;
}

#include <bits/stdc++.h>
using namespace std;

#define pb          push_back
#define ll         long long
// #define ll			unsigned long long
#define mp          make_pair
#define pi         pair<int,int>
#define vi          vector<int>
#define vc 			vector<char>
#define vs 			vector<string>
#define vl			vector<ll>
#define vb			vector<bool>
#define vu			vectorll>
#define vpi         vector<pi>
#define ve(a)		vector<a>
#define mi          map<int,int>
#define all(a)      (a).begin(),(a).end()
#define fr(i, a, b)	for(int i = a; i < b; i++)
#define rf(i, a, b)	for(int i = a; i >= b; i--)
#define M 1000000007
#define faster ios::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define mem(a)      memset(a, 0, sizeof(a))
#define gcd(a,b)    __gcd((a),(b))
#define lcm(a,b)   ((a)*(b)) / __gcd((a),(b))
#define exists(v, e) binary_search(v.begin(), v.end(), e)
#define index(v, e) (int)(find(v.begin(), v.end(), e) - v.begin())
#define lw(v, e) lower_bound(v.begin(), v.end(), e) - v.begin()
#define up(v, e) upper_bound(v.begin(), v.end(), e) - v.begin()
#define maxh(a) priority_queue<a> 
#define minh(a) priority_queue<a, vector<a>, greater<a>>
#define fi first
#define se second
#define nob(a) __builtin_popcount(a)

ll i, j, k, l, m, n, o, p, q, x, y, z, res, ans;
string s, r, str, s1, s2, s3, s4;
char c, c1, c2, c3, c4;

void solve(){
	cin >> n;
	ans = 0;
	vi a, b;
	fr(i, 0, n){
		cin >> x;
		a.pb(x);
	}
	fr(i, 0, n){
		cin >> x;
		b.pb(x);
	}
	fr(i, 0, n){
		ans += a[i] * b[i];
	}
	if(ans == 0){
		cout << "Yes\n";
		return;
	}
	cout << "No\n";
}

int main(){
	faster;
	#ifndef ONLINE_JUDGE 
		freopen("input.txt", "r", stdin); 
		freopen("error.txt", "w", stderr); 
		freopen("output.txt", "w", stdout); 
	#endif 
	solve();
	return 0;
}