#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using ld=long double;

int main(){
    ld S,P;
    cin >> S >> P;
    for(ld i=1;i<1e6+5;i++){

        if((ll)(P/i)==(P/i)){
            if((P/i)+i==S){
                cout << "Yes" << endl;
                return 0;
            }

            if(i+(P/i)==S){
                cout << "Yes" << endl;
                return 0;
            }

        }

    }
    cout << "No" << endl;
 }

/****************************
/////  Shubham Singhal
/////  LNMIIT
*****************************/
#include <bits/stdc++.h>
// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp>
// #include <functional>
// using namespace __gnu_pbds;
#define ff first
#define ss second
#define mp make_pair
#define pb push_back
#define ppb pop_back
#define pf push_front
#define ppf pop_front
#define eb emplace_back
#define lwr lower_bound
#define upr upper_bound
#define pq priority_queue
#define umap unordered_map
#define rep(i,n) for(i=0; i<n;i++)
#define repp(i,a,n) for(i=a; i<n;i++)
#define precise(x) cout<<fixed<<setprecision(x)
#define all(x) x.begin(),x.end()
#define lcm(a,b) (a*b)/__gcd(a,b)
#define prn(x) cout<<x<<"\n"
#define prn2(x, y) cout<<x<<" "<<y<<"\n"
#define prn3(x, y, z) cout<<x<<" "<<y<<" "<<z<<"\n"
#define prn4(x, y, z, a) cout<<x<<" "<<y<<" "<<z<<" "<<a<<"\n"
#define prnv(x) for(auto i:x) cout<<i<<" "; cout<<"\n"
#define MOD 1000000007
#define MaX 300005
using namespace std;

typedef unsigned long long ull;
typedef long long ll;
typedef double ld;
typedef pair<int, int> pii;
typedef pair<ll, int> pli;
typedef pair<int, ll> pil;
typedef pair<ll, ll> pll;
typedef pair<double, double> pdd;
typedef vector<int> vi;
typedef vector<long> vl;
typedef vector<char> vc;
typedef vector<ll> vll;
typedef vector<bool> vb;
typedef vector<double> vd;
typedef vector<string> vs;
typedef vector<pii> vpii;
typedef vector<pil> vpil;
typedef vector<pli> vpli;
typedef vector<pll> vpll;
const long long INF64 = 1e18;
clock_t time_p=clock();
void time()
{
    time_p=clock()-time_p;
    cerr<<"Time Taken : "<<(float)(time_p)/CLOCKS_PER_SEC<<"\n";
}
void doc()
{
    freopen("input.txt","r",stdin);
    freopen("output.txt","w",stdout);
}
void fast()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);cout.tie(NULL);
}
// typedef tree<int, null_type, less<int>, rb_tree_tag,
//              tree_order_statistics_node_update>
//     new_data_set;

/************************************************/

bool isprime(ll n)
{
    if (n <= 1)
        return false;
    if (n <= 3)
        return true;
    if (n % 2 == 0 || n % 3 == 0)
        return false;

    for (ll i = 5; i * i <= n; i = i + 6)
        if (n % i == 0 || n % (i + 2) == 0)
            return false;
    return true;
}

void solve()
{
    ll s,p;
    cin>>s>>p;
    map<ll,ll> m;
    for(ll i=1;i<=sqrt(p);i++)
    {
        if(p%i==0)
        {
            if(i*i==p)
                m[i]++;
            else
            {
                m[i]++;
                m[p/i]++;
            }
        }
    }
    // sort(all(a));
    // for(auto it : m)
    //     cout<<it.ff<<' ';
    // cout<<'\n';
    for(auto it=m.begin();it!=m.end();it++)
    {
        // cout<<it.ff<<' ';
        ll x=s-it->ff;
        // cout<<x<<' ';
        if(m.find(x)!=m.end())
        {
            // cout<<x<<'\n';
            cout<<"Yes";
            exit(0);
        }
    }
    cout<<"No\n";

}

int main()
{
    fast();
    int t=1;
    // cin>>t;
    while(t--)
        solve();
}


#include<bits/stdc++.h>
using namespace std;
int main ()
{
    int n;
    cin>>n;
    if(n%2==0)
        cout<<"White"<<endl;
    else
        cout<<"Black"<<endl;
}

#include<bits/stdc++.h>
#define ll long long
using namespace std;
int main()
{
  ll t;
  string s;
  cin>>s;
  cout<<s[1]<<s[2]<<s[0];

}


#include <bits/stdc++.h>
#define ll  long long
#define ull unsigned long long
using namespace std;
#define  inf 1e15+18
#define fastio ios_base::sync_with_stdio(false); cin.tie(NULL)
#define mod  998244353
#define  f1(i,n) for(i=1;i<=n;i++)
#define f0(i,n)  for(i=0;i<n;i++)
#define w(x)   while(x--)
const int maxn=100001;
#define  pq priority_queue
#define  ff first
#define  ss second
#define pb  push_back
#define lb lower_bound
vector<int>r[52];
vector<int>c[52];
ll a[52][52];
int n;
ll c_c;
int vis_r[52],vis_c[52];
bool check_r(int i,int j,int k)
{

  for(int x=1;x<=n;x++)
  {
    if(a[i][x]+a[j][x]>k)
      return 0;

  }
  return 1;
}
bool check_c(int i,int j,int k)
{

  for(int x=1;x<=n;x++)
  {
    if(a[x][i]+a[x][j]>k)
      return 0;

  }
  return 1;
}
void dfs_r(int node)
{
    vis_r[node]=1;
    c_c++;
    for(int child:r[node])
    {
      if(!vis_r[child])
        dfs_r(child);
    }
}
void dfs_c(int node)
{
    vis_c[node]=1;
    c_c++;
    for(int child:c[node])
    {
      if(!vis_c[child])
        dfs_c(child);
    }
}

int main()
{

ll i,j,l,k,ans=1;
cin >> n >>k;
for(i=1;i<=n;i++)
{
  for(j=1;j<=n;j++)
    cin >>a[i][j];
}
for(i=1;i<=n;i++)
{
  for(j=i+1;j<=n;j++)
  {
    if(check_r(i,j,k)){
      r[i].pb(j);
      r[j].pb(i);
    }
  }
}
for(i=1;i<=n;i++)
{
  for(j=i+1;j<=n;j++)
  {
    if(check_c(i,j,k)){
      c[i].pb(j);
      c[j].pb(i);
    }
  }
}
for(int i=1;i<=n;i++)
{
  if(vis_r[i]==0)
  {
    c_c=0;
    dfs_r(i);
    l=1;
    for(j=1;j<=c_c;j++)
      l=(l*j)%mod;
    ans=(ans*l)%mod;
  }

}

for(int i=1;i<=n;i++)
{
  if(vis_c[i]==0)
  {
    c_c=0;
    dfs_c(i);
    l=1;
    for(j=1;j<=c_c;j++)
      l=(l*j)%mod;
    ans=(ans*l)%mod;
  }

}
cout<<ans;

}

#include <bits/stdc++.h>
#define int long long

#pragma GCC target ("avx2")
#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")

using namespace std;

const int MOD = 998244353;
const int N = 2e5 + 5;
int resh[N], f[N + 500], n, m;
vector <int> primes;

int pow(int a, int b) {
    if (b == 0) return 1ll;
    else if (b & 1) return (a * pow(a, b - 1)) % MOD;
    else {
        int ce = pow(a, b / 2);
        return (ce * ce) % MOD;
    }
}

int C(int a, int b) {
    int ans = 1;
    ans = (ans * f[b]) % MOD;
    ans = (ans * pow(f[a], MOD - 2)) % MOD;
    ans = (ans * pow(f[b - a], MOD - 2)) % MOD;
    return ans;
}

signed main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    f[0] = 1;
    for (int i = 1; i < N + 500; ++i) {
        f[i] = (f[i - 1] * i) % MOD;
    }
    cin >> n >> m;
    for (int i = 2; i <= N - 5; ++i) {
        if (resh[i] == 0) {
            resh[i] = i;
            primes.push_back(i);
        }
        for (int j = 0; j < primes.size(); ++j) {
            if (primes[j] > resh[i] || primes[j] * i > N - 5) {
                break;
            }
            resh[primes[j] * i] = primes[j];
        }
    }
    int ans = 1;
    for (int i = 2; i <= m; ++i) {
        int cur_ans = 1;
        // 1 1 1 1 1 1 m
        int cure = i;
        while (cure > 1) {
            int min_del = resh[cure], cnt = 0;
            while (cure % min_del == 0) {
                cure /= min_del;
                ++cnt;
            }
            //cout << cnt << " " << cnt + n - 1 << endl;
            //cout << C(cnt, cnt + n - 1) << endl;
            cur_ans = (cur_ans * C(cnt, cnt + n - 1)) % MOD;
        }
        ans = (ans + cur_ans) % MOD;
    }
    cout << ans;
    return 0;
}


#include <bits/stdc++.h>

using namespace std;

#define REP(i,n) for(int i=0;i<int(n);i++)
#define foreach(c,itr) for(__typeof((c).begin()) itr=(c).begin();itr!=(c).end();itr++)
typedef long long ll;
typedef pair<int,int> P;

const ll MOD=998244353;
ll modpow(ll x,ll n){
    ll res=1;
    while(n!=0){
	if(n%2!=0) res=(res*x)%MOD;
	x=(x*x)%MOD;
	n/=2;
   }
    return res;
}

int main(void){
	ll i;

	cin.tie(0);  ios_base::sync_with_stdio(false);

	ll N;
	cin >> N;
	vector<ll> a(N+1);
	a[0]=-1;
	for(i=1;i<=N;i++) cin >> a[i];
	sort(a.begin(),a.end());

	ll S=(a[N]*a[N])%MOD;
	ll ans=S;
	for(i=N-1;i>=1;i--){
		if(a[i]!=0){
			ll x=(2*a[i]*S)%MOD;
			ll y=modpow(a[i+1],MOD-2);
			S=(x*y)%MOD;
			S+=(a[i]*a[i])%MOD;
			S-=(a[i]*a[i+1])%MOD;
			S=(S+MOD)%MOD;
			ans+=S;
			ans=ans%MOD;

		}else{
			break;
		}

	}

	cout << ans << endl;

	return 0;
}

#include<bits/stdc++.h>
using namespace std;
#define vec vector<int>
#define vecp vector<pair<int,int>>
#define ll long long
#define ull unsigned long long
#define pb push_back
#define fr first
#define sc second
#define fr1(i,a,b) for(int i=a;i<b;i++)
#define fr2(i,a,b) for(int i=a;i>=b;i--)
#define fr3(i,a,b) for(int i=a;i<=b;i++)
#define umap unordered_map<int,int,custom_hash>
#define omap map<int,int>
#define uset unordered_set<int,custom_hash>
#define oset set<int>
#define pr pair<int,int>
#define mod 1000000007
#define mp make_pair
#define all(v) v.begin(),v.end()
#define ppb pop_back

struct custom_hash {
    static uint64_t splitmix64(uint64_t x) {
        // http://xorshift.di.unimi.it/splitmix64.c
        x += 0x9e3779b97f4a7c15;
        x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
        x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
        return x ^ (x >> 31);
    }
    size_t operator()(uint64_t x) const {
        static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
        return splitmix64(x + FIXED_RANDOM);
    }
};
void read(vec &v)
{
  for(auto &i:v)cin>>i;
}
bool power(int val)
{
  if(val%6==0||val%10==0||val%15==0)
    return true;
  return false;
}
void solve()
{
  int n;
  cin>>n;
  if(n==3)
  {
    cout<<"6 10 15"<<"\n";
    return ;
  }
  int i=6;
  fr1(j,0,n)
  {
    if(power(i))
      cout<<i<<" ";
    else
      j--;
    i++;
  }
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int t=1;
    //cin>>t;
    fr3(i,1,t){
      // cout<<"Case #"<<i<<": ";
        solve();
    }
   return 0;
}


#include<bits/stdc++.h>
#define pb push_back
#define Int long long
using namespace std;

Int N,M,K;
Int h,w;
Int X,Y,Z;
const int MAXN=500005;
const int NAX=1005;
const int HIGH=1e8+500;

int main()
{
	#ifndef ONLINE_JUDGE
	freopen("inputf.txt","r",stdin);
	freopen("outputf.txt","w",stdout);
	#endif

	cin>>N;
	vector<Int> A(N);
	Int GCD=0;
	for(auto &x:A) {
		cin>>x;
		GCD=__gcd(GCD,x);
	}

	cout<<GCD<<'\n';

}

#include <stdio.h>

int gcd(int a, int b) {
    if (!a)
        return b;
    return gcd(b % a, a);
}

int main() {
    int n, a, b;
    scanf("%i%i", &n, &a);
    for (int i = 1; i < n; i++) {
        scanf("%i", &b);
        a = gcd(a, b);
    }
    printf("%i", a);
}


#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
#define lowbit(x) (x & (-x))
char __c, __neg, __digit[128] = {0}, __skip[128] = {0};
void init_io() {
    LL i;
    for (i = 0; i <= 9; i++) __digit[i + '0'] = 1;
    for (i = 0; i < 128; i++) if ((i < '0' || i > '9') && i != '-') __skip[i] = 1;
}
#define getLL(v) do { __neg = 0, v = 0; \
    do { __c = getchar(); } while (__skip[__c]); \
    if (__c == '-') { __neg = 1; __c = getchar(); } \
    while (__digit[__c]) { v = v * 10 + __c - '0'; __c = getchar(); } \
    if (__neg) v = -v; \
} while (0)

const LL inf  = 1e17+9;
const LL mod  = 1e9+7;
const LL maxn = 2e5+8;

map<LL, LL> mp[maxn];
LL n, q, fa[maxn], c[maxn];

LL find(LL u) {
    if (fa[u] == u) return u;
    return fa[u] = find(fa[u]);
}

void solve() {
    LL i, j, opt, a, b, x, y;
    getLL(n); getLL(q);
    for (i = 1; i <= n; i++) {
        getLL(c[i]);
        fa[i] = i; mp[i][c[i]]++;
    }
    for (i = 1; i <= q; i++) {
        getLL(opt);
        if (opt == 1) {
            getLL(a); getLL(b);
            x = find(a), y = find(b);
            if (x != y) {
                fa[x] = y;
                if (mp[x].size() > mp[y].size()) swap(mp[x], mp[y]);
                for (auto u : mp[x]) mp[y][u.first] += u.second;
                mp[x].clear();
            }
        }
        else {
            getLL(x); getLL(y);
            x = find(x);
            printf("%lld\n", mp[x][y]);
        }
    }
}

