/*  *Which of the favors of your Lord will you deny ?*  */
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ull unsigned long long
#define vpnt(ans)                       \
    for (ll i = 0; i < ans.size(); i++) \
        cout << ans[i] << (i + 1 < ans.size() ? ' ' : '\n');
#define setbit(x, k) (x |= (1LL << k))
#define clearbit(x, k) (x &= ~(1LL << k)) //x er last theke k-1 tomo ghor
#define checkbit(x, k) (x & (1LL << k))
#define mp make_pair
#define scl(x) scanf("%lld", &x)
#define sci(x) scanf("%d", &x)
#define pb push_back
#define pf push_front
#define ppb pop_back
#define ppf pop_front
#define ff first
#define ss second
#define pii pair<int, int>
#define YES printf("YES\n")
#define Yes printf("Yes\n")
#define yes printf("yes\n")
#define NO printf("NO\n")
#define No printf("No\n")
#define no printf("no\n")
#define nn cout << "\n";
#define INF (1 << 30)
#define LL_INF (1LL << 32)
#define pll pair<ll, ll>
#define pp(n, p) (ll)(pow(n, p) + 0.5)
#define ok ios::sync_with_stdio(false);
#define fine cin.tie(nullptr);
#define mod 1000000007
#define N 100005

int main()
{
    ll n;
    cin>>n;
    vector<int>a, b;
    for(int i=0; i<n; i++)
    {
        ll x;
        cin>>x;
        a.pb(x);
    }
    ll res = 0;
    for(int i=0; i<n; i++)
    {
        ll x;
        cin>>x;
        res += x*a[i];
    }
    if(res == 0) Yes;
    else No;

}
#include <bits/stdc++.h>
using namespace std;
#define all(x) (x).begin(), (x).end()
#define pb push_back
#define int long long
typedef vector<int> vi;typedef vector<vi> vvi;

signed main(){
ios::sync_with_stdio(0);cin.tie(0);
#ifndef ONLINE_JUDGE
freopen("E:\\in.txt","r", stdin);
#endif
	int n; cin >> n;
	vi a(n), b(n);
	for(int i =0; i < n; i++){
		cin >> a[i];
	}
	for(int i =0; i < n; i++){
		cin >> b[i];
	}		
	int x =0 ;
	for(int i =0; i < n; i++){
		x += a[i] * b[i]; 
	}
	cout << (x ? "No":"Yes") << '\n';
}