#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;
typedef long long ll;
#define speed ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define mp make_pair
#define pb push_back
#define ff first
#define ss second
#define vi vector<int>
#define vll vector<ll> 
#define all(x) (x).begin() , (x).end()

void dbg(){
	cerr << endl;
}
template<typename Head , typename... Tail>
void dbg(Head h , Tail... t){
	cerr << h << " ";
	dbg(t...);
}

#ifdef EMBI_DEBUG
#define debug(...) cerr << "(" << #__VA_ARGS__  << "): ", dbg(__VA_ARGS__)
#else 
#define debug(...)
#endif

const int max_n = 1e5 + 9;
const int inf = 1e9;
const int mod = 1e9 + 7;

typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> indexed_set;
ll power(ll a , ll b)
{
    ll prod = 1;
    while(b)
    {
        if(b&1)
        prod = (prod*a)%mod;
        a = (a*a)%mod;
        b >>= 1;
    }
    return prod;
}
void solve(){
	int n;
    cin >> n;
    vll a(n);
    for(int i = 0 ; i < n ; i++) {
        cin >> a[i];
    } 

    ll sum = 1;
    ll dp[n][n+1];
    memset(dp , 0 , sizeof(dp));
    for(int i = 0 ; i < n ; i++) {
        dp[i][1] = 1;
    }

    for(int j = 2 ; j <= n ; j++) {
        int b[n] , dp1[n];
        memset(dp1, 0 , sizeof(dp1));
        for(int i = 0 ; i < n ; i++) {
            b[i] = a[i] % j;
        }
        int curr_rem = 0;
        for(int i = 0 ; i < n ; i++) {
            curr_rem += b[i];
            curr_rem %= j;
            dp[i][j] = dp1[curr_rem];
            dp1[curr_rem] += dp[i][j-1];
            dp1[curr_rem] %= mod;
        }
        sum += dp[n-1][j];
        sum %= mod;
    }

    cout << sum << "\n";
}
signed main(){
	int t = 1;
	// cin >> t;
	for(int i = 1 ; i <= t ; i++){
		solve();
	}
}
// Never gonna give you up
// Never gonna let you down
// Never gonna run around and desert you
#include <bits/stdc++.h>
#pragma GCC optimize("unroll-loops,no-stack-protector")
#pragma GCC target("sse,sse2,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#define watch(x) cout <<(#x)<<" is "<<(x)<<endl
#define debug cout <<"hi"<<endl
#define fi first
#define se second
#define pf push_front
#define pb push_back
#define sz(a) a.size()
#define all(a) a.begin(),a.end()
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

void solve(){
    int n; cin >>n;
    int a[n],sum=0; for(auto &i:a) cin >>i;
    for(int i=0; i<n; i++){
        int b; cin >>b;
        sum+=a[i]*b;
    }
    cout <<(!sum?"Yes":"No");
}

int main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
    // int T; cin >>T; while(T--)
    solve(); return 0;
}