signed main() {
    init_io();
    solve();
    return 0;
}

#include<bits/stdc++.h>

using namespace std;
#define endl '\n'
#define deb(x) cout << #x << " = " << x << endl;
typedef long long ll;
typedef long double ld;
const int MOD = 1e9 + 7;

void solve() {
  int n;
  cin >> n;
  vector<ll> a(n);
  for(ll &i : a) cin >> i;
  ll ans = 0;
  sort(a.begin(), a.end());
  for(int i = n - 1; i >= 0; i--)
    ans += (i * a[i]) - ((n - i - 1)  * a[i]);
  cout << ans << '\n';
}

int main(){
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr); cout.tie(nullptr);
  int t = 1, tt = 0;
  //cin >> t;
  while(t--){
    //cout << "Case #" << ++tt << ": ";
    solve();
  }
  return 0;
} //Hajimemashite


#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int mod=998244353;
int n,a[200005],ans=0;
int main(){
	cin>>n;
	for(int i=1;i<=n;i++)cin>>a[i];
	sort(a+1,a+n+1);
	for(int i=1,sum=0;i<=n;i++){
		ans=(ans+1ll*a[i]*sum+1ll*a[i]*a[i])%mod;
		sum=(sum*2ll+a[i])%mod;
	}
	cout<<ans;
}

#include<bits/stdc++.h>
using namespace std;
#define endl '\n'
#define int long long
#define cin(a,n) for(int i=0;i<n;i++) cin>>a[i]
#define cin2(a,b,n) for(int i=0;i<n;i++) cin>>a[i]>>b[i]
#define mod 998244353
#define pb push_back
#define pie 3.141592653589793238462643383279
vector<bool> prime;
vector<int> fact,inv,primes,factors;
void factorize(int a)
{
	fact.clear();
	for(int i=1;i*i<=a;i++)
	{
		if (i*i==a) factors.pb(i);
		else if (a%i==0)
		{
			factors.pb(i);
			factors.pb(a/i);
		}
	}
	sort(factors.begin(),factors.end());
}
int power(int a,int b)
{
	if(a==1||b==0)	return 1;
	int c=power(a,b/2);
	int res=1;
	res=c*c;
	if(res>=mod)	res%=mod;
	if(b%2)	res*=a;
	if(res>=mod)	res%=mod;
	return res;
}
int modInv(int a)
{
	return power(a,mod-2);
}
void factorial(int n)
{
	fact.resize(n+1);
	fact[0]=1;
	for(int i=1;i<=n;i++)
	{
		fact[i]=fact[i-1]*i;
		if(fact[i]>=mod)	fact[i]%=mod;
	}
}
void InvFactorial(int n)
{
	inv.resize(n+1);
	inv[0]=1;
	for(int i=1;i<=n;i++)	inv[i]=modInv(fact[i]);
}
int ncr(int n,int r)
{
	if(n<r||n<0||r<0)	return 0;
	int b=inv[n-r];
	int c=inv[r];
	int a=fact[n]*b;
	if(a>=mod)	a%=mod;
	a*=c;
	if(a>=mod)	a%=mod;
	return a;
}
void remove_duplicates(vector<pair<int,int>> &v)
{
	sort(v.begin(),v.end());
	int _size=unique(v.begin(),v.end())-v.begin();
	v.resize(_size);
}
unsigned int gcd(unsigned int u, unsigned int v)
{
    if(u==0||v==0) return max(u,v);
    unsigned int shift=__builtin_ctz(u|v);
	u>>=__builtin_ctz(u);
    do{
    	v>>=__builtin_ctz(v);
    	if(u>v)	swap(u,v);
    	v-=u;
    }while(v!=0);
    return u<<shift;
}
void sieve(int n)
{
    prime.assign(n+1,1);
	prime[1]=false;
    for(int p=2;p*p<=n;p++) if(prime[p])	for(int i=p*p;i<=n;i+=p)	prime[i]=false;
    for(int i=2;i<n+1;i++) if(prime[i]) primes.push_back(i);
}
//----------------------------------------------------------------------------------------------------------------------------------------------------
void solve()
{
	int n;
	cin>>n;
	int a[n];
	cin(a,n);
	sort(a,a+n);
	int sum=0,exp=a[0];
	for(int i=1;i<n;i++)
	{
		sum=(sum+a[i]*exp)%mod;
		exp=(2*exp+a[i])%mod;
	}
	for(int i=0;i<n;i++) sum=(sum+a[i]*a[i])%mod;
	cout<<sum;
}
signed main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	int T=1;
	//cin>>T;
	for(int i=1;i<=T;i++) solve();
}


/** try <3 **/
#include<bits/stdc++.h>

using namespace std;

#define task "sol"
#define lb lower_bound
#define ub upper_bound
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define zs(v) ((int)(v).size())
#define BIT(x, i) (((x) >> (i)) & 1)
#define CNTBIT __builtin_popcountll
#define ALL(v) (v).begin(),(v).end()
#define endl '\n'

typedef long double ld;
typedef long long ll;
typedef pair<int,int> pii;

const int dx[8]={0,-1,0,1,1,-1,-1,1};
const int dy[8]={-1,0,1,0,-1,-1,1,1};

void gogo()
{
    string s;
    cin>>s;

    s=s+s[0];
    s.erase(0,1);

    cout<<s;
}
int main()
{
    ios_base::sync_with_stdio(0); cin.tie(0);
    if(fopen(task".inp","r"))
    {
        freopen(task".inp","r",stdin);
        freopen(task".out","w",stdout);
    }
    gogo();
}

#include <bits/stdc++.h>
using namespace std;
using ll = long long;
template<class T> using vc = vector<T>;
template<class T> using vvc = vc<vc<T>>;
template<class T> using vvvc = vc<vvc<T>>;
template<class T> using vvvvc = vvc<vvc<T>>;
template<class T> using PQ = priority_queue<T>;
template<class T> using invPQ = priority_queue<T, vector<T>, greater<T>>;
using IP = pair<int, int>;
using LP = pair<ll, ll>;
#define mp make_pair
#define pb push_back
#define all(x) begin(x), end(x)
#define rep(i, n) for (int i = 0; (i) < (int)(n); i++)
#define rep3(i, m, n) for (int i = (m); (i) < (int)(n); i++)
#define repr(i, n) for (int i = n; (i) >= 0; i--)
#define rep3r(i, m, n) for (int i = (n); (i) >= (int)(m); i--)
template<class T> inline bool chmax(T & a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T & a, T b) { if (a > b) { a = b; return 1; } return 0; }
//constexpr int INF = 1070000000;
//constexpr long long LINF = 4611686015206162431;
//constexpr int MOD = 1000000007;

signed main() {
    ios::sync_with_stdio(0);
    cin.tie(0);

    int N;
    cin >> N;
    vc<int> V(N*2);
    rep (i, N*2) cin >> V[i];

    ll s = 0;
    rep (i, N*2) s += V[i];

    priority_queue<int, vc<int>, greater<int>> que;
    int l = N-1, r = N;

    rep (i, N) {
        que.push(V[l]);
        que.push(V[r]);
        s -= que.top();
        que.pop();
        l--; r++;
    }

    cout << s << endl;
}


#include<iostream>
#include<vector>
#include<bitset>
using namespace std;
unsigned xorshift()
{
	static unsigned y=2463534242;
	y^=y<<13;
	y^=y>>17;
	y^=y<<5;
	return y;
}
const int N=20;
int M;
string S[800];
string outH[N],outW[N];
int G[800][800];
using bit=bitset<800>;
bit rest;
bit can[N+1][800];
int cnt[800];
int main()
{
	cin>>M>>M;
	for(int i=0;i<M;i++)
	{
		cin>>S[i];
		rest[i]=1;
		cnt[i]=1;
	}
	for(int i=0;i<M;i++)for(int j=0;j<M;j++)if(i!=j&&rest[j])
	{
		for(int k=1;k<=S[i].size();k++)
		{
			int len=S[i].size()-k;
			if(S[j].size()<len)len=S[j].size();
			if(S[i].substr(k,len)==S[j].substr(0,len))
			{
				G[i][j]=S[j].size()-len;
				if(G[i][j]==0)
				{
					rest[j]=0;
					cnt[i]+=cnt[j];
					cnt[j]=0;
				}
				break;
			}
		}
	}
	for(int tm=0;tm<N;tm++)
	{
		string now="";
		if(rest.any())
		{
			vector<vector<int> >dist(N+1,vector<int>(M,0));
			vector<vector<int> >pr(N+1,vector<int>(M,-1));
			for(int v=0;v<M;v++)if(rest[v])
			{
				for(int u=S[v].size();u<=N;u++)
				{
					dist[u][v]=cnt[v];
					can[u][v]=rest;
					can[u][v][v]=0;
				}
			}
			for(int u=0;u<N;u++)for(int v=0;v<M;v++)if(dist[u][v]>0)
			{
				for(int w=0;w<M;w++)if(can[u][v][w])
				{
					int nu=u+G[v][w];
					if(nu<=N&&dist[nu][w]<dist[u][v]+cnt[w])
					{
						dist[nu][w]=dist[u][v]+cnt[w];
						pr[nu][w]=v;
						can[nu][w]=can[u][v];
						can[nu][w][w]=0;
					}
				}
			}
			int go=-1;
			for(int v=0;v<M;v++)if(go==-1||dist[N][v]>dist[N][go])go=v;
			vector<int>vs;
			{
				int nu=N;
				while(true)
				{
					vs.push_back(go);
					int ngo=pr[nu][go];
					if(ngo<0)break;
					nu-=G[ngo][go];
					go=ngo;
				}
			}
			now=S[go];
			for(int i=vs.size()-1;i--;)
			{
				int d=G[go][vs[i]];
				go=vs[i];
				now+=S[go].substr(S[go].size()-d);
			}
		}
		while(now.size()<N)now+='.';
		cout<<now<<endl;
		outW[tm]=now+now;
		for(int j=0;j<N;j++)outH[j]+=now[j];
		for(int i=0;i<M;i++)if(rest[i])
		{
			for(int k=0;k<N;k++)if(outW[tm].substr(k,S[i].size())==S[i])
			{
				rest[i]=0;
				break;
			}
			if(rest[i]&&tm+1>=S[i].size())
			{
				for(int j=0;j<N;j++)if(outH[j].substr(tm+1-S[i].size())==S[i])
				{
					rest[i]=0;
					break;
				}
			}
		}
	}
}

