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

#define ll long long
#define rep(i, n) for (ll i = 0; i < n; ++i)
#define rep_up(i, a, b) for (ll i = a; i < b; ++i)
#define rep_down(i, a, b) for (ll i = a; i > b; --i)
#define P pair<ll, ll>
#define Graph vector<vector<ll>>
#define fi first
#define se second
#define vvvll vector<vector<vector<ll>>>
#define vvll vector<vector<ll>>
#define vll vector<ll>

constexpr ll INF = (1ll << 60);
constexpr ll mod = 1000000007;
constexpr double pi = 3.14159265358979323846;
template <typename T>
inline bool chmax(T &a, T b) {
    if (a < b) {
        a = b;
        return 1;
    }
    return 0;
}
template <typename T>
inline bool chmin(T &a, T b) {
    if (a > b) {
        a = b;
        return 1;
    }
    return 0;
}
int gcd(int x, int y) { return (x % y)? gcd(y, x % y): y; }

int main(){
    ll n,a[100001],b[100001],sum=0;
    cin>>n;
    rep(i,n){
        cin>>a[i];
    }
    rep(i,n){
        cin>>b[i];
    }
    rep(i,n){
        sum+=a[i]*b[i];
    }
    if(sum==0){
        cout<<"Yes"<<endl;
    }else{
        cout<<"No"<<endl;
    }
}
#include <bits/stdc++.h>
using namespace std;
#define fast            ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define test            int t;cin>>t;while(t--)
#define REP(i,n)        for (int i = 1; i <= n; i++)
#define MOD             1000000007
#define MOD2            998244353
#define ll              long long
#define ld              long double
#define int             ll
#define pb              push_back
#define ii              pair<int,int>
#define vi              vector<int>
#define vii             vector<ii>
#define ff              first
#define ss              second
#define INF             1000000000
#define HINF            1000000000000000
#define mem(a,b)        memset(a,b,sizeof(a))
#define arrin(x,n)      int x[n]; for(int o=0;o<n;o++) cin>>x[o]
#define arrout(x,n)     for(int o=0;o<n;o++) cout<<x[o]<<" "; cout<<endl
#define vecin(x,n);     vi x;int hool; for(int o=0;o<n;o++) {cin>>hool; x.pb(hool);}
#define vecout(x,n)     for(int o=0;o<n;o++) cout<<x[o]<<" "; cout<<endl
#define all(x)          x.begin(),x.end()
#define deb(x)          cout<<#x<<'='<<x<<endl
#define deb2(x,y)       cout<<#x<<'='<<x<<" "<<#y<<'='<<y<<endl
#define deb3(x,y,z)     cout<<#x<<'='<<x<<" "<<#y<<'='<<y<<" "<<#z<<'='<<z<<endl
#define debarr(arr,n)   for(int o=0;o<n;o++) deb2(o,arr[o])
#define debarrall(arr)  debarr(arr,arr.size())
#define IO              freopen("input1.txt", "r", stdin); freopen("output1.txt", "w+", stdout)
const double pi = 3.14159265358979323846;

int powersimple(int a, int b){//a^b
    int res=1;
    while(b>0){
        if(b&1)
		{res=(res*a);
		b--;}
        a=(a*a);
        b>>=1;
    }
    return res;
}

int ncr(int n,int k)
{
	int ans=1;
	if(k>n-k)
	k=n-k;
	for(int i=1;i<=k;i++)
	ans*=(n-i+1),ans/=i;
	return ans;
}


int power(int x,int y,int p)
{
    int res = 1;
    x = x % p;
    while (y > 0) {
        if (y & 1)
            res = (res * x) % p;
        y = y >> 1;
        x = (x * x) % p;
    }
    return res;
}

int modInverse(int n, int p)
{
    return power(n, p - 2, p);
}

int ncrModPFermat(int n,int r, int p)
{

    if (r == 0)
		return 1;

    int fac[n + 1];
    fac[0] = 1;
    for (int i = 1; i <= n; i++)
        fac[i] = (fac[i - 1] * i) % p;

    return (fac[n] * modInverse(fac[r], p) % p * modInverse(fac[n - r], p) % p) % p;
}

int gcd(int a, int b){return (b==0)?a:gcd(b,a%b);}

///////////////END OF TEMPLATE//////////////////


void solve()
{

	int i,j,a,b,ca=0,cb=0;
    cin>>a>>b;
    while(a>0)
    {
        ca+=a%10;
        a/=10;
    }
    while(b>0)
    {
        cb+=b%10;
        b/=10;
    }
    cout<<max(ca,cb);
}
int32_t main() {
    
    #ifndef ONLINE_JUDGE
        freopen("input1.txt", "r", stdin);
        freopen("output1.txt", "w+", stdout);
    #else
      // online submission
    #endif
    
    
    fast
    //IO;
	//cout<<fixed<<setprecision(15);
    //test
    {

        solve();


    }
    return 0;
}