#include<bits/stdc++.h>
using namespace std;
#define ll long long
// memo  fixed  setprecision(20);
using vvll = vector<vector<ll>>;
ll mod =1e9+7;
/*"itob" int to "N"base */           template<typename TypeInt> string itob(const TypeInt v, int base){static const char table[] = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";string ret;static numeric_limits<TypeInt> t;TypeInt n = v;if (t.is_signed) {if (v < 0) n *= -1;}while (n >= base) {ret += table[n%base];n /= base;}ret += table[n];if (t.is_signed) {if (v < 0 && base == 10) ret += '-';}reverse(ret.begin(), ret.end());return ret;}
/*"chmin" a = MAX*/                  template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
/*"chmax" a = MIN*/                  template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
/*"ctoi"  char to int*/              int ctoi(char c) {return c-'0';}
/*"gcd"   MAX Euclidean */           ll gcd(ll a,ll b){if(b==0)return a; return gcd(b,a%b);}
    /*"lcm"   MIN*/                      ll lcm(ll a,ll b){ll g = gcd(a,b);return a/g*b;}
/*"primecheck"If prime,return true.*/bool primecheck(ll n){if(n < 2) return false;else{for(int i = 2; i * i <= n; i++){if(n % i == 0) return false;}return true;}}
string  reverserange(string s,ll a,ll b){reverse(s.begin()+a-1,s.begin()+b); return s;}
ll modpow(ll a,ll n, ll mod){ll res = 1;while(n>0){if (n%2==1){res = res * a % mod;}a = a * a % mod;n/=2;}return res;}
int main() {
    srand(time(NULL));
    ll n,m;
    cin >> n >> m;
    vector<string>che(m);
    string ra ="ABCDEFGH";
    for(int i=0;i<m;i++){
        cin>>che.at(i);
    }
    sort(che.begin(),che.end());
    ll check =0;
    for(int i=0;i<n;i++){
        string d;
        while(d.size()<n){
            if(d.size()+che.at(check).size()>n){
                while(d.size()<n){
                d+=ra.at(rand()%8);
                }
                break;
            }
            d+=che.at(check);
            check++;
        }
        if(d.size()>n){
            string g;
            for(int j=0;j<n;j++){
            g+=d.at(j);
            }
            d=g;
        }
        cout<<d<<endl;
    }
}


#include <bits/stdc++.h>
using namespace std;
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
#define ordered_set tree<int,null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
#define ordered_set_pair tree<pair<int,int>,null_type,less<pair<int,int>>, rb_tree_tag,tree_order_statistics_node_update>
#define ordered_set_mutiset tree<int,null_type,less_equal<int>, rb_tree_tag,tree_order_statistics_node_update>
typedef long long int ll;
typedef long double ld;
typedef unsigned long long int ull;
typedef pair<int,int> pi;
#define PI 3.1415926535897932384
#define FOR(i,vv,n) for(ll i=vv;i<n;i++)
#define FORR(i,n,vv) for(ll i=n-1;i>=vv;i--)
#define ve vector
#define maxind(v) (max_element(v.begin(),v.end())-v.begin())
#define minind(v) (min_element(v.begin(),v.end())-v.begin())
#define maxe(v) *max_element(v.begin(),v.end())
#define mine(v) *min_element(v.begin(),v.end())
#define all(v) v.begin(),v.end()
#define pb push_back
#define pf push_front
#define ppb pop_back
#define ppf pop_front
#define eb emplace_back
#define FAST ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define mp make_pair
#define M 1000000007ll
#define INF 1000000000000000000ll
#define PRECISE cout.precision(18);
#define BS(v,n) binary_search(v.begin(),v.end(),n)
#define srt(v) sort(v.begin(),v.end())
#define rsrt(v) sort(v.begin(),v.end(),greater <ll>())
#define uni(v) v.resize(unique(v.begin(),v.end())-v.begin())
#define F first
#define S second
#define GET(i,p) get<p>(i)

int main(){

	#ifndef ONLINE_JUDGE
    // for getting input from input.txt
    freopen("input.txt", "r", stdin);
    // for writing output to output.txt
    freopen("output.txt", "w", stdout);
	 #endif
    FAST
//	PRECISE

char s,t;
cin>>s>>t;
if(s=='Y')cout<<(char)toupper(t);
else cout<<(char)tolower(t);

return 0;
 }


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

typedef pair<int,int> P;
typedef long long ll;

#define int ll

ll score(char c[], int a){
	ll ans = 0;
	int num[10];
	for(int i=0;i<10;i++) num[i]=0ll;
	for(int i=0;i<4;i++) num[c[i]-'0']++;
	num[a]++;

	for(int i=0;i<10;i++) ans += i*pow(10,num[i]);

	return ans;
}

main(){
	int k;
	char s[10],t[10];

	cin >> k >> s >> t;

	int card[10];
	card[0] = 0;
	for(int i=1;i<=9;i++) card[i] = k;

	for(int i=0;i<4;i++) card[s[i]-'0']--;
	for(int i=0;i<4;i++) card[t[i]-'0']--;

	ll sum = (9ll*k-8ll)*(9ll*k-9ll);

	ll win = 0ll;

	for(int i=1;i<=9;i++){
		for(int j=1;j<=9;j++){
			if(score(s, i)>score(t,j)){
				if(i==j){
					if(card[i]>=2) win += card[i]*(card[i]-1);
				}else{
					win += card[i]*card[j];
				}
			}
		}
	}
	double ans = (double) win / sum;

	printf("%.10lf\n",ans);

	return 0;
}

#include <iostream>
#include <stdio.h>
#include <vector>
#include <algorithm>
#include <math.h>
#include <string>
using namespace std;

int calc_score(long score, int cards, int p){
    score -= p* pow(10, cards - 1);
    score += p * pow(10, cards);
    return score;
}

int main(){
    long k;
    cin >> k;
    int s_in, t_in;
    vector<int> s(4);
    vector<int> t(4);
    scanf("%d# %d#",&s_in, &t_in);
    vector<int> card_s(9);
    vector<int> card_t(9);
    long cs = 0;
    long ct = 0;
    int a = 1000;
    for(int i = 0; i < 4; i++){
        s[i] = s_in / a;
        t[i] = t_in / a;
        s_in -= s[i]*a;
        t_in -= t[i]*a;
        a = a/10;
        card_s[s[i] - 1]++;
        card_t[t[i] - 1]++;
    }
    for(int i = 0; i < 4; i++){
        int si = s[i];
        int ti = t[i];
    }
    for(int i = 1; i < 10; i++){
        cs += i * pow(10, card_s[i - 1]);
        ct += i * pow(10, card_t[i - 1]);
    }
    long kati = 0;
    for(int i = 1; i < 10; i++){
        if(card_s[i-1] + card_t[i-1]== k) continue;
        for(int j = 1; j < 10; j++){
            if(card_s[j-1] + card_t[j-1]== k) continue;
            if(i == j && card_s[i-1] + card_t[i-1] + 2 > k){
                continue;
            }
            if(calc_score(cs, card_s[i-1]+1, i) > calc_score(ct, card_t[j-1]+1, j)){
                if(i == j){
                    kati += (k - card_s[i-1] - card_t[i-1]) * (k - card_s[i-1] - card_t[i-1] - 1);
                }
                else{
                    kati += (k - card_s[i-1] - card_t[i-1]) * (k - card_s[j-1] - card_t[j-1]);
                }
            }

        }
    }
    double ans = (double)kati / ((9.0 * k  - 8.0) * (9.0 * k - 9.0));
    cout << ans << endl;

    return 0;
}


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

#define sz(a) int((a).size())
#define pb push_back
#define mp make_pair
#define all(c) (c).begin(), (c).end()
#define tr(c, i) for (__typeof((c).begin()) i = (c).begin(); i != (c).end(); i++)

#define uns(v) sort((v).begin(), (v).end()), v.erase(unique(v.begin(), v.end()), v.end())

#define inf 1000000000
#define MAXN 2007
#define MOD 1000000007
typedef long long ll;
bool vis[MAXN];
vector<int> adj[MAXN];
int cnt;
void dfs(int u) {
    if (!vis[u]) {
        vis[u] = true;
        cnt++;
        for (int i = 0; i < sz(adj[u]); i++) {
            int v = adj[u][i];
            if (vis[v]) continue;
            dfs(v);
        }
    }
}
void _run_test() {
    int n, m, a, b;
    cin >> n >> m;
    for (int i = 0; i < m; i++) {
        cin >> a >> b;
        a--, b--;
        adj[a].pb(b);
    }
    ll res = 0;
    for (int i = 0; i < n; i++) {
        memset(vis, false, sizeof(vis));
        cnt = 0;
        dfs(i);
        res += cnt;
    }
    cout << res << "\n";
}
int main() {
    std::ios_base::sync_with_stdio(0);
    cin.tie(0);
    int t = 1;
    // cin >> t;
    while (t--) {
        _run_test();
    }

    return 0;
}

#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
#define irep(i, n) for (int i = (n-1); i >= 0; i--)
using namespace std;
using ll = long long;
using P = pair<int,int>;

constexpr int N = 2000;
vector<vector<int>> g(N);

int bfs(int start, int n) {
	vector<int> dist(N, -1);
	queue<int> q;

	dist[start] = 0;
	q.push(start);

	while (!q.empty())
	{
		int v = q.front();
		q.pop();

		for (int nv : g[v]) {
			if (dist[nv] != -1) continue;

			dist[nv] = dist[v] + 1;
			q.push(nv);
		}
	}

	int r = 0;
	rep(i,n) {
		if (dist[i] >= 0) r++;
	}
	return r;
}

int main() {
	int n, m;
	cin >> n >> m;
	rep(i,m) {
		int a, b;
		cin >> a >> b;
		a--; b--;
		g[a].push_back(b);
	}

	int ans = 0;
	rep(i,n) {
		ans += bfs(i, n);
	}
	cout << ans << endl;
}


#include <bits/stdc++.h>
typedef long long ll;
#define Boost                       \
  ios_base::sync_with_stdio(false); \
  cin.tie(NULL);
#define endl '\n'

#define fo(i, x, y) for (__typeof(x) i = x; i < y; ++i)
#define fr(i, x, y) for (__typeof(x) i = x; i > y; i--)

#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define f first
#define s second
#define lb lower_bound
#define ub upper_bound
#define all(x) x.begin(), x.end()

#define MAX(a, b) ((a) > (b) ? (a) : (b))
#define MIN(a, b) ((a) < (b) ? (a) : (b))
#define vdp(n, x) vector<vector<ll>> dp(n + 1, vector<ll>(x + 1));

ll mod = 1000000007;
const ll AM = 2e5 + 5;

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

int main()
{
  Boost;
  int t;
  //cin >> t;
  t = 1;
  while (t--)
  {
    ll m, h;
    cin >> m >> h;
    if (h % m == 0)
      cout << "Yes" << endl;
    else
      cout << "No" << endl;
  }
}

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

// #pragma GCC target ("avx2")
// #pragma GCC optimize("O3")
// #pragma GCC optimization ("unroll-loops")
// #pragma comment(linker, "/stack:200000000")
// #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
// #pragma GCC target("fpmath=387") //extra precision

#define debug_input cout<<"input"<<endl;freopen("input.txt","r",stdin);
#define debug_output cout<<"output"<<endl;freopen("output.txt","w",stdout);
#define debug debug_input;debug_output;

typedef double db;
typedef string str;
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;

typedef pair<int,int> pi;
typedef pair<ll,ll> pl;
typedef pair<double,double> pd;

#define F first
#define S second
#define endl '\n'
#define ALL(a) a.begin(),a.end()
#define mp make_pair
#define pb push_back
#define FOR(i,a,b) for(int i=a;i<(int)b;i++)
#define FORN(i,a,b) for(int i=a;i<=(int)b;i++)
#define FORB(i,a,b) for(int i=a;i>=(int)b;i--)
#define REP(i,x) FOR(i,0,x)
#define MEM(arr, x) memset(arr, (x), sizeof(arr))

typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<str> vs;
typedef vector<pi> vii;
typedef vector<pl> vll;

const int MOD = 1e9+7;
const ll INF = 1e18;
const ld PI = acos((ld)-1);

const int d4i[4]={-1, 0, 1, 0}, d4j[4]={0, 1, 0, -1};
const int d8i[8]={-1, -1, 0, 1, 1, 1, 0, -1}, d8j[8]={0, 1, 1, 1, 0, -1, -1, -1};

void solve(){
    str x;
    cin>>x;

    int a = 1, b = 1;
    for(int i=0;i<(int)x.size();i+=2)
        if(x[i] >= 'A' && x[i] <= 'Z')
            a = 0;
    for(int i=1;i<(int)x.size();i+=2)
        if(x[i] >= 'a' && x[i] <= 'z')
            b = 0;
    if(a && b)  cout<<"Yes";
    else    cout<<"No";
    cout<<endl;
}
int main(){
    ios_base::sync_with_stdio(false);cin.tie(nullptr);
    // cout.tie(nullptr);
    // debug_output;
    // debug;

    int t = 1;
    // cin>>t;
    for(int tc=1;tc<=t;tc++){
        // cout<<"Case #"<<tc<<": ";
        solve();
    }
    return 0;
}


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

int main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	string s; cin >> s;
	for(int i = 1; i <= 10; i++) {
		string t = s;
		reverse(t.begin(), t.end());
		if(t == s) {
			cout << "Yes\n";
			return 0;
		}
		s = '0' + s;
	}
	cout << "No\n";
}

#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using VI = vector<int>;
using VL = vector<ll>;
using VS = vector<string>;
template<class T> using PQ = priority_queue<T, vector<T>, greater<T>>;
#define FOR(i,a,n) for(int i=(a);i<(n);++i)
#define eFOR(i,a,n) for(int i=(a);i<=(n);++i)
#define rFOR(i,a,n) for(int i=(n)-1;i>=(a);--i)
#define erFOR(i,a,n) for(int i=(n);i>=(a);--i)
#define SORT(a) sort(a.begin(),a.end())
#define rSORT(a) sort(a.rbegin(),a.rend())
#define fSORT(a,f) sort(a.begin(),a.end(),f)
#define all(a) a.begin(),a.end()
#define out(y,x) ((y)<0||h<=(y)||(x)<0||w<=(x))
#define tp(a,i) get<i>(a)
#ifdef _DEBUG
#define line cout << "-----------------------------\n"
#define stop system("pause")
#define debug(x) print(x)
#endif
constexpr ll INF = 1000000000;
constexpr ll LLINF = 1LL << 60;
constexpr ll mod = 1000000007;
constexpr ll MOD = 998244353;
constexpr ld eps = 1e-10;
constexpr ld pi = 3.1415926535897932;
template<class T>inline bool chmax(T& a, const T& b) { if (a < b) { a = b; return true; }return false; }
template<class T>inline bool chmin(T& a, const T& b) { if (a > b) { a = b; return true; }return false; }
inline void init() { cin.tie(nullptr); cout.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(15); }
template<class T>inline istream& operator>>(istream& is, vector<T>& v) { for (auto& a : v)is >> a; return is; }
template<class T, class U>inline istream& operator>>(istream& is, pair<T, U>& p) { is >> p.first >> p.second; return is; }
template<class T>inline vector<T> vec(size_t a) { return vector<T>(a); }
template<class T>inline vector<T> defvec(T def, size_t a) { return vector<T>(a, def); }
template<class T, class... Ts>inline auto vec(size_t a, Ts... ts) { return vector<decltype(vec<T>(ts...))>(a, vec<T>(ts...)); }
template<class T, class... Ts>inline auto defvec(T def, size_t a, Ts... ts) { return vector<decltype(defvec<T>(def, ts...))>(a, defvec<T>(def, ts...)); }
template<class T>inline void print(const T& a) { cout << a << "\n"; }
template<class T, class... Ts>inline void print(const T& a, const Ts&... ts) { cout << a << " "; print(ts...); }
template<class T>inline void print(const vector<T>& v) { for (int i = 0; i < v.size(); ++i)cout << v[i] << (i == v.size() - 1 ? "\n" : " "); }
template<class T>inline void print(const vector<vector<T>>& v) { for (auto& a : v)print(a); }
inline string reversed(const string& s) { string t = s; reverse(all(t)); return t; }
template<class T>inline T sum(const vector<T>& a, int l, int r) { return a[r] - (l == 0 ? 0 : a[l - 1]); }
template<class T>inline void END(T s) { print(s); exit(0); }
void END() { exit(0); }

VS solve(int n) {
    if (n == 1)return { "AB" };
    VS res{ string(1 << n - 1,'A') + string(1 << n - 1,'B') };
    auto sub = solve(n - 1);
    for (auto& s : sub)res.push_back(s + s);
    for (auto& s : sub) {
        res.push_back(s);
        for (auto& c : s)c ^= ('A' ^ 'B');
        res.back() += s;
    }
    return res;
}

int main() {
    init();

    int n; cin >> n;
    auto ans = solve(n);
    print((1 << n) - 1);
    for (auto& x : ans)print(x);

    return 0;
}


//by ciwomuli
//enter ICPC WF 2020
#include <algorithm>
#include <cctype>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <queue>
#include <stack>
#include <vector>
#include <string>
#include <sstream>
#define LL long long
using namespace std;
template <typename T>
inline void read(T &t)
{
    int f = 0, c = getchar();
    t = 0;
    while (!isdigit(c))
        f |= c == '-', c = getchar();
    while (isdigit(c))
        t = t * 10 + c - 48, c = getchar();
    if (f)
        t = -t;
}
template <typename T, typename... Args>
inline void read(T &t, Args &... args)
{
    read(t);
    read(args...);
}
int h, w;
int main(){
    int sum = 0;
    int mi = 1000;
    read(h, w);
    for (int i = 1; i <= h;i++){
        for (int j = 1; j <= w;j++){
            int a;
            read(a);
            sum += a;
            if(a<mi)
                mi = a;
        }
    }
    cout << sum - mi * h * w;
}

// #define _GLIBCXX_DEBUG

#include <algorithm>
#include <bitset>
#include <cassert>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstring>
#include <ctime>
#include <deque>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <limits>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#define REP(i, n) for (int i = 0; (i) < (int)(n); ++(i))
#define REP3(i, m, n) for (int i = (m); (i) < (int)(n); ++(i))
#define REP_R(i, n) for (int i = (int)(n)-1; (i) >= 0; --(i))
#define REP3R(i, m, n) for (int i = (int)(n)-1; (i) >= (int)(m); --(i))
#define ALL(x) std::begin(x), std::end(x)
using namespace std;
void dump_func()
{
    cerr << endl;
}
template <class Head, class... Tail>
void dump_func(Head &&h, Tail &&... t)
{
    cerr << h << (sizeof...(Tail) == 0 ? "" : ", "), dump_func(forward<Tail>(t)...);
}
#define dump(...)                                                                                \
    cerr << "/* " << #__VA_ARGS__ << " :[" << __LINE__ << ":" << __FUNCTION__ << "]" << endl, dump_func(__VA_ARGS__), \
        cerr << "*/\n\n";
typedef long long ll;

ll solve(ll h, ll w, vector<vector<ll>> &field)
{
    ll m = 1000;
    REP(i, h) REP(j, w)
    {
        m = min(m, field[i][j]);
    }
    ll res = 0;
    REP(i, h) REP(j, w)
    {
        res += field[i][j] - m;
    }
    return res;
}

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    ll h, w;
    cin >> h >> w;
    vector<vector<ll>> field(h, vector<ll>(w, 0));
    REP(i, h) REP(j, w)
    {
        cin >> field[i][j];
    }

    ll res = solve(h, w, field);
    cout << res << '\n';
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
template<typename T1,typename T2> bool chmin(T1 &a,T2 b){if(a<=b)return 0; a=b; return 1;}
template<typename T1,typename T2> bool chmax(T1 &a,T2 b){if(a>b)return 0; a=b; return 1;}
#define bitUP(x,a) ((x>>a)&1)
int dx[4]={0,1,0,-1}, dy[4]={1,0,-1,0};
long double EPS = 1e-6;
long double PI = acos(-1);
const ll INF=(1LL<<62);
const int MAX=(1<<30);
constexpr ll MOD=1000000000+7;

inline void bin101(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << fixed << setprecision(20);
}

using pii=pair<int,int>;
using pil=pair<int,ll>;
using pli=pair<ll,int>;
using pll=pair<ll,ll>;
using psi=pair<string,int>;
using pis=pair<int,string>;
using psl=pair<string,ll>;
using pls=pair<ll,string>;
using pss=pair<string,string>;

//1-indexed vector cin
template<typename T>
inline void vin1(vector<T> &v){
    for(size_t i=1;i<v.size();i++) cin>>v[i];
}

//0-indexed vector cin
template<typename T>
inline void vin0(vector<T> &v){
    for(size_t i=0;i<v.size();i++) cin>>v[i];
}

//1-indexed vector<vector> cin
template<typename T>
inline void vin1(vector<vector<T>> &v){
    for(size_t i=1;i<v.size();i++){
        for(size_t j=1;j<v[i].size();j++) cin>>v[i][j];
    }
}

//0-indexed vector<vector> cin
template<typename T>
inline void vin0(vector<vector<T>> &v){
    for(size_t i=0;i<v.size();i++){
        for(size_t j=0;j<v[i].size();j++) cin>>v[i][j];
    }
}

//要素数n 初期値x
template<typename T>
inline vector<T> vmake(size_t n,T x){
  return vector<T>(n,x);
}

//a,b,c,x data[a][b][c] 初期値x
template<typename... Args>
auto vmake(size_t n,Args... args){
    auto v=vmake(args...);
    return vector<decltype(v)>(n,move(v));
}

//pair cout
template<typename T, typename U>
inline ostream &operator<<(ostream &os,const pair<T,U> &p) {
  os<<p.first<<" "<<p.second;
  return os;
}

//pair cin
template<typename T, typename U>
inline istream &operator>>(istream &is,pair<T,U> &p) {
  is>>p.first>>p.second;
  return is;
}

//ソート
template<typename T>
inline void vsort(vector<T> &v){
    sort(v.begin(),v.end());
}

//逆順ソート
template<typename T>
inline void rvsort(vector<T> &v){
  sort(v.rbegin(),v.rend());
}

//1ビットの数を返す
inline int popcount(int x){
  return __builtin_popcount(x);
}
//1ビットの数を返す
inline int popcount(ll x){
  return __builtin_popcountll(x);
}

bool flag(ll sx,ll sy,ll gx,ll gy){
    if(sx+sy==gx+gy or sx-sy==gx-gy or abs(sx-gx)+abs(sy-gy)<=3){
        return true;
    }
    return false;
}

void solve(){
    ll sx,sy;
    ll gx,gy;
    cin>>sx>>sy>>gx>>gy;
    if(sx==gx and sy==gy){
        cout<<0<<endl;
        return;
    }
    //1会で行ける場合
    if(flag(sx,sy,gx,gy)){
        cout<<1<<endl;
        return;
    }
    //2会
    if((sx+sy)%2==(gx-gy)%2){
        cout<<2<<endl;
        return;
    }
    for(int i=-3;i<=3;i++){
        for(int j=-3;j<=3;j++){
            if(abs(i)+abs(j)>3) continue;
            if(flag(sx+i,sy+j,gx,gy)){
                cout<<2<<endl;
                return;
            }
        }
    }
    cout<<3<<endl;
}

int main(){
    bin101();
    int T=1;
    //cin>>T;
    while(T--) solve();
}

#include <bits/stdc++.h>
#define rep(i,n) for (int i=0; i<n; i++)
using namespace std;

int main() {
  long long r1,c1,r2,c2;
  cin >> r1 >> c1;
  cin >> r2 >> c2;
  int ans;
  long long dist = abs(r2-r1)+abs(c2-c1);
  if(dist==0) ans=0;
  else{
    if(dist<=3) ans=1;
    else{
      if(abs(abs(r2-r1)==abs(c2-c1))) ans=1;
      else{
        if(dist%2==0) ans=2;
         else {
           if(abs(abs(r2-r1)-abs(c2-c1))<=3) ans=2;
           else ans=3;
         }
      }
    }
  }
  cout << ans << endl;
  return 0;
}


#define _USE_MATH_DEFINES

#include <bits/stdc++.h>

using namespace std;

using ll = long long;
using ld = long double;

constexpr ll MOD = 998244353;

#ifndef ONLINE_JUDGE
template <class T, class U>ostream &operator<<(ostream &o, const map<T, U>&obj) {o << "{"; for (auto &x : obj) o << " (" << x.first << " : " << x.second << ")" << ","; o << " }"; return o;}
template <class T>ostream &operator<<(ostream &o, const set<T>&obj) {o << "{"; for (auto itr = obj.begin(); itr != obj.end(); ++itr) o << (itr != obj.begin() ? ", " : "") << *itr; o << "}"; return o;}
template <class T>ostream &operator<<(ostream &o, const multiset<T>&obj) {o << "{"; for (auto itr = obj.begin(); itr != obj.end(); ++itr) o << (itr != obj.begin() ? ", " : "") << *itr; o << "}"; return o;}
template <class T>ostream &operator<<(ostream &o, const vector<T>&obj) {o << "["; for (int i = 0; i < (int)obj.size(); ++i)o << (i > 0 ? ", " : "") << obj[i]; o << "]"; return o;}
ostream &operator<<(ostream &o, const string &obj) {o << "\""; o << obj.c_str(); o << "\""; return o;}
template <class T, class U>ostream &operator<<(ostream &o, const pair<T, U>&obj) {o << "(" << obj.first << ", " << obj.second << ")"; return o;}
template <template <class tmp>  class T, class U> ostream &operator<<(ostream &o, const T<U> &obj) {o << "{"; for (auto itr = obj.begin(); itr != obj.end(); ++itr)o << (itr != obj.begin() ? ", " : "") << *itr; o << "}"; return o;}
void print_sim_py(void) {cout << endl;}
template <class Head> void print_sim_py(Head&& head) {cout << head;print_sim_py();}
template <class Head, class... Tail> void print_sim_py(Head&& head, Tail&&... tail) {cout << head << " ";print_sim_py(forward<Tail>(tail)...);}

#define print(...) print_sim_py(__VA_ARGS__);
#else
#define print(...);
#endif

template <typename... Ts>
std::istream& IN(Ts&... xs){ return (std::cin >> ... >> xs); }

#define repr(i, a, b) for (int i = a; i < b; i++)
#define rep(i, n) for (int i = 0; i < n; i++)

#define Rrepr(i, a, b) for (int i = b; i >= a; i--)
#define Rrep(i, n) for (int i = n-1; i >= 0; i--)

bool dfs(ll p, vector<vector<ll>>& v,vector<ll>& fin_list, vector<ll>& cv,ll c, ll depth){
    bool closed = false;
    if(fin_list[p]){
        if(depth >= 3) return true;
        else           return false;
    }
    cv[p] = c;
    fin_list[p] = 1;
    rep(i, v[p].size()){
        if(v[p][i]){
            closed |= dfs(i, v, fin_list, cv, c, depth+1);
        }
    }
    return closed;
}

class Vsum2{
public:
    vector<vector<ll>> vsum;

    Vsum2(vector<vector<ll>>& a,
          function<ll (ll&)> func=[](auto& a){ return a; }){

        ll h = a.size();
        ll w = a[0].size();
        vsum.resize(h+1, vector<ll>(w+1, 0));

        repr(i,0,h){
            ll jsum = 0;
            rep(j,w){
                jsum += func(a[i][j]);
                vsum[i+1][j+1] = jsum + vsum[i][j+1];
            }
        }
        //print("#", vsum)
    }

    ll range(ll y1,ll x1, ll y2,ll x2){
        return (vsum[y2][x2] - vsum[y2][x1] - vsum[y1][x2] + vsum[y1][x1]);
    }
};

int main(void){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);

    ll n,k;
    IN(n,k);

    vector<vector<ll>> a(n, vector<ll>(n, 0));
    ll amax = 0;

    rep(i,n){
        rep(j,n){
            IN(a[i][j]);
            amax = max(amax, a[i][j]);
        }
    }

    ll l = -1 ,r = 1e9;
    while(l+1<r){
        ll m = (l+r)/2;
        bool ok = false;

        Vsum2 asum(a, [&](auto& a){ return a > m; });

        rep(i,n-k+1){
            rep(j, n-k+1){
                ll sumr = asum.range(i,j, i+k,j+k);
                if(sumr < k*k/2+1){
                    ok = true;
                }
            }
        }

        if(ok){
            r=m;
        }else{
            l=m;
        }
    }
    ll ans = r;

    cout << ans << endl;

    return 0;
}

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

#define ios			ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define FOR(i,m)		for(int i = 0 ;i  < m ;i++)
#define mem(a ,b)		memset(a,  (b) , sizeof(a))
#define all(cont)		cont.begin(),cont.end()
#define mp			make_pair
#define pb			push_back
#define F			first
#define S			second
#define cn			cout<<'\n'
#define re			return

typedef pair<int,int>		pi;
typedef	vector<int>		vi;
typedef long long 		ll;
typedef long double		ld;
typedef unsigned long long int  ull;

const int mod = 1e9 +7;

int a[801][801];
int p[801][801];
int n  , k;

bool check(int x){
	memset(p , 0 , sizeof(p));

	for(int i = 1 ;i <= n ;i++){
		for(int j = 1 ;j <= n ;j++){
			p[i][j] = (a[i][j] <= x ? 1 : 0);
		}
	}

	for(int i =1  ;i <= n;i++){
		for(int j = 1; j <= n ;j++){
			p[i][j] += p[i-1][j] + p[i][j-1] - p[i-1][j-1];
		}
	}

	int max_val = 0;
	for(int i = k; i <= n ;i++){
		for(int j = k ;j <= n ;j++){
			max_val = max(max_val , p[i][j] - p[i-k][j] - p[i][j-k] + p[i-k][j-k]);
		}
	}
	return max_val >= (k*k + 1)/2;
}

void solve(){

	cin >> n >> k;

	for(int i = 1 ;i <= n ;i++){
		for(int j = 1 ; j <= n ;j++)cin>>a[i][j];
	}

	int l = 0 , r = mod-7;

	while(l < r){
		int mid = l + (r-l)/2;

		if(check(mid)){
			r = mid;
		}
		else l = mid + 1;
	}
	cout<<l<<"\n";

}

int32_t main(){

	ios;

	int _t = 1;
//	cin >> _t;

	for(int i = 1 ; i  <= _t ;i++){
//		cout<< "Case #"<<i<<": ";
		solve();
	}

	return 0;
}


#include <bits/stdc++.h>

#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define FOR(i,n,m) for(int i=(int)(n); i<=(int)(m); i++)
#define RFOR(i,n,m) for(int i=(int)(n); i>=(int)(m); i--)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define RITR(x,c) for(__typeof(c.rbegin()) x=c.rbegin();x!=c.rend();x++)
#define setp(n) fixed << setprecision(n)

template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; }

#define ll long long
#define vll vector<ll>
#define vi vector<int>
#define pll pair<ll,ll>
#define pi pair<int,int>

#define all(a) (a.begin()),(a.end())
#define rall(a) (a.rbegin()),(a.rend())
#define fi first
#define se second
#define pb push_back
#define ins insert

#define debug(a) cerr<<(a)<<endl
#define dbrep(a,n) rep(_i,n) cerr<<(a[_i])<<" "; cerr<<endl
#define dbrep2(a,n,m) rep(_i,n){rep(_j,m) cerr<<(a[_i][_j])<<" "; cerr<<endl;}

using namespace std;

template<class A, class B>
ostream &operator<<(ostream &os, const pair<A,B> &p){return os<<"("<<p.fi<<","<<p.se<<")";}
template<class A, class B>
istream &operator>>(istream &is, pair<A,B> &p){return is>>p.fi>>p.se;}

//-------------------------------------------------
//--ModInt
//-------------------------------------------------
const uint_fast64_t MOD = 1e9+7;

class mint
{
private:
    using Value = uint_fast64_t;
    Value n;
public:
    mint():n(0){}
    mint(int_fast64_t _n):n(_n<0 ? MOD-(-_n)%MOD : _n%MOD){}
    mint(const mint &m):n(m.n){}

    friend ostream& operator<<(ostream &os, const mint &a){
		return os << a.n;
	}
    friend istream& operator>>(istream &is, mint &a){
        Value temp; is>>temp;
        a = mint(temp);
        return is;
    }

    mint& operator+=(const mint &m){n+=m.n; n=(n<MOD)?n:n-MOD; return *this;}
    mint& operator-=(const mint &m){n+=MOD-m.n; n=(n<MOD)?n:n-MOD; return *this;}
    mint& operator*=(const mint &m){n=n*m.n%MOD; return *this;}
    mint& operator/=(const mint &m){return *this*=m.inv();}
    mint& operator++(){return *this+=1;}
    mint& operator--(){return *this-=1;}

    mint operator+(const mint &m) const {return mint(*this)+=m;}
    mint operator-(const mint &m) const {return mint(*this)-=m;}
    mint operator*(const mint &m) const {return mint(*this)*=m;}
    mint operator/(const mint &m) const {return mint(*this)/=m;}
    mint operator++(int){mint t(*this); *this+=1; return t;}
    mint operator--(int){mint t(*this); *this-=1; return t;}

    bool operator==(const mint &m) const {return n==m.n;}
    bool operator!=(const mint &m) const {return n!=m.n;}
    mint operator-() const {return mint(MOD-n);}

    mint pow(Value b) const {
        mint ret(1), m(*this);
        while(b){
            if (b & 1) ret*=m;
            m*=m;
            b>>=1;
        }
        return ret;
    }

    mint inv() const {return pow(MOD-2);}
};

char C[4];
mint dp[1010];

//-------------------------------------------------

int main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N; cin>>N;
    rep(i,4) cin>>C[i];
    // C[1]=A のときは C[0]を見る
    if (C[1]=='A' && C[0]=='A'){
        cout<<"1\n";
        return 0;
    }
    // C[1]=B のときは C[3]を見る
    if (C[1]=='B' && C[3]=='B'){
        cout<<"1\n";
        return 0;
    }
    bool flg=(C[1]!=C[2]);
    dp[0] = 1;
    rep(i,N){
        FOR(j,i+2,N){
            if (flg && i!=0) dp[j]+=dp[i]*(j-i-1);
            else dp[j]+=dp[i];
        }
    }
    cout<<dp[N]<<endl;
    return 0;
}

#include<iostream>
using namespace std;
int n,k,mod,maxn;
int f[101][550001];
int main()
{
	cin>>n>>k>>mod;
	f[0][0]=1;
	for(int i=1;i<=n;i++)
	{
		maxn=(i+1)*i/2*k;
		for(int j=0;j<=maxn;j++)
		{
			long long sum=0;
			for(int kk=0;kk<=k;kk++)
			{
				if(j-i*kk<0)break;
				sum+=f[i-1][j-kk*i];
			}
			f[i][j]=sum%mod;
		}
	}
	for(int i=1;i<=n;i++)
	{
		int ans=0;
		for(int j=0;j<=n*(n+1)/2*k;j++)
		{
			ans+=(long long)f[i-1][j]*f[n-i][j]%mod;
			ans%=mod;
		}
		cout<<((long long)ans*(k+1)-1)%mod<<endl;
	}
	return 0;
}


//
//
// File Creation Date:
// Author: Gourav(https://github.com/GouravKhunger)

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

typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef pair<int, int> pii;
typedef vector<pii> vpii;
typedef vector<ll> vll;
typedef set<int> si;
typedef priority_queue<int> pq;
typedef priority_queue<int,vector<int>,greater<int>> pqs;

#define F first
#define S second
#define PB push_back
#define MP make_pair
#define FOR(i, a, b) for (int i=a; i<=b; i++)
#define FORn(i, a, b) for (int i=a; i>=b; i--)
#define all(v) v.begin(), v.end()
#define allR(v) v.rbegin(), v.rend()
#define rng_init mt19937 rng(chrono::steady_clock::now().time_since_epoch().count())
#define FIO ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);

void dbg_out() { cerr << endl; }
template<typename Head, typename... Tail> void dbg_out(Head H, Tail... T) { cerr << ' ' << H; dbg_out(T...); }
#define dbg(...) cerr << "(" << #__VA_ARGS__ << "):", dbg_out(__VA_ARGS__)

const int MOD = 1e9+7;
const ll INF = 1e15;

int main() {
	FIO;

    //start here

	int a, b, c;
	cin>>a>>b>>c;

	cout<<(7-a)+(7-b)+(7-c);

    //end here

    return 0;
}

//----AUTHOR:kkdrummer----/
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
//#include <boost/multiprecision/cpp_int.hpp>
//using namespace boost::multiprecision;
using namespace __gnu_pbds;
using namespace std;
typedef    long long                     ll;
typedef    long double                   ld;
typedef    unordered_set<ll>              usll;
typedef    unordered_multiset<ll>         umsll;
typedef    multiset<ll>                   msll;
typedef    set<ll>                       sll;
typedef    vector<ll>                    vll;
typedef    pair<ll,ll>                   pll;
typedef    vector<pll>                   vpll;
typedef    priority_queue<ll>            pqll;
typedef    vector<int>                   vi;
typedef    set<int>                      si;
typedef    multiset<int>                 msi;
typedef    unordered_multiset<int>       umsi;
typedef    unordered_set<int>            usi;
typedef    pair<int,int>                    pi;
typedef    vector<pi>                     vpi;
typedef    priority_queue<int>            pqi;
typedef    tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update>   ind_si;
typedef    tree<ll,null_type,less<ll>,rb_tree_tag,tree_order_statistics_node_update>   ind_sll;
typedef    tree<int,null_type,less_equal<int>,rb_tree_tag,tree_order_statistics_node_update>   ind_msi;
typedef    tree<ll,null_type,less_equal<ll>,rb_tree_tag,tree_order_statistics_node_update>   ind_msll;
#define    in                  insert
#define    fi                  first
#define    se                  second
#define    pb                  push_back
#define    mp                  make_pair
#define    be                  begin
#define    en                  end
#define    itr                 iterator
#define    io                  ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define    mo                  1000000007
#define    inf                 8222372026854775807
#define    ninf                  -inf
#define    ima                  2047483647
#define    imi                  -ima
#define    oncnt               __builtin_popcount
#define    zerobegin           __builtin_clz
#define    zeroend            __builtin_ctz
#define    parity              __builtin_parity
#define    eps                 1e-9
#define    coutd               cout<<setprecision(10)<<fixed
#define    mems(dp,x)          memset(dp,x,sizeof(dp))
#define    fbo                 find_by_order
#define    ook                   order_of_key
#define    all(x)              x.be(),x.en()
#define    upb                   upper_bound
#define    lowb                 lower_bound
#define    lte(v,x)            (upb(all(v),x)-v.be())
#define    gte(v,x)            (v.end()-lowb(all(v),x))
#define    gt(v,x)             (v.en()-upb(all(v),x))
#define    lt(v,x)             (lowb(all(v),x)-v.be())
const      ld PI=             3.1415926535897932384626433832792884197169399375105820974944;
inline ll mpow(ll x,ll n){if(n==0)return 1;if(x==0)return 0;if(n==1)return(x%mo);ll u=(mpow(x,n/2));u=(u*u)%mo;if(n%2!=0)u=(u*x%mo)%mo;return u;}
inline ll minv(ll x){return mpow(x,mo-2);}
inline ll mmul(ll a,ll b){if(a>=mo)a=a%mo;if(b>=mo)b=b%mo;if(a*b>=mo)return(a*b)%mo;return(a*b);}
inline ll madd(ll a, ll b){if(a>=mo)a=a%mo;if(b>=mo)b=b%mo;if(a+b>=mo)return(a+b)%mo;return(a+b);}
inline ll msub(ll a, ll b){if(a>=mo)a=a%mo;if(b>=mo)b=b%mo;return(((a-b)%mo+mo)%mo);}
inline ll mdiv(ll a,ll bb){if(a>=mo)a=a%mo;ll b=minv(bb);if(b>=mo)b=b%mo;if(a*b>=mo)return(a*b)%mo;return(a*b);}
inline ll gcd(ll a,ll b){return __gcd(a,b);}
inline ll lcm(ll a,ll b){return (a*b)/gcd(a,b);}
// printf("%.0Lf",ans); // for printing 10^19 order ld numbers

int main()
{              io
int testcases=1;         //         cin>>testcases;
while(testcases--)
{

int a,b,c;
cin>>a>>b>>c;
cout<<21-a-b-c;

}return 0;}


#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i = 0; i < (int)(n); i++)
typedef long long  ll;
const int INF = 1000100;
const ll mod=1e9+7;
typedef pair<int,int> P;
const double pi=acos(-1);
int main() {
  int n;
  cin>>n;
  vector<ll> a(n);
  rep(i,n)cin>>a[i];
  ll ans=1e17;
  rep(i,1<<(n-1)){
      ll o=a[0];
      ll x=0;
      rep(j,n-1){
          if(i>>j&1){
              o|=a[j+1];
          }
          else {
              x^=o;
              o=a[j+1];
          }
      }
      x^=o;
      ans=min(ans,x);
  }
  cout<<ans<<endl;
}

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

int main(){
  int N;
  cin >> N;
  vector<int> A(N);
  for(int i=0;i<N;i++) cin >> A[i];
  vector<int> pow2(31,1);
  for(int i=1;i<=30;i++) pow2[i] = pow2[i-1] * 2;

  int ans = pow2[30];
  for(int i=0;i<(1<<(N-1));i++){
    bitset<20> B(i);
    vector<int> XOR(30,0), nowOR(30,0);
    for(int j=0;j<N;j++){
      for(int k=0;k<30;k++){
        if((A[j]/pow2[k])%2 == 1) nowOR[k] = 1;
      }
      if(B.test(j)){
        for(int k=0;k<30;k++){
          if((nowOR[k]+XOR[k])%2==1) XOR[k] = 1;
          else XOR[k] = 0;
          nowOR[k] = 0;
        }
      }
    }
    for(int k=0;k<30;k++){
      if((nowOR[k]+XOR[k])%2==1) XOR[k] = 1;
      else XOR[k] = 0;
      nowOR[k] = 0;
    }
    int score = 0;
    for(int k=0;k<30;k++){
      if(XOR[k]==1) score += pow2[k];
    }
    ans = min(ans,score);
  }

  cout << ans << endl;
  return 0;
}


#include <bits/stdc++.h>
using namespace std;
//#include <atcoder/all>
//using namespace atcoder;
#define rep(i,n) for(int i = 0; i < (n); i++)
using ll = long long;
using P = pair<int,int>;
#define ALL(a) (a).begin(),(a).end()

int main(){
    string n;
    cin >> n;
    while(true){
        if(n.back() == '0'){
            int len = n.size();
            n.erase(len-1,1);
        }
        else break;
    }
    int len = n.size();
    bool ok = true;
    rep(i,len/2){
        if(n[i] != n[len - i - 1]){
            ok = false;
        }
    }
    if(ok) cout << "Yes" << endl;
    else cout << "No" << endl;
}

#include<bits/stdc++.h>
#include<algorithm>
#include<cmath>
#include<climits>
using namespace std;
typedef long long int lli;
typedef vector<int> vi;
typedef vector<long long int> vlli;
typedef pair<int,int> pii;
typedef pair<long long int,long long int> plli;
typedef vector< vi > vvi ;
typedef vector< vlli > vvlli  ;
#define fi(i,a,b) for(int i=a;i<=b;i++)
#define flli(i,a,b) for(long long int i=a;i<=b;i++)
#define bi(i,a,b) for(int i=a;i>=b;i--)
#define blli(i,a,b) for(long long int i=a;i>=b;i--)
#define fast ios_base::sync_with_stdio(false),cin.tie(NULL),cout.tie(NULL)
#define all(x) x.begin(),x.end()
#define sz(x) x.size()
#define pi 2*acos(0.0)
#define pb push_back
#define tr(v,it) for(decltype(v.begin()) it=v.begin();it!=v.end();it++)
#define present(v,num) (v.find(num)!=v.end())
#define cpresent(v,num) (find(v.begin(),v.end(),num)!=v.end())
#define pq priority_queue
#define mp make_pair
const int inf=INT_MAX;
const lli INF =LLONG_MAX;
const lli mod = 1e9+7;
int main() {
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif
    fast;
    lli n;cin>>n;
    vlli digs;
    bool flag=false;
    while(n>0)
    {
    	int temp=n%10;
    	n=n/10;
    	if(temp==0 && !flag)continue;
    	flag=true;
    	digs.pb(temp);
    }
    int l=0,r=sz(digs)-1;
    bool ans=true;
    while(l<r)
    {
    	if(digs[l]!=digs[r])ans=false;
    	l++;
    	r--;
    }
    if(ans)cout<<"Yes\n";
    else cout<<"No\n";
    cerr << "Time : " << 1000 * ((double)clock()) / (double)CLOCKS_PER_SEC << "ms\n";
    return 0;
}


#include <algorithm>
#include <iomanip>
#include <array>
#include <bitset>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <deque>
#include <functional>
#include <iostream>
#include <iterator>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <sstream>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <numeric>
#include <vector>
using namespace std;
#if __has_include(<atcoder/all>)
#include <atcoder/all>
using namespace atcoder;
#endif
#define GET_MACRO(_1, _2, _3, NAME, ...) NAME
#define _rep(i, n) _rep2(i, 0, n)
#define _rep2(i, a, b) for(int i = (int)(a); i < (int)(b); i++)
#define rep(...) GET_MACRO(__VA_ARGS__, _rep2, _rep)(__VA_ARGS__)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
using i64 = long long;
template<class T, class U>
bool chmin(T& a, const U& b) { return (b < a) ? (a = b, true) : false; }
template<class T, class U>
bool chmax(T& a, const U& b) { return (b > a) ? (a = b, true) : false; }

template<typename T>istream& operator>>(istream&i,vector<T>&v){rep(j,v.size())i>>v[j];return i;}
template<typename T>string join(vector<T>&v){stringstream s;rep(i,v.size())s<<' '<<v[i];return s.str().substr(1);}
template<typename T>ostream& operator<<(ostream&o,vector<T>&v){if(v.size())o<<join(v);return o;}
template<typename T>string join(vector<vector<T>>&vv){string s="\n";rep(i,vv.size())s+=join(vv[i])+"\n";return s;}
template<typename T>ostream& operator<<(ostream&o,vector<vector<T>>&vv){if(vv.size())o<<join(vv);return o;}
template<class T> using pq = priority_queue<T, vector<T>, greater<T>>;

struct C
{
    int x, y;
    C(int x = 0, int y = 0) : x(x), y(y) {}
    C operator*(const C& a) const {
        return C(x * a.x - y * a.y, x * a.y + y * a.x);
    }
    C operator-(const C& a) const {
        return C(x - a.x, y - a.y);
    }
    bool operator<(const C& a) const {
        if (x == a.x) return y < a.y;
        return x < a.x;
    };
    bool operator==(const C& a) const {
        return x == a.x && y == a.y;
    };
    int norm() const { return x*x + y*y;}
};

int main()
{
    int n;
    cin >> n;
    vector<C> a(n), b(n);
    rep(i, n) {
        int x,y;
        cin >> x >> y;
        a[i] = C(x, y);
    }
    rep(i, n) {
        int x, y;
        cin >> x >> y;
        b[i] = C(x, y);
    }

    if(n == 1) {
        cout << "Yes" << endl;
        return 0;
    }

    rep(i, n) {
        rep(j, n) {
            // a[0] -> b[i]
            // a[1] -> b[j]
            if(i == j) continue;
            if((a[1] - a[0]).norm() != (b[j] - b[i]).norm()) continue; // 長さが違えばアウト

            auto f = [&](vector<C> p, C o, C r) {
                rep(i, n) p[i] = p[i] - o; // 平衡移動
                rep(i, n) p[i] = p[i] * r; // 回転
                sort(p.begin(), p.end());
                return p;
            };
            vector<C> na = f(a, a[0], b[j] - b[i]); // a[0] を原点にして，回転
            vector<C> nb = f(b, b[i], a[1] - a[0]); // a[0] を原点にして，回転
            if(na == nb) {
                cout << "Yes" << endl;
                return 0;
            }
        }
    }

    cout << "No" << endl;

    return 0;
}

#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
#define mp make_pair
#define pb push_back
#define fi first
#define se second
#define sz(x) int(x.size())
const int mod = 1e9 + 7;
const int inf = 2e9 + 5;
const ll linf = 9e18 + 5;
const ll ll0 = 0 * 1ll;

int n;
const int N = 1e2 + 5;
ll arr[N][2];
ll equi[2];

ll arr2[N][2];
ll equi2[2];

pair<ll, ll> iden[N];
pair<ll, ll> examp[N];

ll cross (int i) {
    pair<ll, ll> v1 = mp(arr[0][0] - equi[0], arr[0][1] - equi[1]);
    pair<ll, ll> v2 = mp(arr[i][0] - equi[0], arr[i][1] - equi[1]);

    return v1.fi * v2.se - v1.se * v2.fi;
}
ll cross2 (int i, int c) {
    pair<ll, ll> v1 = mp(arr2[c][0] - equi2[0], arr2[c][1] - equi2[1]);
    pair<ll, ll> v2 = mp(arr2[i][0] - equi2[0], arr2[i][1] - equi2[1]);

    return v1.fi * v2.se - v1.se * v2.fi;
}

ll dist (int i) {
    ll ans = (equi[0] - arr[i][0]) * (equi[0] - arr[i][0]);
    ans += (equi[1] - arr[i][1]) * (equi[1] - arr[i][1]);

    return ans;
}

ll dist2 (int i) {
    ll ans = (equi2[0] - arr2[i][0]) * (equi2[0] - arr2[i][0]);
    ans += (equi2[1] - arr2[i][1]) * (equi2[1] - arr2[i][1]);

    return ans;
}

void init () {
}

void input () {
    cin >> n;

    for (int i = 0; i < n; i++) {
        cin >> arr[i][0] >> arr[i][1];

        equi[0] += arr[i][0];
        equi[1] += arr[i][1];

        arr[i][0] *= n;
        arr[i][1] *= n;
    }
    for (int i = 0; i < n; i++) {
        cin >> arr2[i][0] >> arr2[i][1];

        equi2[0] += arr2[i][0];
        equi2[1] += arr2[i][1];

        arr2[i][0] *= n;
        arr2[i][1] *= n;
    }

    for (int i = 0; i < n; i++) {
        ll d = dist(i);

        iden[i] = mp(cross(i), d);
    }

    sort(iden, iden + n);
}

void create_with(int ind) {
    for (int i = ind; i < ind + n; i++) {
        int j = i % n;

        ll d = dist2(j);

        examp[j] = mp(cross2(j, ind), d);
    }

    sort(examp, examp + n);
}

void solve() {
    for (int i = 0; i < n; i++) {
        create_with(i);

        bool good = true;

        for (int i = 0; i < n; i++) {
            if (examp[i] != iden[i]) {
                good = false;
                break;
            }
        }

        if (good) {
            cout << "Yes";
            return;
        }
    }

    cout << "No";
}

void output() {
}

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);

    int number_of_testcases = 1;
    //cin >> number_of_testcases;
    while (number_of_testcases--) {
        init();

        input();

        solve();

        output();
    }

    return 0;
}


/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author tatsumack
 */

#include <iostream>
#include <fstream>

#include <bits/stdc++.h>

#define int long long
#define REP(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i)
#define FOR(i, a, b) for (int i = (a), i##_len = (b); i <= i##_len; ++i)
#define REV(i, a, b) for (int i = (a); i >= (b); --i)
#define CLR(a, b) memset((a), (b), sizeof(a))
#define DUMP(x) cout << #x << " = " << (x) << endl;
#define INF 1001001001001001001ll
#define fcout cout << fixed << setprecision(12)

using namespace std;

// 約数列挙
vector<int> get(int n) {
    vector<int> ret;
    for (int i = 1; i * i <= n; ++i) {
        if (n % i == 0) {
            ret.push_back(i);
            if (i * i != n) {
                ret.push_back(n / i);
            }
        }
    }
    return ret;
}

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

class FGCDOrMIN {
public:
    void solve(std::istream& cin, std::ostream& cout) {
        int N;
        cin >> N;
        vector<int> A(N);
        REP(i, N) cin >> A[i];

        int mina = INF;
        map<int, int> m;
        REP(i, N) {
            for (auto n : get(A[i])) {
                if (m.count(n) == 0) {
                    m[n] = A[i];
                } else {
                    m[n] = gcd(m[n], A[i]);
                }
            }
            mina = min(mina, A[i]);
        }
        int res = 0;
        for (auto kv : m) {
            if (kv.second <= mina && kv.first == kv.second) {
                res++;
            }
        }
        cout << res << endl;
    }
};

signed main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    std::istream& in(std::cin);
    std::ostream& out(std::cout);

    FGCDOrMIN solver;
    solver.solve(in, out);
    return 0;
}

#include <bits/stdc++.h>
#include <map>
#include <algorithm>
#include <vector>
#include <string.h>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <chrono>
#include <thread>
#include <iomanip>
#include <typeinfo>

//define
#define trav(i,v)   for(auto i: v)
#define rep(i,n)    for(int i=0;i<n;i++)
#define repu(i,k,n) for(int i=k;i<=n;i++)
#define repd(i,k,n) for(int i=k;i>=n;i--)
#define se second
#define fi first
#define pb push_back
#define mp make_pair
#define all(v)  v.begin(), v.end()
#define itn int

//typedef
typedef long long int ll;
typedef unsigned long long int ull;
typedef long double ld;
typedef std::pair<int, int> pii;
typedef std::vector<int> vi;
typedef std::vector< pii > vii;
typedef std::vector< ll > vll;
typedef std::vector< std::pair < pii, int > > vpp;

const long long MOD = 1000000007;
// const long long MOD = 998244353;
const long long inf = 1000000000000000000;

using namespace std;

ll modpow(ll x,ll n){
    ll res=1;
    while(n>0){
        if(n&1) res=res*x%MOD;
        x=x*x%MOD;
        n>>=1;
    }
    return res;
}

ll power(ll x, ll n)
{
    ll res=1;
    while(n>0){
        if(n&1) res=res*x;
        x=x*x;
        n>>=1;
    }
    return res;
}

void init()
{

}

void solve()
{
    int n, m;
    cin>>n>>m;
    vll a(n+1);
    repu(i,1,n)
        cin>>a[i];
    vi v[n+1], vv[n+1];
    vi in(n+1,0), out(n+1,0);
    rep(i,m)
    {
        int x, y;
        cin>>x>>y;
        in[y]++;
        out[x]++;
        v[x].pb(y);
        vv[y].pb(x);
    }
    vll v1(n+1,inf), v2(n+1,0);
    repu(i,1,n)
    {
        v1[i] = inf;
        v2[i] = a[i];
    }
    vi vis(n+1,0);
    set<int> s;
    repu(i,1,n)
    {
        if(in[i]==0)
        {
            s.insert(i);
            v1[i] = inf;
        }
    }
    while(!s.empty())
    {
        int x = *s.begin();
        if(vis[x])
            continue;
        vis[x] = 1;
        s.erase(s.begin());
        trav(y,v[x])
        {
            s.insert(y);
            v1[y] = min(v1[y],min(v1[x],a[x]));
        }
    }
    // cout<<v1[3]<<" "<<v2[3]<<endl;

    ll ans = -inf;
    repu(i,1,n)
    {
        ans = max(v2[i]-v1[i],ans);
    }
    cout<<ans<<endl;
}

int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(NULL);
    int t = 1, tt=1;
    // cin>>t;
    init();
    while(tt<=t)
    {
        // cout<<"Case #"<<tt<<": ";
        solve();
        tt++;
    }
    cerr << "Time : " << 1000 * ((double)clock()) / (double)CLOCKS_PER_SEC << "ms\n";
}


#include <bits/stdc++.h>
using namespace std;
#define endl ("\n")
#define int long long
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define all(c) c.begin(), c.end()
#define rep(i,n) for(int i=0;i<n;i++)
#define fast ios_base::sync_with_stdio(false), cin.tie(nullptr), cout.tie(nullptr);

int32_t main(){
    fast
    int t=1;
    // cin>>t;
    while(t--){
        int n;cin>>n;int a[n], b[n], c[n];rep(i, n)cin>>a[i];rep(i, n)cin>>b[i];rep(i, n)cin>>c[i];
        map<int, int>m1, m2;
        set<int>s;
        rep(i, n)m1[a[i]]++, s.insert(a[i]);
        rep(i, n)m2[b[c[i]-1]]++;
        int ans=0;
        for(auto i:s){
            ans+=(m1[i]* m2[i]);
        }
        cout<<ans<<endl;
    }
    return 0;
}

#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;

int main() {
    int N;
    cin >> N;
    vector<int> A(N), B(N), C(N), BC(N), count(N+1);
    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++) cin >> C[i];

    for (int j=0; j<N; j++) {
        BC[j] = B[C[j]-1];
        count[BC[j]]++;
    }

    long long answer = 0;
    for (int a : A) {
        answer += count[a];
    }
    cout << answer << endl;
    return 0;
}


#include <iostream>

namespace wxy{
    const int mod = 998244353;
    int f[15][5050],fac[5050],invfac[5050];
    inline void init(){
        fac[0]=invfac[0]=invfac[1]=1;
        for(int i=1;i<=5000;i++)fac[i]=(long long)fac[i-1]*i%mod;
        for(int i=2;i<=5000;i++)invfac[i]=(long long)(mod-mod/i)*invfac[mod%i]%mod;
        for(int i=2;i<=5000;i++)invfac[i]=(long long)invfac[i-1]*invfac[i]%mod;
    }
    inline int C(int n,int m){return n<m?0:(long long)fac[n]*invfac[m]%mod*invfac[n-m]%mod;}
    inline void main(){
        int n,m; std::cin >> n >> m; init();
        if (m % 2 == 1) {std::cout << 0; return;}
        int limit = 1,t = 0;
        while (limit < m) {limit <<= 1; t++;}
        for (int k = 0; 2 * k <= n; k++) f[0][2 * k] = C(n,2 * k);
        int ans = 0;
        for (int i = 1; i <= t; i++){
            f[i][0] = 1;
            for(int j = 1; j <= m; j++){
                if (j % 2 == 1) continue;
                for (int k = 0; 2 * k <= n && j - (2 * k) * (1 << i) >= 0; k++)
                    f[i][j] = (f[i][j] + 1ll * C(n,2 * k) * f[i - 1][j - (2 * k) * (1 << i)] % mod) % mod;
            }
        }
        std::cout << f[t][m];
    }
}signed main(){wxy::main(); return 0;}

#include <bits/stdc++.h>
#define lc (o<<1)
#define rc ((o<<1)|1)
#define PB push_back
#define MK make_pair
using namespace std;
#define DebugP(x) cout << "Line" << __LINE__ << " " << #x << "=" << x << endl

const int maxn = 5000 + 5;
const int modu = 998244353; // 1e9 + 7
const int inf = 0x3f3f3f3f;
const double eps = 1e-5;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};

typedef long long LL;

void read(LL &x)
{
    x=0;int f=0;char ch=getchar();
    while(ch<'0'||ch>'9')  {f|=(ch=='-');ch=getchar();}
    while(ch>='0'&&ch<='9'){x=(x<<1)+(x<<3)+(ch^48);ch=getchar();}
    x=f?-x:x;
    return;
}

void read(int &x) { LL y; read(y); x = (int)y; }
void read(char &ch) { char s[3]; scanf("%s", s); ch = s[0]; }
void read(char *s) { scanf("%s", s); }
template<class T, class ...U> void read(T &x, U& ... u) { read(x); read(u...); }

int n, m;
int a[maxn];
LL inv[maxn], c[maxn], f[20][maxn];
int b[20];

int main() {
    // freopen("my.txt", "w", stdout);
    read(n, m);
    inv[1] = 1;
    for (int i = 2; i <= n; ++i)
        inv[i] = (modu - (modu/i))*inv[modu%i]%modu;
    c[0] = 1;
    for (int i = 1; i <= n; ++i)
        c[i] = (n-i+1)*inv[i]%modu*c[i-1]%modu;
    int nb = 0;
    while (m) {
        b[nb++] = m%2;
        m /= 2;
    }
    memset(f, 0, sizeof(f));
    f[nb-1][0] = 1;
    int tot = b[nb-1];
    for (int i = nb-2; i >= 0; --i) {
        for (int j = 0; j <= tot*2 + b[i]; ++j) if (j%2 == 0) {
            for (int k = 0; k <= j && k <= n; k += 2)
                f[i][j] = (f[i][j] + f[i+1][(j-k)/2]*c[k]) % modu;
        }
        tot = tot*2 + b[i];
    }
    printf("%lld\n", f[0][tot]);
	return 0;
}


#include <bits/stdc++.h>
#include <map>
#include <algorithm>
#include <vector>
#include <string.h>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <chrono>
#include <thread>
#include <iomanip>
#include <typeinfo>

//define
#define trav(i,v)   for(auto i: v)
#define rep(i,n)    for(int i=0;i<n;i++)
#define repu(i,k,n) for(int i=k;i<=n;i++)
#define repd(i,k,n) for(int i=k;i>=n;i--)
#define se second
#define fi first
#define pb push_back
#define mp make_pair
#define all(v)  v.begin(), v.end()
#define itn int

//typedef
typedef long long int ll;
typedef unsigned long long int ull;
typedef long double ld;
typedef std::pair<int, int> pii;
typedef std::vector<int> vi;
typedef std::vector< pii > vii;
typedef std::vector< ll > vll;
typedef std::vector< std::pair < pii, int > > vpp;

// const long long MOD = 1000000007;
const long long MOD = 998244353;
const long long inf = 1000000000000000000;

using namespace std;

ll modpow(ll x,ll n){
    ll res=1;
    while(n>0){
        if(n&1) res=res*x%MOD;
        x=x*x%MOD;
        n>>=1;
    }
    return res;
}

ll power(ll x, ll n)
{
    ll res=1;
    while(n>0){
        if(n&1) res=res*x;
        x=x*x;
        n>>=1;
    }
    return res;
}

void solve()
{
    ll a, b, c;
    cin>>a>>b>>c;
    ll x=1;
    x*=a;
    x%=MOD;
    x*=(a+1);
    x%=MOD;
    x*=modpow(2,MOD-2);
    x%=MOD;
    a=b;
    x*=a;
    x%=MOD;
    x*=(a+1);
    x%=MOD;
    x*=modpow(2,MOD-2);
    x%=MOD;
    a=c;
    x*=a;
    x%=MOD;
    x*=(a+1);
    x%=MOD;
    x*=modpow(2,MOD-2);
    x%=MOD;
    cout<<x<<endl;
}

int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(NULL);
    int t = 1, tt=1;
    // cin>>t;
    while(tt<=t)
    {
        // cout<<"Case #"<<tt<<": ";
        solve();
        tt++;
    }
    cerr << "Time : " << 1000 * ((double)clock()) / (double)CLOCKS_PER_SEC << "ms\n";
}

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
#define endl '\n'
#define all(x) (x).begin(),(x).end()
const int INF=1000000000+5;
const int N=300+5;
const ll oo=1e18+5;
const ll mod=998244353;

ll inv2;

ll mul(ll a, ll b){
	return a*b%mod;
}

ll poww(ll a,ll b){
	ll r=1;
	while(b){
		if(b&1) r=mul(r,a);
		a=mul(a,a);
		b>>=1;
	}
	return r;
}

ll sum(ll x){
	return mul(x,mul(x+1,inv2));
}

int main(){
	ios::sync_with_stdio(0); cin.tie(0);
	ll a,b,c;
	cin>>a>>b>>c;
	inv2=poww(2ll,mod-2);
	cout<<mul(sum(a),mul(sum(b),sum(c)));
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
void __print(int x) {cout << x;}void __print(long x) {cout << x;}void __print(long long x) {cout << x;}void __print(unsigned x) {cout << x;}void __print(unsigned long x) {cout << x;}void __print(unsigned long long x) {cout << x;}void __print(float x) {cout << x;}void __print(double x) {cout << x;}void __print(long double x) {cout << x;}void __print(char x) {cout << '\'' << x << '\'';}void __print(const char *x) {cout << '\"' << x << '\"';}void __print(const string &x) {cout << '\"' << x << '\"';}void __print(bool x) {cout << (x ? "true" : "false");}
template<typename T, typename V>
void __print(const pair<T, V> &x) {cout << '{'; __print(x.first); cout << ','; __print(x.second); cout << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cout << '{'; for (auto &i: x) cout << (f++ ? "," : ""), __print(i); cout << "}";}
void _print() {cout << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cout << ", "; _print(v...);}
#ifndef ONLINE_JUDGE
#define debug(x...) cout << "[" << #x << "] = ["; _print(x)
#else
#define debug(x...)
#endif

#define IOS             ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define loop(i,a,b)     for (ll i = a; i <= (long long)b; i++)
#define rloop(i,a,b)    for (ll i = a; i >= (long long)b; i--)
#define ms(a,x)         memset(a,x,sizeof a)
#define ll              long long int
#define ff              first
#define ss              second
#define all(a)          a.begin(),a.end()
#define rall(a)         a.rbegin(),a.rend()
#define pb              push_back
#define nl              cout<<"\n"
#define gcd(a,b)        __gcd((a),(b))
#define lcm(a,b)        ((a)*(b))/(gcd(a,b))
#define sq(a)           ((a)*(a))
#define sz(a)           a.size()
#define mod             1000000007
#define PI              (2*acos(0.0))

int main()
{
    IOS
    int T=1;
    //cin>>T;
    while(T--)
    {
      ll n;
      cin>>n;
      std::vector<ll> a(n),b(n),c(n),d(n),e(n);
      loop(i,0,n-1) cin>>a[i];
      b[0]=a[0];
      loop(i,1,n-1) b[i]=a[i]+b[i-1];
      e[0]=b[0];
      loop(i,1,n-1) e[i]=e[i-1]+b[i];
      ll mx=0;
      loop(i,0,n-1)
      {
      	mx=max(mx,b[i]);
      	c[i]=mx;
      }
      // debug(b);
      // debug(c);
      d[0]=max(0LL,a[0]);
      ll ans=max(0LL,d[0]);
      loop(i,1,n-1)
      {
      	d[i]=e[i-1]+c[i];
      	ans=max(ans,d[i]);
      }
      //debug(d);
      cout<<ans;
    }
    return 0;
}

#include <iostream>
#include <algorithm>       // for next_permutation
#include <vector>
#include <bits/stl_numeric.h>
#include <queue>
#include <regex>

#define DEBUG 0
#define REP(i, n) for (long long i = 0; i < (n); i++)
typedef long long ll;
static const ll MOD = 1000000007;
static const ll INF = 1000000000000000000LL;
using namespace std;

int main() {
    int N;
    cin >> N;

    vector <ll> a(N);
    vector <ll> ido(N,0);
    vector <ll> syunkan(N,0);

    ll wawa = 0;

    REP(i,N)cin >> a[i];
    ido[0] = a[0];
    syunkan[0] = max(0LL,a[0]);
    for(int i = 1; i < N; ++i)
    {
        ido[i] = ido[i-1] + a[i];
        syunkan[i] = max(syunkan[i-1],ido[i-1] + a[i]);
    }

    ll res = 0;
    ll x = 0;
    x += a[0];
    res = max(res,x);
    for(int i = 1; i < N; ++i)
    {
        res = max(res, x + syunkan[i]);
        x = x + ido[i];
    }

    cout << res << endl;

    return 0;
}


/* @author: saran
 * Git: https://github.com/abhisheksaran
 * LinkedIn: https://www.linkedin.com/in/abhishek-saran-2900b/
 */

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

typedef long long LL;
typedef pair<int, int> pii;
typedef pair<LL, LL> pll;
typedef pair<string, string> pss;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<pii> vii;
typedef vector<LL> vl;
typedef vector<vl> vvl;

double EPS = 1e-9;
int INF = 1000000005;
long long INFF = 1000000000000000005LL;
double PI = acos(-1);
int dirx[8] = { -1, 0, 0, 1, -1, -1, 1, 1 };
int diry[8] = { 0, 1, -1, 0, -1, 1, -1, 1 };

#ifdef TESTING
#define DEBUG fprintf(stderr, "====TESTING====\n")
#define VALUE(x) cerr << "The value of " << #x << " is " << x << endl
#define debug(...) fprintf(stderr, __VA_ARGS__)
#else
#define DEBUG
#define VALUE(x)
#define debug(...)
#endif

#define FOR(a, b, c) for (int(a) = (b); (a) < (c); ++(a))
#define FORN(a, b, c) for (int(a) = (b); (a) <= (c); ++(a))
#define FORD(a, b, c) for (int(a) = (b); (a) >= (c); --(a))
#define FORSQ(a, b, c) for (int(a) = (b); (a) * (a) <= (c); ++(a))
#define FORC(a, b, c) for (char(a) = (b); (a) <= (c); ++(a))
#define FOREACH(a, b) for (auto&(a) : (b))
#define REP(i, n) FOR(i, 0, n)
#define REPN(i, n) FORN(i, 1, n)
#define MAX(a, b) a = max(a, b)
#define MIN(a, b) a = min(a, b)
#define SQR(x) ((LL)(x) * (x))
#define RESET(a, b) memset(a, b, sizeof(a))
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define ALL(v) v.begin(), v.end()
#define ALLA(arr, sz) arr, arr + sz
#define SIZE(v) (int)v.size()
#define SORT(v) sort(ALL(v))
#define REVERSE(v) reverse(ALL(v))
#define SORTA(arr, sz) sort(ALLA(arr, sz))
#define REVERSEA(arr, sz) reverse(ALLA(arr, sz))
#define PERMUTE next_permutation
#define TC(t) while (t--)

inline string IntToString(LL a)
{
    char x[100];
    sprintf(x, "%lld", a);
    string s = x;
    return s;
}

inline LL StringToInt(string a)
{
    char x[100];
    LL res;
    strcpy(x, a.c_str());
    sscanf(x, "%lld", &res);
    return res;
}

inline string GetString(void)
{
    char x[1000005];
    scanf("%s", x);
    string s = x;
    return s;
}

inline string uppercase(string s)
{
    int n = SIZE(s);
    REP(i, n)
    if (s[i] >= 'a' && s[i] <= 'z')
        s[i] = s[i] - 'a' + 'A';
    return s;
}

inline string lowercase(string s)
{
    int n = SIZE(s);
    REP(i, n)
    if (s[i] >= 'A' && s[i] <= 'Z')
        s[i] = s[i] - 'A' + 'a';
    return s;
}

inline void OPEN(string s)
{
#ifndef TESTING
    freopen((s + ".in").c_str(), "r", stdin);
    freopen((s + ".out").c_str(), "w", stdout);
#endif
}

int main(){
	ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int t,i;
  int ans = 0;
  cin>>t;
  REP(i,t){
    int x;
    cin>>x;
    ans += max(0, x-10);
  }
  cout<<ans;
	return 0;
}

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

#define endl "\n"
const int N = 1e5 + 5;
typedef long long LL;

int main() {
    #ifdef LOCAL
        //freopen("input.txt", "r", stdin);
    #endif
    ios_base::sync_with_stdio(false); cin.tie(0);
    int n;
    cin >> n;
    map <int,int> cnt;
    for (int i = 1; i <= n; i++) {
        int x;
        cin >> x;
        for (int j = 1; j * j <= x; j++) {
            if (x % j == 0) {
                cnt[j]++;
                if (x / j != j) cnt[x / j]++;
            }
        }
    }
    int ans = 0, mx = 0;
    for (auto x: cnt) {
        if (x.first == 1) continue;
        if (x.second > mx) mx = x.second, ans = x.first;
    }
    cout << ans << endl;
    return 0;
}


#pragma GCC optimize("Ofast")
#define _USE_MATH_DEFINES
#include "bits/stdc++.h"

using namespace std;

using ll = int64_t;
using db = double;
using ld = long double;
using vi = vector<int>;
using vl = vector<ll>;
using vvi = vector<vector<int>>;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using vpii = vector<pii>;
using vpll = vector<pll>;

constexpr char newl = '\n';
constexpr double eps = 1e-10;

#define FOR(i,a,b) for (int i = (a); i < (b); i++)
#define F0R(i,b) FOR(i,0,b)
#define RFO(i,a,b) for (int i = ((b)-1); i >=(a); i--)
#define RF0(i,b) RFO(i,0,b)
#define show(x) cout << #x << " = " << x << '\n';
#define rng(a) a.begin(),a.end()
#define rrng(a) a.rbegin(),a.rend()
#define sz(x) (int)(x).size()
#define YesNo {cout<<"Yes";}else{cout<<"No";}
#define YESNO {cout<<"YES";}else{cout<<"NO";}
#define v(T) vector<T>
#define vv(T) vector<vector<T>>

template<typename T1, typename T2> inline void chmin(T1& a, T2 b) { if (a > b) a = b; }
template<typename T1, typename T2> inline void chmax(T1& a, T2 b) { if (a < b) a = b; }
template<class T> bool lcmp(const pair<T, T>& l, const pair<T, T>& r) {
  return l.first < r.first;
}
template<class T> istream& operator>>(istream& i, v(T)& v) {
  F0R(j, sz(v)) i >> v[j];
  return i;
}
template<class A, class B> istream& operator>>(istream& i, pair<A, B>& p) {
  return i >> p.first >> p.second;
}
template<class A, class B, class C> istream& operator>>(istream& i, tuple<A, B, C>& t) {
  return i >> get<0>(t) >> get<1>(t) >> get<2>(t);
}
template<class T> ostream& operator<<(ostream& o, const pair<T, T>& v) {
  o << "(" << v.first << "," << v.second << ")";
  return o;
}
template<class T> ostream& operator<<(ostream& o, const vector<T>& v) {
  F0R(i, v.size()) {
    o << v[i] << ' ';
  }
  o << newl;
  return o;
}
template<class T> ostream& operator<<(ostream& o, const set<T>& v) {
  for (auto e : v) {
    o << e << ' ';
  }
  o << newl;
  return o;
}
template<class T1, class T2> ostream& operator<<(ostream& o, const map<T1, T2>& m) {
  for (auto& p : m) {
    o << p.first << ": " << p.second << newl;
  }
  o << newl;
  return o;
}

#if 1

// INSERT ABOVE HERE
signed main() {
  cin.tie(0);
  ios_base::sync_with_stdio(false);

  int N, M; cin >> N >> M;
  ll a = 0, b = 0;
  F0R(i, N) {
    string s; cin >> s;
    int c = 0;
    F0R(i, M) {
      c += s[i] == '1';
    }
    (c & 1) ? a++ : b++;
  }
  cout << (a * b) << newl;
}
#endif

#include<bits/stdc++.h>

#include <ext/pb_ds/assoc_container.hpp> // Common file
#include <ext/pb_ds/tree_policy.hpp> // Including tree_order_statistics_node_update
using namespace __gnu_pbds;
using namespace std;

typedef long long ll;
typedef pair<int, int> pii;
typedef long double ld;
typedef tree<pii,null_type,less<>,rb_tree_tag,tree_order_statistics_node_update> ordered_set;

#define F first
#define S second

const int MOD = 1e9 + 7;//XXX
const int C = 26;//XXX

void add(int &x, int y){
	x += y;
	while (x >= MOD) x -= MOD;
	while (x < 0) x += MOD;
}

int fix(int x){
	while (x >= MOD) x -= MOD;
	while (x < 0) x += MOD;
	return x;
}

int pw(int a, int b){
	int ret = 1;
	while (b){
		if (b & 1)
			ret = 1ll*ret*a%MOD;
		b >>= 1;
		a = 1ll*a*a%MOD;
	}
	return ret;
}

const int MAXN = 2e5 + 10;

ll col[MAXN], row[MAXN], sec[MAXN];

int H, W, n;

bool cmp(int i, int j) {
	return row[i] < row[j];
}

void solve() {
	cin >> H >> W >> n;
	for(int i = 1; i <= W; i++)
		col[i] = H;
	for(int i = 1; i <= H; i++)
		row[i] = W;
	for(int i = 0; i < n; i++) {
		ll x, y;
		cin >> x >> y;
		col[y] = min(col[y], x-1);
		row[x] = min(row[x], y-1);
	}

	iota(sec, sec+H, 1);
	sort(sec, sec+H, cmp);

	int bad = 1;
	while(row[bad])
		bad++;

	ll ans = 0;
	ordered_set s;
	for(int i = 0, c = 1; i < H; i++) {
		while(c <= row[sec[i]]) {
			ans += col[c];
			s.insert({col[c], c});
			if(!col[c])
				c = W+1;
			c++;
		}
		if(sec[i] < bad)
			ans += row[sec[i]] - (s.size() - s.order_of_key({sec[i], -1}));
	}

	cout << ans << "\n";
}

int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	//cout << fixed << setprecision(6);

	int te = 1;
	//cin >> te;
	for (int w = 1; w <= te; w++){
		//cout << "Case #" << w << ": ";
		solve();
	}
	return 0;
}


#include <bits/stdc++.h>
using namespace std;
using ll=long long;
#define rep(i,n) for(int i=0;i<n;i++)
#define all(v) v.begin(),v.end()
#define pb push_back
struct query{int time,type;ll p;int idx;};
bool operator<(const query &a,const query &b){
    return a.time<b.time;
}
int main(){
    cin.tie(0);ios::sync_with_stdio(false);
    int n,m,q;
    ll x[200010],y[200010],nx=0,ny=0,ax[200010],ay[200010];
    bool fx=false,fy=false,sw=false;
    cin>>n;
    vector<query>qs;
    rep(i,n)cin>>x[i]>>y[i];
    cin>>m;
    rep(i,m){
        int type;
        cin>>type;
        if(type==1||type==2)qs.pb({2*i,type,-1,-1});
        if(type==3||type==4){
            ll p;
            cin>>p;
            qs.pb({2*i,type,p,-1});
        }
    }
    cin>>q;
    rep(i,q){
        int a,b;
        cin>>a>>b;
        a--,b--;
        qs.pb({2*a+1,0,b,i});
    }
    sort(all(qs));
    for(auto[time,type,p,idx]:qs){
        if(type==1){
            if(sw==0){
                fx=!fx;
                nx=-nx;
            }
            if(sw==1){
                fy=!fy;
                ny=-ny;
            }
            sw=!sw;
        }
        if(type==2){
            if(sw==0){
                fy=!fy;
                ny=-ny;
            }
            if(sw==1){
                nx=-nx;
                fx=!fx;
            }
            sw=!sw;
        }
        if(type==3){
            if(sw==0){
                fx=!fx;
                nx=-nx+p*2;
            }
            if(sw==1){
                fy=!fy;
                ny=-ny+p*2;
            }
        }
        if(type==4){
            if(sw==0){
                fy=!fy;
                ny=-ny+p*2;
            }
            if(sw==1){
                fx=!fx;
                nx=-nx+p*2;
            }
        }
        if(type==0){
            if(sw==0){
                if(fx==0)ax[idx]=x[p]+nx;
                if(fx==1)ax[idx]=-x[p]+nx;
                if(fy==0)ay[idx]=y[p]+ny;
                if(fy==1)ay[idx]=-y[p]+ny;
            }
            if(sw==1){
                if(fy==0)ax[idx]=y[p]+ny;
                if(fy==1)ax[idx]=-y[p]+ny;
                if(fx==0)ay[idx]=x[p]+nx;
                if(fx==1)ay[idx]=-x[p]+nx;
            }

        }
    }
    rep(i,q)cout<<ax[i]<<" "<<ay[i]<<endl;
    return 0;
}

#include <iostream>
#include <algorithm>
#include <queue>
#include <bitset>
#include <string>
#include <cstring>
#include <limits>
#include <cmath>
#include <cstdlib>
#define int long long

int const INF = std::numeric_limits<int>::max();
int const NINF = std::numeric_limits<int>::min();
int const N = 200000;
int const M = N;
int const Q = N;

struct Point {
	int x, y;
};

struct Oper {
	int op;
	int p;
};

struct Query {
	int oper;
	int point;
	int index;
	bool operator<(const Query &other) const {
		return oper < other.oper;
	}
};

struct Tag {
	int add;
	int times = 1;
};

Point points[N + 1];
Oper opers[M + 1];
Query queries[Q + 1];
Tag xtag;
Tag ytag;
int swaps;
int x_ans[Q + 1];
int y_ans[Q + 1];

void plus(int, Tag&);
void times(int, Tag&);

void plus(int v, Tag &tag) {
	tag.add += v;
}

void times(int v, Tag &tag) {
	tag.add *= v;
	tag.times *= v;
}

signed main()  {
	std::ios::sync_with_stdio(false);
	std::cin.tie(0);
	std::cout.tie(0);

	int n, m;
	std::cin >> n;

	for (int i = 1; i <= n; i++) {
		std::cin >> points[i].x >> points[i].y;
	}

	std::cin >> m;
	for (int i = 1; i <= m; i++) {
		std::cin >> opers[i].op;
		if (opers[i].op >= 3) {
			std::cin >> opers[i].p;
		}
	}

	int q;
	std::cin >> q;

	for (int i = 1; i <= q; i++) {
		std::cin >> queries[i].oper >> queries[i].point;
		queries[i].index = i;
	}

	std::sort(queries + 1, queries + 1 + q);

	int pointer = 1;
	for (int i = 1; i <= m; i++) {
		while (pointer <= q && i > queries[pointer].oper) {
			int x = points[queries[pointer].point].x;
			int y = points[queries[pointer].point].y;

			if (swaps % 2) {
				std::swap(x, y);
			}

			x_ans[queries[pointer].index] = x * xtag.times + xtag.add;
			y_ans[queries[pointer].index] = y * ytag.times + ytag.add;

			pointer++;
		}

		int op = opers[i].op;
		int p = opers[i].p;

		if (op == 1) {
			swaps++;
			std::swap(xtag, ytag);
			times(-1, ytag);
		}
		else if (op == 2) {
			swaps++;
			std::swap(xtag, ytag);
			times(-1, xtag);
		}
		else if (op == 3) {
			times(-1, xtag);
			plus(2 * p, xtag);
		}
		else {
			times(-1, ytag);
			plus(2 * p, ytag);
		}
	}

	while (pointer <= q) {
		int x = points[queries[pointer].point].x;
		int y = points[queries[pointer].point].y;

		if (swaps % 2) {
			std::swap(x, y);
		}

		x_ans[queries[pointer].index] = x * xtag.times + xtag.add;
		y_ans[queries[pointer].index] = y * ytag.times + ytag.add;

		pointer++;
	}

	for (int i = 1; i <= q; i++) {
		std::cout << x_ans[i] << ' ' << y_ans[i] << '\n';
	}

	return 0;
}


#include <bits/stdc++.h>

using namespace std;

int BIG = 9999999;

vector<int> interests;
vector<int> vinterests;
vector<int> kapairs;
int nums[400001];

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int t, a, b, c, d, n, ans = 0;
    long long int w, x, y, z;
    cin >> n;
    d = 0;
    kapairs.resize(400001);
    for(int i = 0; i < 400001; i++) {
        kapairs[i] = 0;
    }
    for(int i = 0; i < n; i++) {
        cin >> a >> b;
        nums[a]++; nums[b]++;
        kapairs[a] += b;
        kapairs[b] += a;
    }
    for(int i = 0; i < 400001; i++) {
        if(nums[i]) d++;
        if(nums[i] == 1) interests.push_back(i);
    }
    // cout << "yay\n";
    while(interests.size()) {
        for(int i = 0; i < interests.size(); i++) {
            d--;
            if(kapairs[interests[i]] == 0) continue;
            int c = kapairs[interests[i]], k = interests[i];
            kapairs[k] -= c;
            kapairs[c] -= k;
            nums[k]--; nums[c]--;
            if(nums[c] == 1) vinterests.push_back(c);
            ans++;
        }
        interests.swap(vinterests);
        vector<int>().swap(vinterests);
    }
    // cout << "Left with " << numnums[0].first << ' ' << numnums[0].second << '\n';
    cout << ans+d << '\n';
}

//Shinchan Loves Coding :))
#include<bits/stdc++.h>

using namespace std;

#define night_rider ios::sync_with_stdio(false);cin.tie(NULL);
#define double long double
#define int long long int
#define en "\n"
#define fi first
#define se second
#define PB push_back
#define all(v) v.begin(),v.end()
#define allr(v) v.rbegin(),v.rend()
#define rep(i,x,y) for(int i=x ; i<y ; i++)
#define erep(i,x,y) for(int i=x ; i<=y ; i++)
#define erepr(i,x,y) for(int i=x ; i>=y ; i--)
#define repr(i,x,y) for(int i=x ; i>y ; i--)

typedef vector<int> vi;
typedef vector<vector<int>> vii;
typedef pair<int,int> pi;
typedef vector<pair<int,int>> pii;

//--------------------------------------------------------------------------------------------------------------------------------------------------------------

const int no=3e6+5,modulo=1e9+7,inf=1e18,N=2e3+1;
const double PI = 3.1415926535897932384;
int ar[no] ,br[no],cr[no];//,dr[no],er[no];
int used[no];
//int color[no];
//pii adj[no];
vi adj[no] ;
//LOWER_BOUND(n) - FIRST ELEMENT GREATER THAN EQUAL TO n
//UPPER_BOUND(n) - FIRST ELEMENT GREATER THAN n

//--------------------------------------------------------------------------------------------------------------------------------------------------------------

int mark[no];
vi ans;

void dfs(int node) {
    used[node]=1;
    if(!mark[ar[node]]) ans.PB(node);
    mark[ar[node]]++;
    for(int child : adj[node]) {
        if(!used[child]) {
            dfs(child);
        }
    }
    mark[ar[node]]--;
}

void solve () {
    int n=0,m=0,a=0,b=0,c=0,d=0,x=0,y=0,z=0,w=0,k=0;
    cin>>n;
    rep(i,1,n+1) cin>>ar[i];
    m=n-1;
    rep(i,0,m) {
        cin>>x>>y;
        adj[x].PB(y);
        adj[y].PB(x);
    }
    dfs(1);
    sort(all(ans));
    for(auto ii : ans) cout<<ii<<en;
}

inline void runn() {
    #ifndef ONLINE_JUDGE
    freopen("input.txt","r",stdin);
    freopen("output.txt","w",stdout);
    #endif
}

signed main() {
    night_rider
    runn();
    int t=1;
    cout<<fixed<<setprecision(15);
  //  cin>>t;
    rep(i,1,t+1) {
       // cout << "Case #" << i << ": ";
        solve();
    }
}


#include <bits/stdc++.h>

typedef long long int ll;
typedef long double ld;
typedef unsigned long long int ull;
typedef long int li;
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define test ll t; cin >> t; while(t--)
#define print_tc(t, c) cout << "Case #" << t << ": " << c << "\n";
const long long int dx[4] = {0, 0, -1, 1}, dy[4] = {1, -1, 0, 0};
const long long int cons = 100005, ncr_cons = 100005;
const long long int MOD = 1000000007; // const long long int MOD = 998244353;
const long long int const_INT_MAX = 1000000000000000000, const_INT_MIN = -1 * 1000000000000000000;
using namespace std;
bool sortinrev(const pair<ll,ll> &a, const pair<ll,ll> &b){return (a.first > b.first);}
bool sortbysec(const pair<ll,ll> &a, const pair<ll,ll> &b){return (a.second < b.second);}
bool sortbysecinrev(const pair<ll,ll> &a, const pair<ll,ll> &b){return (a.second > b.second);}
ll gcd(ll x, ll y){return (ll)(__gcd(x, y));}
ll lcm(ll x, ll y){return (ll)((x * y) / gcd(x, y));}
ll mod_expo(ll x, ll y, ll p){
    if((x + p) % p == 0) return 0;
    ll res = 1; x = (x + p) % p;
    while (y > 0){
        if(y & 1) res = (res*x + p) % p;
        y = y>>1; x = (x*x + p) % p;
    }
    return res;
}
void usaco(string str = ""){
    fastio;
    if(str.size()){
        freopen((str + ".in").c_str(), "r", stdin);
        freopen((str + ".out").c_str(), "w", stdout);
    }
}
int main(){
    usaco();
    ll x, y, z; cin >> x >> y >> z; cout << (y * z - 1) / x << "\n";
    cerr << "\nTime elapsed: " << 1000 * clock() / CLOCKS_PER_SEC << "ms\n";
}

    #include <bits/stdc++.h>
    using namespace std;
    #include <math.h>
    #include <iomanip>
    #include <cstdint>
    #include <string>
    #include <sstream>
    template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
    template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
    #define rep(i,n) for (int i = 0; i < (n); ++i)
    typedef long long ll;
    using P=pair<ll,ll>;
    const int INF=1001001001;
    const int mod=1e9+7;

    void solve(){
      int x,y,z;
      cin>>x>>y>>z;
      cout<<(z*y-1)/x<<endl;
    }
    int main(){
      solve();
      return 0;
    }