#include <bits/stdc++.h>
using namespace std;
#define int long long
#define f(i, a, b) for (int i = a; i < b; i++)
#define pi pair<int, int>
#define pb push_back
#define mp make_pair
#define endl '\n'
#define all(v) (v).begin(), (v).end()
#define FIO ios_base::sync_with_stdio(0), cin.tie(0)
#define fi first
#define se second

signed main() {
    FIO;
    int a, b, w;
    cin >> a >> b >> w;
    w *= 1000;
    int umin = (w + b - 1) / b;
    int diff = umin * b - w;
    double div = (diff + 0.0) / umin;
    if ((b - div) < a) {
        cout << "UNSATISFIABLE";
        return 0;
    }
    int umax = w / a;
    cout << umin << " " << umax;
}

/**
*    author:  shu8Cream
*    created: 22.02.2021 00:37:07
**/

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

const int mod = 998244353;
struct mint{
    ll x;
    mint(ll x=0):x((x%mod+mod)%mod){}
    mint operator-() const { return mint(-x);}
    mint& operator+=(const mint a) {
        if ((x += a.x) >= mod) x -= mod;
        return *this;
    }
    mint& operator-=(const mint a) {
        if ((x += mod-a.x) >= mod) x -= mod;
        return *this;
    }
    mint& operator*=(const mint a) { (x *= a.x) %= mod; return *this;}
    mint operator+(const mint a) const { return mint(*this) += a;}
    mint operator-(const mint a) const { return mint(*this) -= a;}
    mint operator*(const mint a) const { return mint(*this) *= a;}
    mint pow(ll t) const {
        if (!t) return 1;
        mint a = pow(t>>1);
        a *= a;
        if (t&1) a *= *this;
        return a;
    }

    // for prime mod
    mint inv() const { return pow(mod-2);}
    mint& operator/=(const mint a) { return *this *= a.inv();}
    mint operator/(const mint a) const { return mint(*this) /= a;}
};
istream& operator>>(istream& is, mint& a) { return is >> a.x;}
ostream& operator<<(ostream& os, const mint& a) { return os << a.x;}

mint upper[220000];
mint lower[220000];
mint lower2[220000];

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int n,m,k;
    cin >> n >> m >> k;
    if(n>m) swap(n,m);
    if(n==1){
        cout << mint(k).pow(m) << endl;
        return 0;
    }
    for(int x=1; x<=k; x++)
        upper[x] = mint(k-x+1).pow(m);
    for(int x=1; x<=k; x++)
        lower[x] = mint(x).pow(n);
    for(int x=1; x<=k; x++)
        lower2[x] = lower[x] - lower[x-1];

    mint ans = 0;
    for(int x=1; x<=k; x++)
        ans+=lower2[x]*upper[x];
    cout << ans << endl;
}


#include<iostream>
using namespace std;
#define ll long long int
int main()
{
     ll n,a;
	 cin>>n;
     ll sum=0,mx=0,ans=0,dis=0;
     for(ll i=0;i<n;i++){
       cin>>a;
       sum+=a;
       mx=max(mx,sum);
       ans=max(ans,dis+mx);  //First check plus the mx value cause after mx value it will decrease
       dis+=sum;
     }
     cout<<ans<<endl;
  return 0;
}


#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const long long INF = 1LL<<60;
const double PI = acos(-1.0);
/*const double PI = atan2(0.0,-1.0)*/
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)
#define rep1(i,aa,n) for(ll i = aa; i <= (ll)(n); i++)
#define ALL(a)  (a).begin(),(a).end()
#define ar_init(aa,val) rep(i,aa.size()) aa[i]=val;
#define v2d(aa,val1,val2,ini) vector<vector<ll>> aa(val1,vector<ll>(val2,ini));
#define pqe priority_queue<ll>
#define pqeg priority_queue<ll,vector<ll>,greater<ll>>
#define lcin(...) ll __VA_ARGS__;CINT(__VA_ARGS__)
#define eout(...) COU(__VA_ARGS__);
#define sout(...) SCOU(__VA_ARGS__);
#define scin(...) string __VA_ARGS__;CINT(__VA_ARGS__)
#define lb(aa,val) lower_bound(ALL(aa),val)
#define pb push_back
#define mkp make_pair
#define si size()

void CINT(){}
template <class Head,class... Tail>
void CINT(Head&& head,Tail&&... tail){
    cin>>head;
    CINT(move(tail)...);
}

void COU(){}
template <class Head,class... Tail>
void COU(Head&& head,Tail&&... tail){
    cout<<head<<endl;
    COU(move(tail)...);
}

void SCOU(){}
template <class Head,class... Tail>
void SCOU(Head&& head,Tail&&... tail){
    cout<<head<<" ";
    SCOU(move(tail)...);
}

template <class T = ll>
T IN(){T x;cin>>x;return (x);}

using pii = pair<ll,ll>;
using v2 = vector<vector<ll>>;
using v1 = vector<ll>;
using v2p = vector<vector<pii>>;
using v1p = vector<pii>;
//ll mo=1000000007;
ll mo=998244353;

ll mod_pow(ll N,ll n){
if(n==0) return 1;
ll pp,hh;
pp=n/2;
hh=n%2;
int tt=mod_pow(N,n/2);
if(hh==0)return tt%mo*tt%mo;
else {return tt%mo*tt%mo*N%mo;}
}

ll pp[6000][6000];
int main(){
//cout<<fixed<<setprecision(15);

lcin(n,m);

rep1(i,1,m){
pp[i][0]=1;
rep1(k,1,n){
pp[i][k]=pp[i][k-1]*i;
pp[i][k]%=mo;
}
}

ll res=0;

rep1(i,1,m){
rep1(k,1,n){
if(k+2<=n){res+=pp[m][n-k-2]*(pp[m-i+1][k]-pp[m-i][k])%mo*max((ll)0,n-k+1-2)*(i-1)%mo*(i-1)%mo;
}
if(k!=n){res+=2*pp[m][max((ll)0,n-k-1)]*(pp[m-i+1][k]-pp[m-i][k])%mo*(i-1)%mo;
}
if(k==n){res+=pp[m-i+1][k]-pp[m-i][k];
res%=mo;
}

}
}

eout(res);
}

#include<bits/stdc++.h>
using namespace std;
int read(){
	int x=0;char ch=getchar();
	while(!isdigit(ch))ch=getchar();
	while(isdigit(ch))x=(x<<1)+(x<<3)+(ch^'0'),ch=getchar();
	return x;
}
const int N=5005,mod=998244353;
typedef long long ll;
ll dp[N],n,m,cm[N];
int main(){
	n=read(),m=read();
	cm[0]=1;for(int i=1;i<=n;i++)cm[i]=cm[i-1]*m%mod;
	ll ans=cm[n]*n%mod;
	for(int i=1;i<=m;i++)for(int j=1;j<=n;j++)dp[j]=(dp[j-1]*(i-1)%mod+cm[j-1])%mod,ans=(ans-dp[j-1]*cm[n-j]%mod)%mod;
	cout<<(ans+mod)%mod;
	return 0;
}


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

double pi = 3.141592653589793238;
const ll LL_INF_BIG = 1e18 + 7;
const ll LL_INF = 1e9 + 7;
const int INF = 1e9 + 7;

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

template <class T> void chmin(T& a, T b) {
    if (a > b) a = b;
    return;
}

template <class T> void chmax(T& a, T b) {
    if (a < b) a = b;
    return;
}

vector<pair<ll, ll>> prime_factorize(ll N) {
    vector<pair<ll, ll>> res;
    for (ll i = 2; i * i <= N; i++) {
        if (N % i != 0) continue;
        ll exp = 0;
        while (N % i == 0) {
            exp++;
            N /= i;
        }
        res.push_back({i, exp});
    }
    if (N != 1) res.push_back({N, 1});
    return res;
}

ll mod_pow(ll a, ll n, ll mod) {
    ll res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}

struct UnionFind {
    vector<int> parents, siz;

    UnionFind(int N) : parents(N, -1), siz(N, 1) {}

    int root(int x) {
        if (parents.at(x) == -1) return x;
        return parents.at(x) = root(parents.at(x));
    }

    bool unite(int x, int y) {
        int rx = root(x);
        int ry = root(y);
        if (rx == ry) return false;
        if (siz.at(rx) > siz.at(ry)) swap(rx, ry);
        parents.at(rx) = ry;
        // Update the size only at root.
        siz.at(ry) += siz.at(rx);
        return true;
    }

    bool same(int x, int y) {
        int rx = root(x);
        int ry = root(y);
        return rx == ry;
    }

    // If the size is needed, we need to see it at root.
    int size(int x) { return siz.at(root(x)); }
};

// struct Edge {
//     ll to;
//     ll weight;
//     Edge(ll t, ll w) : to(t), weight(w) {}
// };

using Edge = pair<int, pair<int, int>>;

using Graph = vector<vector<Edge>>;

Graph G;

vector<Edge> edge;

int N, M;
vector<int> A;

ll answer = 0;
vector<int> answers;
vector<int> intervals;

void input() {
    cin >> N >> M;
    A.resize(M);
    for (int i = 0; i < M; i++) {
        int a;
        cin >> a;
        // a--;
        A.at(i) = a;
    }
}

void solve() {
    if(M==0) {
        answer = 1;
        return;
    }
    sort(A.begin(), A.end());
    int minInterval = INF;
    int firstInterval = A.at(0)-1;
    if (firstInterval > 0) {
        chmin(minInterval, firstInterval);
        intervals.push_back(firstInterval);
    }
    for (int i = 1; i < M; i++) {
        int ival = A.at(i) - A.at(i - 1) - 1;
        if (ival == 0) continue;
        chmin(minInterval, ival);
        intervals.push_back(ival);
    }
    int lastInterval = N - A.at(M - 1);
    if (lastInterval > 0) {
        chmin(minInterval, lastInterval);
        intervals.push_back(lastInterval);
    }

    int k;
    k = minInterval;
    for (int i = 0; i < intervals.size(); i++) {
        if (intervals.at(i) % k == 0) {
            answer += intervals.at(i) / k;
        } else {
            answer += intervals.at(i) / k;
            answer++;
        }
    }
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    input();
    solve();
    // cout << fixed << setprecision(3);
    cout << answer << "\n";
    // for (auto answer : answers) cout << answer << "\n";
    return 0;
}

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

template <int mod>
class Modint {
    using mint = Modint;
    static_assert(mod > 0, "Modulus must be positive");

public:
    static constexpr int get_mod() noexcept { return mod; }

    constexpr Modint(long long y = 0) noexcept : x(y >= 0 ? y % mod : (y % mod + mod) % mod) {}

    constexpr int value() const noexcept { return x; }

    constexpr mint& operator+=(const mint& r) noexcept { if ((x += r.x) >= mod) x -= mod; return *this; }
    constexpr mint& operator-=(const mint& r) noexcept { if ((x += mod - r.x) >= mod) x -= mod; return *this; }
    constexpr mint& operator*=(const mint& r) noexcept { x = static_cast<int>(1LL * x * r.x % mod); return *this; }
    constexpr mint& operator/=(const mint& r) noexcept { *this *= r.inv(); return *this; }

    constexpr mint operator-() const noexcept { return mint(-x); }

    constexpr mint operator+(const mint& r) const noexcept { return mint(*this) += r; }
    constexpr mint operator-(const mint& r) const noexcept { return mint(*this) -= r; }
    constexpr mint operator*(const mint& r) const noexcept { return mint(*this) *= r; }
    constexpr mint operator/(const mint& r) const noexcept { return mint(*this) /= r; }

    constexpr bool operator==(const mint& r) const noexcept { return x == r.x; }
    constexpr bool operator!=(const mint& r) const noexcept { return x != r.x; }

    constexpr mint inv() const noexcept {
        int a = x, b = mod, u = 1, v = 0;
        while (b > 0) {
            int t = a / b;
            std::swap(a -= t * b, b);
            std::swap(u -= t * v, v);
        }
        return mint(u);
    }

    constexpr mint pow(long long n) const noexcept {
        mint ret(1), mul(x);
        while (n > 0) {
            if (n & 1) ret *= mul;
            mul *= mul;
            n >>= 1;
        }
        return ret;
    }

    friend std::ostream& operator<<(std::ostream& os, const mint& r) {
        return os << r.x;
    }

    friend std::istream& operator>>(std::istream& is, mint& r) {
        long long t;
        is >> t;
        r = mint(t);
        return is;
    }

private:
    int x;
};

using mint = Modint<998244353>;

template <typename T>
class Combination {
public:
    Combination() = default;
    Combination(int n) : fact(n + 1), fact_inv(n + 1) {
        fact[0] = 1;
        for (int i = 1; i <= n; ++i) fact[i] = fact[i - 1] * i;
        fact_inv[n] = T(1) / fact[n];
        for (int i = n; i > 0; --i) fact_inv[i - 1] = fact_inv[i] * i;
    }

    T perm(int n, int r) const {
        if (r < 0 || n < r) return 0;
        return fact[n] * fact_inv[n - r];
    }

    T comb(int n, int r) const {
        if (r < 0 || n < r) return 0;
        return fact[n] * fact_inv[r] * fact_inv[n - r];
    }

private:
    std::vector<T> fact, fact_inv;
};

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

    int N, K;
    cin >> N >> K;
    vector<vector<mint>> A(K + 1, vector<mint>(N, 1));
    for (int i = 0; i < N; ++i) cin >> A[1][i];
    for (int i = 2; i <= K; ++i) {
        for (int j = 0; j < N; ++j) {
            A[i][j] = A[i - 1][j] * A[1][j];
        }
    }
    vector<mint> sum(K + 1);
    for (int i = 0; i <= K; ++i) {
        for (int j = 0; j < N; ++j) sum[i] += A[i][j];
    }
    vector<mint> pow2(K + 1, 1);
    for (int i = 1; i <= K; ++i) pow2[i] = pow2[i-1] * 2;
    Combination<mint> comb(K + 1);
    for (int X = 1; X <= K; ++X) {
        mint ans = 0;
        for (int i = 0; i <= X; ++i) ans += comb.comb(X, i) * sum[i] * sum[X - i];
        ans -= pow2[X] * sum[X];
        ans /= 2;
        cout << ans << "\n";
    }
}


#include<algorithm>
#include<iostream>
#include<cstring>
#include<cstdio>
using std::sort;
using std::cout;
using std::endl;
using std::max;
using std::min;

inline int read(){
	int h=0;char c=getchar();
	while(c<'0'||c>'9')c=getchar();
	while(c>='0'&&c<='9')h=(h<<1)+(h<<3)+c-'0',c=getchar();
	return h;
}

const int p=998244353;
inline int add(int x,int y){return x+y>=p?x+y-p:x+y;}
//long long ksm()/
const int MAXN=110;
int n;
int f[2][110][11111];
int nw=0,lst=1;
//前i个物品，A有j个，B有i-j个，A-B为w的方案数。

int id(int x){return x+5001;}
int a[MAXN];
long long jc[MAXN];
//int jcn[MAXN];

int main(){
	jc[0]=1;for(int i=1;i<=100;i++)jc[i]=jc[i-1]*i%p;
	n=read();for(int i=1;i<=n;i++)a[i]=read();
	f[0][0][id(0)]=1;
	for(int i=1;i<=n;i++){
		std::swap(nw,lst);
		memset(f[nw],0,sizeof(f[nw]));
		for(int j=0;j<=i;j++){
			for(int d=-5000;d<=5000;d++){
				if(d+a[i]<=5000)f[nw][j+1][id(d+a[i])]=add(f[nw][j+1][id(d+a[i])],f[lst][j][id(d)]);
				if(d-a[i]>=-5000)f[nw][j][id(d-a[i])]=add(f[nw][j][id(d-a[i])],f[lst][j][id(d)]);
			}
		}
	}
	int ans=0;
	for(int i=0;i<=n;i++){
		ans=(ans+f[nw][i][id(0)]*jc[i]%p*jc[n-i])%p;
	}
	printf("%d\n",ans);
	return 0;
}

#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
#define MIN(a, b) (((a) < (b)) ? (a) : (b))
#define MAX(a, b) (((a) < (b)) ? (b) : (a))
//#pragma GCC optimize("O3")
using namespace std;
using namespace __gnu_pbds;
auto random_address = [] { char *p = new char; delete p; return uint64_t(p); };
const uint64_t SEED = chrono::steady_clock::now().time_since_epoch().count() * (random_address() | 1);
mt19937_64 rng(SEED);
typedef tree<
int,
null_type,
less<int>,
rb_tree_tag,
tree_order_statistics_node_update>
ordered_set;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
ll n,v[1005],suma,dp[105][20005],aux[105][20005],fact[20005],f[20005],ans;
const ll mod=998244353;
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    cin>>n;
    fact[0]=1;
    for(ll i=1;i<=1000;i++)
        fact[i]=(fact[i-1]*i)%mod;
    for(int i=1;i<=n;i++)
    {
        cin>>v[i];
        f[v[i]]++;
        suma+=v[i];
    }
    sort(v+1,v+n+1);
    if(suma%2==1)
    {
        cout<<0;
        return 0;
    }
    dp[0][0]=1;
    for(int i=1;i<=n;i++)
    {
        for(int j=0;j<=n;j++)
            for(int s=0;s<=suma;s++)
                aux[j][s]=dp[j][s];
        for(int j=1;j<=n;j++)
            for(int s=v[i];s<=suma;s++)
                dp[j][s]=(dp[j][s]+aux[j-1][s-v[i]])%mod;
    }
    for(ll j=1;j<=n;j++)
    {
        ll k=n-j;
        ll val=(fact[j]*fact[k])%mod;
        val=(val*dp[j][suma/2])%mod;
        /*if(j==n/2&&n%2==0)
            val=(val*2LL)%mod;*/
        ans=(ans+val)%mod;
    }
    cout<<ans<<'\n';
    return 0;
}


#include <bits/stdc++.h>
#define rep(i, a, n) for(int i = a; i < (n); i++)
using namespace std;
using ll = long long;
using P = pair<int, int>;
const int INF = 1001001001;
const ll LINF = 1001002003004005006ll;
const int mod = 1000000007;
//const int mod = 998244353;

int main()
{
    ll n;
    cin >> n;
    ll ans = LINF;
    for(ll i = 0; i < 61; i++){
        if((1ll<<i) > n) continue;
        ll j = n/(1LL<<i);
        ll k = n - j*(1ll<<i);
        ans = min(ans, i + j + k);
    }
    cout << ans << endl;
    return 0;
}


#include "iostream"
#include "string"
#include "algorithm"
using namespace std;

long long g1(long long n) {
	string s = to_string(n);
	sort(s.begin(), s.end(), [](int a, int b){ return a > b; });
	return stoll(s);
}

long long g2(long long n) {
	string s = to_string(n);
	sort(s.begin(), s.end());
	return stoll(s);
}

int main()
{
	int k = 0;
	long long n = 0;

	cin >> n >> k;
	for (int i = 0; i < k; i++) {
		n = g1(n) - g2(n);
	}
	cout << n << endl;

	return 0;
}

#include<bits/stdc++.h>
using namespace std;
int l,r;
void check(int &ans,int k,long long x) {
	int L=1,R=r/k+100;
	while(L<=R) {
		int mid=(L+R)>>1;
		if(mid*k>x&&mid*k<=r) {
			ans=max(ans,k);
			return ;
		}
		if(mid*k<=x) {
			L=mid+1;
		} else {
			R=mid-1;
		}
	}
}
int solve(int x) {
	int ans=0;
	for(int i=1;i*i<=x;i++) {
		if(x%i==0) {
			check(ans,x/i,x);
			check(ans,i,x);
		}
	}
	return ans;
}
signed main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	cin>>l>>r;
	int ans=0;
	for(int i=l;i<r;i++) {
		ans=max(ans,solve(i));
	}
	cout<<ans;
}


#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int a,b;
ll k;
bool sz[100];
ll c[65][65];
void init()
{
	c[0][0]=1;
	for(int i=1;i<=64;i++)
	{
		for(int j=0;j<=i;j++)
		{
			if(j==0) c[i][j]=1;
		    else if(j==i) c[i][j]=1;
			else c[i][j]=c[i-1][j]+c[i-1][j-1];

		}
	}
}
int main()
{
	init();
	cin>>a>>b>>k;
	int nowa=a;
	for(int i=1;i<=a+b&&nowa;i++)
	{
		if(c[a+b-i][nowa-1]>=k)
		{
			sz[i]=1;
			nowa--;
		}
		else
		{
			sz[i]=0;
			k-=c[a+b-i][nowa-1];
		}

	}
	for(int i=1;i<=a+b;i++)
	{
		if(sz[i]==0) cout<<'b';
		else cout<<'a';
	}
	return 0;

}

#include <bits/stdc++.h>

using namespace std;

#define REP(i, n)   for(int i = 0; i < (n); i++)
#define REPS(i, n)  for(int i = 1; i <= (n); i++)
#define RREP(i, n)  for(int i = (n)-1; i >= 0; i--)
#define RREPS(i, n) for(int i = (n); i > 0; i--)
#define ALL(v) v.begin(), v.end()
#define RALL(v) v.rbegin(), v.rend()
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end())
#define mp make_pair
#define mt make_tuple
#define pb push_back
#define YES cout << "YES" << endl
#define Yes cout << "Yes" << endl
#define NO cout << "NO" << endl
#define No cout << "No" << endl

using ll  = long long;
using pi  = pair<int, int>;
using pl  = pair<ll, ll>;
using vi  = vector<int>;
using vl  = vector<ll>;
using vs  = vector<string>;
using vb  = vector<bool>;
using vvi = vector<vi>;
using vvl = vector<vl>;

const int MOD = 1e9 + 7;
//const int MOD = 998244353;
const int INF = 1e9 + 7;
const ll  INFL = 1e18;
const double PI = 3.14159265359;

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

ll com(ll n, ll r)
{
    if(n == 0 || r == 0) return 1;
    ll ret = 1;
    for(ll i = 1; i <= r; i++)
    {
        ret *= n-i+1;
        ret /= i;
    }
    return ret;
}

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

    ll a, b, k; cin >> a >> b >> k;
    ll s = 0;
    string ans = "";
    ll x = 0, y = 0;
    REPS(i, a+b-1)
    {
        if(x == a || y == b) break;
        if(k <= s+com(a+b-i, a-(x+1)))
        {
            x++;
            ans.pb('a');
        }
        else
        {
            y++;
            s += com(a+b-i, a-(x+1));
            ans.pb('b');
        }
    }
    cout << ans;
    REP(i, a-x) cout << 'a';
    REP(i, b-y) cout << 'b';
    cout << endl;
}


#include <bits/stdc++.h>
using namespace std;
using i16 = short;
using u16 = unsigned short;
using i32 = int;
using u32 = unsigned int;
using i64 = long long;
using u64 = unsigned long long;
using f32 = float;
using f64 = double;
using f80 = long double;
using P = pair<int, int>;
using vec = vector<int>;
using mat = vector<vector<int>>;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(v) v.begin(), v.end()
#define endl "\n"

constexpr int MOD = 1000000007;
constexpr int INF = 1001001001;

constexpr bool is_multiple = false;

i32 digits_sum(i32 n) {
    i32 res = 0;

    while (n > 0) {
        res += (n % 10);
        n /= 10;
    }

    return res;
}

void solve() {
    i32 a, b;
    cin >> a >> b;
    cout << max(digits_sum(a), digits_sum(b)) << endl;
}

int main() {
    i32 t = 1;
    if (is_multiple) cin >> t;
    while (t--) solve();
    return 0;
}

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

int main() {
    int a, b;
    cin >> a >> b;
    int sum = 0, sumi = 0;
    rep(i,3) {
        sum += a % 10;
        a /= 10;
        sumi += b % 10;
        b /= 10;
    }
    cout << max(sum, sumi) << endl;
    return 0;
}


#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef long double ld;

typedef vector<int> vi;
typedef vector<ll> vll;

typedef vector<vi> vvi;
typedef vector<vll> vvll;

typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

typedef vector<pii> vpii;
typedef vector<pll> vpll;

typedef vector<vpii> vvpii;
typedef vector<vpll> vvpll;

#define pb push_back
#define mp make_pair
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define sz(x) (int)(x).size()
#define fi first
#define se second

template<class T> bool ckmin(T &a, const T &b) {return a > b ? a = b, 1 : 0;}
template<class T> bool ckmax(T &a, const T &b) {return a < b ? a = b, 1 : 0;}

namespace debug {
    void __print(int x) {cerr << x;}
    void __print(long long x) {cerr << x;}
    void __print(double x) {cerr << x;}
    void __print(long double x) {cerr << x;}
    void __print(char x) {cerr << '\'' << x << '\'';}
    void __print(const string &x) {cerr << '\"' << x << '\"';}
    void __print(bool x) {cerr << (x ? "true" : "false");}

    template<typename T, typename V>
    void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
    template<typename T>
    void __print(const T &x) {int f = 0; cerr << '{'; for(auto z : x) cerr << (f++ ? "," : ""), __print(z); cerr << "}";}
    void _print() {cerr << "]\n";}
    template <typename T, typename... V>
    void _print(T t, V... v) {__print(t); if(sizeof...(v)) cerr << ", "; _print(v...);}

#ifdef ljuba
#define dbg(x...) cerr << "LINE(" << __LINE__ << ") -> " << "[" << #x << "] = ["; _print(x)
#else
#define dbg(x...)
#endif
}

using namespace debug;

const char nl = '\n';

mt19937 rng(chrono::high_resolution_clock::now().time_since_epoch().count());

void solve() {
    int n;
    cin >> n;
    vi v(n);
    for(auto &z : v) cin >> z;
    map<int, ll> cnt;
    ll ans = 0;
    for(int i = 0; i < n; ++i) {
        ans += cnt[v[i]%200];
        cnt[v[i]%200]++;
    }
    cout << ans << nl;
}

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

    int testCases = 1;
    //cin >> testCases;
    while(testCases--)
        solve();

}

#include <bits/stdc++.h>
#define ll long long
#define db long double
#define x first
#define y second
#define mp make_pair
#define pb push_back
#define all(a) a.begin(), a.end()

using namespace std;

const int mod = 1000000007;

void add(int& a, int b) {
  a += b;
  if (a >= mod) a -= mod;
  if (a < 0) a += mod;
}

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

int bp(int a, int b) {
  int res = 1;
  while (b > 0) {
    if (b & 1) res = mult(res, a);
    a = mult(a, a);
    b >>= 1;
  }
  return res;
}

int main(){
#ifdef LOCAL
	freopen("A_input.txt", "r", stdin);
	//freopen("A_output.txt", "w", stdout);
#endif
	ios_base::sync_with_stdio(0);
	cin.tie(0);

	int tt;
	cin >> tt;
	while (tt--) {
		string s1, s2, s3;
		int n;
		cin >> n >> s1 >> s2 >> s3;
		int c = 0;
		if (s1.back() == '1') c = 1;
		if (s2.back() == '1') c = 1;
		if (s3.back() == '1') c = 1;

		if (c == 0) {
			for (int i = 0; i < n; ++i) cout << '0';
			for (int i = 0; i < n; ++i) cout << '1';

		} else {
				for (int i = 0; i < n; ++i) cout << '1';
			for (int i = 0; i < n; ++i) cout << '0';

		}
		cout << c;
		cout << "\n";
	}

}


#include <bits/stdc++.h>
using namespace std;
#define ll long long int

int main() {
    vector<ll>v(3);
    cin>>v[0]>>v[1]>>v[2];
    sort(v.begin(),v.end());
    if(v[0]!=v[1] and v[1]!=v[2] and v[0]!=v[2])cout<<0;
    else {
        if(v[0]==v[1])cout<<v[2];
        else cout<<v[0];
    }
    cout<<endl;
}

#include<bits/stdc++.h>
using namespace std;
#define ll long long
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll a,b,c,d;
    cin>>a>>b>>c>>d;
    if(c*d==b)
    {
        cout<<"-1";
        return 0;
    }
    ll num=c*d-b;
    ll ans=(a+num-1)/num;
    if(ans<=0)
    {
        cout<<"-1";
        return 0;
    }
    cout<<ans;
}


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

int N, ans=0;
string S, T;
vector<int> a, b;

int main(){
  cin >> N >> S >> T;
  bool f=true;
  int x=-1;
  for(int i=0;i<N;i++){
    if(S[i]=='0')a.push_back(i);
    if(T[i]=='0')b.push_back(i);
  }
  if(a.size()!=b.size())puts("-1");
  else{
    for(int i=0;i<a.size();i++){
      if(a[i]!=b[i])ans++;
    }
    cout << ans << endl;
  }

  return 0;
}


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

int func (int n){
    if (n == 0) return 1;
    int x = func(n/2);
    x *= x;
    if (n%2 == 1) x *= 2;
    return x;
}

int main(void){
    int n, num_p;
    vector<int> A;
    vector<int> tree;

    cin >> n;
    num_p = func(n);
    A.resize(num_p);
    tree.resize(num_p);

    rep (i, num_p){
        cin >> A[i];
        tree[i] = i+1;
    }

    rep (i, n-1){
        rep (j, num_p/2){
            if (A[j*2] > A[j*2+1]){
                A[j] = A[j*2];
                tree[j] = tree[j*2];
            }
            else{
                A[j] = A[j*2+1];
                tree[j] = tree[j*2+1];
            }
        }
        num_p /= 2;
    }

    if (A[0] < A[1]) cout << tree[0] << endl;
    else cout << tree[1] << endl;

    return 0;
}

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

#define ll long long
#define ull unsigned long long
#define ld long double
#define F first
#define S second
#define eb emplace_back
#define pb push_back
#define mp make_pair
#define all(x) begin(x), end(x)
#define rall(x) rbegin(x), rend(x)

using namespace __gnu_pbds;
using namespace std;

template <typename T> using oset = tree <pair <T, T>, null_type, less <pair <T, T>>, rb_tree_tag, tree_order_statistics_node_update>;

template <typename T>
void ckmin(T& a, const T b) {a = min(a, b);}

template <typename T>
void ckmax(T& a, const T b) {a = max(a, b);}

template <typename T>
vector <T> sieve(T n) {
    vector <T> f(n+1, 1), res;
    for (T i = 2; i <= n; ++i)
        for (T j = i; j <= n; j += i)
            ++f[j];
    for (T i = 2; i <= n; ++i)
        if (f[i] == 2)
            res.eb(i);
    return res;
}

template <typename T>
T power(T a, T b) {
    T res = 1;
    while (b)
    {
        if (b & 1) res = res * a;
        b >>= 1;
        a = a * a;
    }
    return res;
}

template <typename T>
void print(vector <T> v) {
    for (T i : v) cout << i << " ";
    cout << '\n';
}

template <typename T>
void print(vector <vector <T>>& v) {
    for (vector <T>& vv : v) {
        for (T& i : vv)
            cout << i << " ";
        cout << '\n';
    }
}

template <typename T>
void read(vector <T>& v) {for (T& i : v) cin >> i;}

template <typename T>
void read(T&& t) {cin >> t;}

template <typename T, typename... Args>
void read(T&& t, Args&&... args)
{
    cin >> t;
    read(forward<Args>(args)...);
}

template <typename T>
void print(T&& t) {cout << t << '\n';}

template <typename T, typename... Args>
void print(T&& t, Args&&... args)
{
    cout << t << " ";
    print(forward<Args>(args)...);
}

void usaco(string name = "")
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    if(name.size())
    {
        freopen((name+".in").c_str(), "r", stdin);
        freopen((name+".txt").c_str(), "w", stdout);
    }
}

inline void solve()
{
    int n;
    cin >> n;
    vector <int> a(1 << n);
    for (int i = 0; i < (1 << n); ++i) cin >> a[i];
    auto x = max_element((1 << (n-1)) + all(a)) - a.begin();
    auto y = max_element(all(a) - (1 << (n-1))) - a.begin();
    print(a[x] > a[y] ? y+1 : x+1);
}

int32_t main()
{
    usaco();
    int t = 1;
    while (t--) solve();
}


#include <bits/stdc++.h>

#define Fast ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
using ll = long long ;
using namespace std;
using pii = pair<int,int>;
#define ld long double
#define bit(mask,i) ((mask>>i)&1)
#define p(a) cout<<"("<<a.first<<" "<<a.second<<") ";
#define row vector<ll>
#define vll row
#define mtx vector<row>
#define oo 1e9+9
#define INF oo
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
using namespace std;
const int N = 2e5 + 5;
ll mod=998244353;

ll dp[5000+5][5000+5];
int main()
{
    ll tcc=1;
    //cin>>tcc;
    while(tcc--){
       ll a,b,c,d;
       cin>>a>>b>>c>>d;
       ll ans=a*d-b*c;
       cout<<ans<<"\n";
    }

    return 0;
}

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

int main()
{
 int a,b,c,d;
 cin>>a>>b>>c>>d;

 cout<<min({a,b,c,d}) <<endl;

}


#include<bits/stdc++.h>
using namespace std;
#pragma GCC optimize("O3")
typedef long long ll;
#define rep(i, n)    for(ll i = 0; i < (n); ++i)
#define repA(i, a, n)  for(ll i = a; i <= (n); ++i)
#define repD(i, a, n)  for(ll i = a; i >= (n); --i)
#define vec(i, a)  for( auto i=a.begin();i != a.end(); ++i)
#define all(x) x.begin(), x.end()
#define sz(x) (ll)(x).size()
#define fill(a)  memset(a, 0, sizeof (a))
#define mp make_pair
#define pb push_back
#define fast  ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define in  freopen("input.txt","r",stdin);
#define out freopen("output.txt","w",stdout);
#define sixfive in out
typedef long double ld;
typedef std::pair<ll, ll> pii;
typedef std::vector<ll> vi;
const ll MOD = 1e9 + 7;
ll n_bits(ll n ) { ll x= __builtin_popcount(n) ;return x ;}
ll binpow(ll a, ll b, ll m=MOD)
{
    a%=m;
    ll res=1;
    while (b>0)
    {
        if (b&1)    res=res*a%m;
        a=a*a%m;
        b>>=1;
    }
    return res;
}
int main()
{
    #ifndef ONLINE_JUDGE
    sixfive
    #endif
    fast
    ll t=1;
    //cin>>t;
    while(t--)
    {
        int n,k;
        cin>>n>>k;
        int a[n];
        for(int i=0;i<n;i++)
        {
        	cin>>a[i];
        	if(a[i]!=k)
        		cout<<a[i]<<" ";
        }

    }
    return 0;
}

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

typedef long long LL;

#define REP(i, n) for(int i = 0; i < (int)(n); i++)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define ALL(x) (x).begin(),(x).end()
const int IINF = 1e9;
const LL LINF = 1e18;
const LL MOD = 1e9+7;

int main() {
    int N;
    cin >> N;
    vector<LL> A(N), T(N);
    REP(i, N) {
        cin >> A[i] >> T[i];
    }
    int Q;
    cin >> Q;
    vector<LL> X(Q);
    REP(i, Q) {
        cin >> X[i];
    }

    pair<LL, LL> range(-LINF, LINF);
    LL shift = 0;
    REP(i, N) {
        if(T[i] == 1) {
            shift += A[i];
            range.first += A[i];
            range.second += A[i];
        }
        if(T[i] == 2) {
            if(range.second <= A[i]) {
                range = make_pair(A[i], A[i]);
            }else if(A[i] <= range.first) {
                // 何もしない
            }else{
                range.first = A[i];
            }
        }
        if(T[i] == 3) {
            if(A[i] <= range.first) {
                range = make_pair(A[i], A[i]);
            }else if(range.second <= A[i]) {
                // 何もしない
            }else{
                range.second = A[i];
            }
        }
    }
    REP(i, Q) {
        LL low = range.first;
        LL high = range.second;
        LL r = min<LL>(max<LL>(X[i] + shift, low), high);
        cout << r << endl;
    }
    return 0;
}


#include <iostream>
#include <vector>
#include <string>
#include <deque>
#include <list>
#include <tuple>
#include <algorithm>
#include <set>

using namespace std;

uint64_t modValue[200] = {UINT64_MAX};
vector<int> pathOne[200];
int searchPath[200];
vector<uint64_t> all;

bool findFlg = false;

bool findTwo(int path[], int pathCount){
    uint64_t tempValue = 0;
    bool twoFlg = false;

    for(int count = 0; count < pathCount; count++){
        uint64_t value = all[(path[count] - 1)];
        tempValue += (value % 200);
    }
    tempValue = tempValue % 200;
    if(modValue[tempValue] == 1){
        cout << "Yes" << endl;
        cout << pathOne[tempValue].size() << " ";
        for(int count = 0; count < pathOne[tempValue].size(); count++){
            cout << pathOne[tempValue][count] << " ";
        }
        cout << endl;

        cout << pathCount << " ";
        for(int count = 0; count < pathCount; count++){
            cout << path[count] << " ";
        }
        cout << endl;

        twoFlg = true;
    } else {
        modValue[tempValue] = 1;
        for(int count = 0; count < pathCount; count++){
            pathOne[tempValue].push_back(path[count]);
        }
    }

    return twoFlg;
}

void solution(vector<uint64_t> all, int targetNum, int pathCount, int checkIndex) {
    if(pathCount == targetNum){
        if(findTwo(searchPath, pathCount)){
            findFlg = true;
        }
        return;
    }
    if(pathCount + all.size() - checkIndex == targetNum){
        for(int copyIndex = checkIndex; copyIndex < all.size(); copyIndex++){
            searchPath[pathCount] = copyIndex + 1;
            pathCount++;
        }
        if(findTwo(searchPath, pathCount)){
            findFlg = true;
        }
        return;

    }
    searchPath[pathCount] = checkIndex + 1;
    solution(all, targetNum, pathCount + 1, checkIndex + 1);
    if(findFlg){
        return;
    }

    solution(all, targetNum, pathCount, checkIndex + 1);
}

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

    for(int readCount = 1; readCount <= N; readCount++){
        uint64_t temp;
        cin >> temp;
        all.push_back(temp % 200);
    }

    for(int current = 1; current <= N; current++){
        solution(all, current, 0, 0);
        if(findFlg){
            break;
        }
    }

    if(!findFlg){
        cout << "No" << endl;
    }
}

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

using ll = long long;
using ull = unsigned long long;
using ld = long double;

#define MOD 1000000007LL

#define rep(i, n) for(ll (i) = 0LL;(i) < (ll)(n);(i)++)
#define rep2(i, s, e) for(ll (i) = (ll)(s);(i) < (ll)(e);(i)++)
#define repi(i, n) for(ll (i) = 0LL;(i) <= (ll)(n);(i)++)
#define repi2(i, s, e) for(ll (i) = (ll)(s);(i) <= (ll)(e);(i)++)
#define per(i, n) for(ll (i) = (ll)(n) - 1LL;(i) >= 0LL;(i)--)
#define per2(i, s, e) for(ll (i) = (ll)(s) - 1LL;(i) >= (ll)(e);(i)--)
#define peri(i, n) for(ll (i) = (ll)(n);(i) >= 0LL;(i)--)
#define peri2(i, s, e) for(ll (i) = (ll)(s);(i) >= (ll)(e);(i)--)
#define iter(i, it) for(auto &(i): (it))

template<typename T, typename U> ostream& operator<<(ostream &s, const pair<T, U> m) {
    cout << "(" << m.first << ", " << m.second << ")";
    return s;
}
template<typename T, typename U> ostream& operator<<(ostream &s, const map<T, U> m) {
    ll c = 0;
    cout << "{ ";
    iter(i, m) cout << i << (c++ == m.size() - 1 ? " " : ", ");
    cout << "}";
    return s;
}
template<typename T> ostream& operator<<(ostream &s, const vector<T> &v) {
    cout << "{ ";
    rep(i, v.size()) cout << v[i] << (i == v.size() - 1 ? " " : ", ");
    cout << "}";
    return s;
}
template<typename T> ostream& operator<<(ostream &s, const list<T> &v) {
    ll c = 0;
    cout << "{ ";
    iter(i, v) cout << i << (c++ == v.size() - 1 ? " " : ", ");
    cout << "}";
    return s;
}

int main(void) {
    ll a, b, c, d;
    cin >> a >> b >> c >> d;
    cout << b - c << endl;
    return 0;
}


#include <bits/stdc++.h>
#define pb push_back
#define fst first
#define snd second
#define fore(i,a,b) for(int i=a,ggdem=b;i<ggdem;++i)
#define SZ(x) ((int)x.size())
#define ALL(x) x.begin(),x.end()
#define mset(a,v) memset((a),(v),sizeof(a))
#define FIN ios::sync_with_stdio(0);cin.tie(0);cout.tie(0)
using namespace std;
typedef long long ll;

const ll MOD=998244353;

ll dp[102][102][10004];

int main(){FIN;
	ll n; cin>>n;
	vector<ll> a(n);
	fore(i,0,n)cin>>a[i];
	for(ll x=n;x>=0;x--){
		for(ll y=x;y>=0;y--){
			fore(z,0,10004){
				ll &res=dp[x][y][z];
				if(x==n){
					if(z==0)res=1;
					else res=0;
				}else{
					res=dp[x+1][y+1][z+a[x]]*(y+1);
					if(a[x]<=z){
						res=(res+dp[x+1][y][z-a[x]]*(x+1-y))%MOD;
					}else{
						res=(res+dp[x+1][x-y+1][a[x]-z]*(x+1-y))%MOD;
					}
				}
			}
		}
	}
	cout<<dp[0][0][0]<<"\n";

	return 0;
}

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

#ifdef LOCAL
#include "debug.hpp"
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
#define debug(...)
#endif

ll MOD = 998244353;

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

  ll N; cin >> N;
  vector<ll> W(N); for (ll i = 0; i < N; i++) cin >> W[i];
  ll SUM = 0;
  for (ll i = 0; i < N; i++) {
    SUM += W[i];
  }
  if (SUM % 2) {
    cout << 0 << '\n';
    return 0;
  }

  // i 番目までを見たとき、j個を使ってkを作る数
  SUM /= 2;
  vector<vector<ll>> dp(N + 1, vector<ll>(SUM + 1, 0));
  dp[0][0] = 1;
  for (ll i = 0; i < N; i++) {
    vector<vector<ll>> dp2 = dp;
    for (ll j = 0; j < N; j++) {
      for (ll k = 0; k < SUM + 1; k++) {
        ll w = k + W[i];
        if (w > SUM) continue;
        dp2[j + 1][w] += dp[j][k];
        dp2[j + 1][w] %= MOD;
      }
    }
    dp = dp2;
  }
  debug(dp);

  vector<ll> factorial(N + 1, 1);
  for (ll i = 1; i <= N; i++) {
    factorial[i] = factorial[i - 1] * i;
    factorial[i] %= MOD;
  }

  ll ans = 0;
  for (ll k = 0; k < N; k++) {
    ll temp = dp[k][SUM];
    temp = (temp * factorial[k]) % MOD;
    temp = (temp * factorial[N - k]) % MOD;
    ans = (ans + temp) % MOD;
  }

  cout << ans << '\n';
  return 0;
}


#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using pll = pair<ll, ll>;
using tlll = tuple<ll, ll, ll>;
//constexpr ll MOD = 1e9 + 7;
constexpr ll MOD = 998244353;
//constexpr ll MOD = ;
ll mod(ll A, ll M) {return (A % M + M) % M;}
constexpr ll INF = 1LL << 60;
template<class T> bool chmin(T& a, T b) {if (a > b) {a = b; return true;} return false;}
template<class T> bool chmax(T& a, T b) {if (a < b) {a = b; return true;} return false;}
ll divceil(ll A, ll B) {return (A + (B - 1)) / B;}
#define FINALANS(A) do {cout << (A) << '\n'; exit(0);} while (false)

int main()
{
  ll x, y;
  cin >> x >> y;

  if (x == y)
    cout << x << endl;
  else
    cout << 3 - x - y << endl;
}

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

// Big two primes
#define X 1001100011100001111ll
#define mod 1000000007
#define int long long
#define ll long long
#define all(a) a.begin(),a.end()
#define sortall(a) sort(all(a))
#define fo(i, n) for (int i = 0; i < n; i++)
#define fo1(i, n) for (int i = 1; i <= n; i++)
#define loop(i,a,b) for (int i = a; i < b; i++)
#define nloop(i,a,b) for (int i = a ; i>=b;i--)
#define tc(t) int t; cin >> t; while (t--)
#define arrip(a,n)  int a[n]; fo(i, n) cin >> a[i];
#define arrop(a,n)  fo(i,n) cout<<a[i]<<" ";
#define pb push_back
#define mp make_pair
#define itr(it, a) for(auto it = a.begin(); it != a.end(); it++)
#define PI 3.1415926535897932384626

#define fio ios_base::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL)
#define rr return 0
#define prec(n) fixed<<setprecision(n)
#define maxpq priority_queue<int>
#define minpq priority_queue<int, vector<int>, greater<int> >
#define inf (int)(1e18)
#define ini(a, i) memset(a, i, sizeof(a))
#define vi vector<int>
#define fi first
#define se second
#define endl "\n"
#define pi pair<int, int>
#define vpi vector<pi>
#define sz(s) s.size()
#define bits(n) __builtin_popcount(n)
//const int MAXN = (int)((1e5) +` 100);
//int gcd(int a, int b) { if (a == 0) return b; return gcd(b % a, a);}
int max(int a, int b) {if (a > b) return a; else return b;}
int min(int a, int b) {if (a < b) return a; else return b;}

void solve() {

	int n, x;
	cin >> n >> x;

	arrip(a, n);

	fo(i, n) {
		if (a[i] != x) {
			cout << a[i] << " ";
		}
	}
	cout << endl;
}
int32_t main()
{

	fio;

#ifndef ONLINE_JUDGE
	freopen("bi.txt", "r", stdin);
	freopen("bo.txt", "w", stdout);
#endif
	solve();

}


#include<iostream>
#include<cstdio>
#include<cstring>
using namespace std;
long long f[1000],g[1000];
long long n;
int tmp[1000];
int main()
{
	f[0]=0,f[1]=1;
	for(int n=2;n<=87;n++)
	{
		f[n]=f[n-1]+f[n-2];
		if(f[n]>1e18)break;
	}
	for(int i=0;i<=87;i+=2)g[i>>1]=f[i];
	scanf("%lld",&n);
	int lim=43;while(g[lim]>n)--lim;
	int tn=0;
	for(int i=lim;i>=1;i--)
	{
		while(n>=g[i])tmp[++tn]=2,n-=g[i];
		tmp[++tn]=4,tmp[++tn]=3;
	}
	printf("%d\n",tn);
	for(int i=1;i<=tn;i++)printf("%d\n",tmp[i]);
}

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

int f[114], n, num;
bool cur_op, yes;
queue <int> ans;
const int inf=1e18;

void init() {
	f[0]=1ll, f[1]=2ll;
	for(num=2;f[num-1]<=inf;++num)
		f[num]=f[num-1]+f[num-2]; --num;
	return ;
}

signed main() {
	cin>>n;init();
	for(int i=num; i>=0; --i) {
		while(n>=f[i]) {
			n-=f[i], ans.push(cur_op+1);
			yes=true;
		} cur_op^=1;
		if(yes) ans.push(cur_op+3);
	} cout<<ans.size()<<endl;
	while(!ans.empty())
		cout<<((ans.front()-1)^1)+1<<endl, ans.pop();
  return 0;
}


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

#define INF ((1<<30)-1)
#define LLINF (1LL<<60)
#define EPS (1e-10)

const ll mod = 1e9 + 7;

ll f1(ll n) {
    if (n < 0) return 0;
    ll res = n * (n + 1) / 2;
    return res % mod;
}

ll f2(ll n) {
    if (n < 0) return 0;
    ll res = f1(n);
    res %= mod;
    res *= res;
    res %= mod;
    return res;
}

void solve() {
    int n, a, b;
    cin >> n >> a >> b;
    ll x = ((f1(n - a - b + 1) * (n - b + 1) % mod) * (n - a + 1)) % mod;
    ll y = f2(n - a - b + 1) % mod;
    ll ans = (x*4) % mod - (y*4) % mod;
    cout << (ans + mod) % mod << endl;
}

int main() {
    int T;
    cin >> T;
    rep(t, T) {
        solve();
    }
}

#include<bits/stdc++.h>
#define debug(a) cout<<#a<<"="<<a<<endl
#define rep(i,a,b) for(ll i=a,i##end=b;i<=i##end;++i)
#define drep(i,a,b) for(ll i=a,i##end=b;i>=i##end;--i)
#define erep(i,a) for(ll i=hd[a],y;(y=to[i]);i=nxt[i])
typedef long long ll;
using namespace std;
char IO;
inline ll rd() {
	ll res=0,f=1;
	while(IO=getchar(),IO<48||IO>57)if(IO=='-')f=0;
	do res=(res<<3)+(res<<1)+(IO^48);
	while(IO=getchar(),IO>=48&&IO<=57);
	if(f)return res;
	return -res;
}
inline void Max(ll &a,ll b) {
	((a<b)&&(a=b));
}
inline void Min(ll &a,ll b) {
	((a>b)&&(a=b));
}
bool let;
const ll P=1e9+7;
bool vio;
int main() {
//	printf("%.3f",(&vio-&let)/1024.0/1024);
	ll T=rd();
	while(T--) {
		ll n=rd(),a=rd(),b=rd();
		if(a<b)swap(a,b);
		ll tot=(n-a+1)*(n-a+1)%P*(n-b+1)%P*(n-b+1)%P;
		if(a+b>n) {
			ll t=((1+n-a)*(n-a)%P+(a-b+1)*(n-a+1)%P)%P;
			printf("%lld\n",((tot-t*t%P)%P+P)%P);
		} else {
			ll t=((n-a-b+2+n-a)*(b-1)%P+(a-b+1)%P*(n-a+1)%P)%P;
			printf("%lld\n",((tot-t*t%P)%P+P)%P);
		}
	}
}


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

using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vc = vector<char>;
using vcc = vector<vc>;
using Pii = pair<int,int>;

int main(){
    int n,x;
    cin >> n >> x;
    for(int i = 0; i<n; i++){
        int a;
        cin >> a;
        if(a != x){
            cout << a << " ";
        }
    }
    cout << endl;
}

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

int main() {
  int n, x;
  cin >> n >> x;
  vector <char> data(n);
  for (int i = 0; i < n; i++){
    cin >> data.at(i);
  }

  for (int i = 0; i < n; i++){
    if (x == 0 and data.at(i) == 'x') continue;
    else{
    if (data.at(i) == 'o'){
      x += 1;
    }
    else x -= 1;
  }
}
  cout << x << endl;
}


//Codeforcesで128bit整数を使いたいとき
//→__int128_tを使う&GNU C++17 (64)で提出する

//インクルードなど
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;

//イテレーション
#define REP(i,n) for(ll i=0;i<ll(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=a;i<=ll(b);i++)
#define FORD(i,a,b) for(ll i=a;i>=ll(b);i--)
#define FORA(i,I) for(const auto& i:I)
//x:コンテナ
#define ALL(x) x.begin(),x.end()
#define SIZE(x) ll(x.size())
//定数
#define INF32 2147483647 //2.147483647×10^{9}:32bit整数のinf
#define INF64 9223372036854775807 //9.223372036854775807×10^{18}:64bit整数のinf
#define MOD 1000000007 //問題による
//略記
#define F first
#define S second
//出力(空白区切りで昇順に)
#define coutALL(x) for(auto i=x.begin();i!=--x.end();i++)cout<<*i<<" ";cout<<*--x.end()<<endl;

//aをbで割る時の繰上げ,繰り下げ
ll myceil(ll a,ll b){return (a+(b-1))/b;}
ll myfloor(ll a,ll b){return a/b;}

signed main(){
    ll M,H;

	cin >> M >> H;

	if (H % M == 0) cout << "Yes" << "\n";
	else cout << "No" << "\n";
}

#define _USE_MATH_DEFINES

#include <iostream>	//cin, cout
#include <vector>	//vector
#include <algorithm> //sort,min,max,count
#include <string>	//string,getline, to_string
#include <ios>		//fixed
#include <iomanip>	//setprecision
#include <utility> //swap, pair
#include <cstdlib>	//abs(int)
#include <cmath>	//sqrt,ceil,M_PI, pow, sin
#include <sstream>	//stringstream, getline
#include <numeric>	//gcd, accumlate
#include <deque>	//deque
#include <random>	//randam_device
#include <limits>	//numeric_limits

using namespace std;
constexpr long long int D_MOD = 1000000007;

int main() {

	int M, H;
	cin >> M >> H;

	if (H % M == 0) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}

	return 0;

}


#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <utility>
#include <set>
#include <map>
#include <cmath>
#include <queue>
#include <cstdio>
#include <limits>
#include <numeric>
#define rep(i,n) for(int i = 0; i < n; ++i)
#define rep1(i,n) for(int i = 1; i <= n; ++i)
using namespace std;
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; }
template<class T> inline int  sz(T &a) { return a.size(); }
using ll = long long; using ld = long double;
using pi = pair<int,int>; using pl = pair<ll,ll>;
using vi = vector<int>; using vvi = vector<vi>;
using vl = vector<ll>; using vvl = vector<vl>;
const int inf = numeric_limits<int>::max();
const ll infll = numeric_limits<ll>::max();
class Osa_k{
public:
  int max_number;
  vi min_factor;

  Osa_k(int N) : max_number(N) {
    Build();
  }

  void Build() {
    min_factor.resize(max_number+1);
    iota(min_factor.begin(),min_factor.end(), 0);
    for(int i = 2; i <= max_number; ++i) {
      if(min_factor[i] < i) continue;
      for(int j = 1; i*j <= max_number; ++j) {
        min_factor[i*j] = i;
      }
    }
  }

  vvi PrimeFactor() {
    vvi res(max_number+1);
    for(int i = 2; i <= max_number; ++i) {
      int num = i;
      while(num >= 2) {
        int factor = min_factor[num];
        res[i].push_back(factor);
        while(num % factor == 0) num /= factor;
      }
    }
    return res;
  }

  void Test() {
    vvi res = PrimeFactor();
    for(int i = 2; i <= max_number; ++i) {
      cout << i << "\n";
      for(auto tmp: res[i]) cout << tmp << " ";
      cout << "\n";
    }
  }

};
int main()
{
  ll l,r; cin >> l >> r;
  Osa_k os(r+1);
  vvi primeFactor = os.PrimeFactor();
  ll res = 0;
  for(int i = l; i <= r; ++i) {
    int n = sz(primeFactor[i]);
    rep1(S,(1<<n)-1){
      int prod = 1;
      rep(j,n) {
        if((S>>j)&1) prod *= primeFactor[i][j];
      }
      ll count = r/prod - (i-1)/prod;
      count -= r/i;
      if(__builtin_popcount(S) % 2 == 1) res += count;
      else res -= count;
    }
  }
  cout << res*2 << "\n";
  return 0;
}

#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e6 + 10;
typedef long long ll;
ll f[maxn], g[maxn];
ll ans;
ll sqr(ll x) { return x * x;}
ll calcg(int l, int r)
{
	return sqr(r - l + 1);
}
ll calcf(int l, int r)
{
	l = max(l, 2);
	if(l > r) return 0;
	return sqr(r - l + 1);
}
int main()
{
	int l, r;
	scanf("%d%d", &l, &r);
	for(int i = r; i >= 2; --i)
	{
		f[i] = calcf((l + i - 1) / i, r / i);
		g[i] = calcg((l + i - 1) / i, r / i);
		for(int j = i + i; j <= r; j += i)
		{
			g[i] -= g[j];
			f[i] -= g[j];
		}
		ans += f[i];
	}
	printf("%lld\n", ans);
	return 0;
}


#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, int> pli;

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

    int n, m;
    cin >> n >> m;
    vector<vector<tuple<int, int, int>>> adj(n);

    while (m--) {
        int a, b, c, d;
        cin >> a >> b >> c >> d;
        --a, --b;
        adj[a].emplace_back(b, c, d);
        adj[b].emplace_back(a, c, d);
    }
    constexpr ll INF = 1LL << 60;
    vector<ll> dist(n, INF);
    dist[0] = 0;

    priority_queue<pli, vector<pli>, greater<pli>> pq;
    pq.push(pli(0, 0));

    auto rounding = [&](ll t, int d) -> int {
        int ct = static_cast<int>(sqrt(d)) - t - 1;
        if (ct < 0) {
            return 0;
        }
        int diff1 = d / (t + 1) - d / (t + ct + 1) - ct;
        int diff2 = d / (t + 1) - d / (t + ct + 2) - ct - 1;
        if (diff1 < 0 && diff2 < 0) {
            return 0;
        } else {
            return diff1 > diff2 ? ct : ct + 1;
        }
    };

    while (!pq.empty()) {
        auto [t, v] = pq.top();
        pq.pop();

        if (t != dist[v]) {
            continue;
        }

        for (auto [u, c, d] : adj[v]) {
            int extra = rounding(t, d);
            ll nt = t + c + extra + d / (t + extra + 1);
            if (nt < dist[u]) {
                dist[u] = nt;
                pq.push(pli(nt, u));
            }
        }
    }

    cout << (dist[n - 1] == INF ? -1LL : dist[n - 1]) << "\n";
    return 0;
}

//Shrey Dubey

#include<iostream>
#include<string>
#include<algorithm>
#include<map>
#include<unordered_map>
#include<vector>
#include<set>
#include<list>
#include<iomanip>
#include<queue>
#include<stack>
#include <math.h>
#include<climits>
#include<bitset>
#include<cstring>
#include<numeric>
#include<array>

using namespace std;
typedef long long ll;
typedef long double ld;

#define YES cout<<"YES\n"
#define Yes cout<<"Yes\n"
#define NO cout<<"NO\n"
#define No cout<<"No\n"
#define prDouble(x) cout<<fixed<<setprecision(10)<<x //to print decimal numbers
#define pb push_back
#define ff first
#define sec second
#define umap unordered_map
#define mp make_pair
#define KOBE ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define fo(n) for(ll i = 0; i<n; i++)
#define fnd(stl, data) find(stl.begin(), stl.end(), data)
#define forn(x,n) for(ll x = 0; x<n; x++)
#define imax INT_MAX
#define lmax LLONG_MAX
#define imin INT_MIN
#define lmin LLONG_MIN
#define vi vector<int>
#define vl vector<ll>
#define vp vector<pair<ll,ll> >
#define vb vector<bool>
#define pr(t) cout<<t<<"\n"
#define int long long
#define ql queue<ll>
#define qp queue<pair<ll,ll> >
#define endl "\n"
#define nl cout<<"\n"
#define re cin >>
#define pll pair<ll,ll>
#define FOR(a,b) for(ll i = a; i<=b; i++)
#define all(x) x.begin(),x.end()

// ll dx[] = {1,0,-1,0};
// ll dy[] = {0,1,0,-1};

ll mod = 1e9 + 7;

ll cl(ld a){
    if(a>(ll) a){
        return (ll)a+1;
    }
    else{
        return (ll)a;
    }
}

ll flr(ld a){
    if(a < 0.0){
        return (ll) a - 1;
    }
    return (ll) a;
}

//code starts here

ll n,m,q;
vp pos;

void solve(){
    re n;
    pos.resize(n);
    fo(n){
        re pos[i].ff; re pos[i].sec;
    }
    re m;
    pll x = mp(1,0);
    pll y = mp(1,0);
    vp oper(m);
    fo(m){
        re oper[i].ff;
        if(oper[i].ff == 3 || oper[i].ff == 4){
            re oper[i].sec;
        }
    }
    re q;
    vector<pair<pll,ll> > qry(q);
    fo(q){
        re qry[i].ff.ff; re qry[i].ff.sec;
        qry[i].sec = i;
    }
    sort(qry.begin(),qry.end());
    vp ans(q);
    bool swp = false;
    ll a = 0;
    fo(q){
        ll curop = qry[i].ff.ff;
        ll posn = qry[i].ff.second;
        posn--;
        ll idx = qry[i].sec;
        // cout<<curop<<"()"<<posn<<"\n";
        while(a != curop){
            ll op = oper[a].ff;
            if(op == 1){
                auto temp = x;
                x = y;
                y = temp;
                y.ff *= -1;
                y.sec *= -1;
                swp = !swp;
            }else if(op == 2){
                auto temp = x;
                x = y;
                y = temp;
                x.ff *= -1;
                x.sec *= -1;
                swp = !swp;
            }else if(op == 4){
                ll p = oper[a].sec;
                y.sec = 2*p-y.second;
                y.ff *= -1;
            }else{
                ll p = oper[a].sec;
                x.sec = 2*p-x.sec;
                x.ff *= -1;
            }
            a++;
        }
        ll xp = pos[posn].ff, yp = pos[posn].sec;
        if(swp){
            swap(xp,yp);
        }
        xp *= x.ff; xp += x.sec;
        yp *= y.ff; yp += y.sec;
        ans[idx] = mp(xp,yp);
    }
    for(auto p: ans) cout<<p.ff<<" "<<p.sec<<"\n";
}

int32_t main(){
    KOBE;
    ll t;
    t = 1;
    // re t;
    while(t--) solve();
}

//common errors
// row - n, col - m always and loop var
// see the freq of numbers carefully
// see if there's array overflow
// use map for large inputs

//problem ideas
//check piegonhole wherever possible
//there might be many instances of limited answers like 0,1,2 only
// see suffix and prefix
//don't be obsessed with binary search
// try to find repeating pattern in matrices

/*
1
1 2
4
1
3 3
2
4 2
5
0 1
1 1
2 1
3 1
4 1
*/


#include <stdio.h>
#include <algorithm>
long long n;
long long a[400000];
int b[400000];
int q[400000];
int e;
int main() {
	scanf("%lld", &n);
	for (long long i = 0; i < 2 * n; i++) {
		scanf("%lld", a + i);
		a[i] *= 2 * n;
		a[i] += i;
	}
	std::sort(a, a + 2 * n);
	for (int i = 0; i < n; i++) {
		b[a[i] % (2 * n)]++;
	}
	if (b[0]) {
		for (int i = 0; i < 2 * n; i++) {
			b[i] = 1 - b[i];
		}
	}
	for (int i = 0; i < 2 * n; i++) {
		if (e) {
			if (q[e - 1] == b[i]) {
				q[e] = b[i];
				e++;
				printf("(");
				continue;
			}
			else {
				e--;
				printf(")");
				continue;
			}
		}
		else {
			q[e] = b[i];
			e++;
			printf("(");
			continue;
		}
	}
	printf("\n");
}

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

void solve() {
    int n;
    cin>>n;
    n*=2;
    vector<vector<int>> a(n, vector<int> (2));
    for(int i=0; i<n; i++) {
        cin>>a[i][0];
        a[i][1]=i;
    }
    sort(a.begin(), a.end());
    for(int i=0; 2*i<n; i++) {
        a[a[i][1]][0]*=-1;
    }
    string ans(n, '(');
    int pos=0, neg=0;
    for(int i=0; i<n; i++) {
        if(a[i][0]<0) {
            if(pos) {
                ans[i]=')';
                pos--;
            } else {
                neg++;
            }
        } else {
            if(neg) {
                ans[i]=')';
                neg--;
            } else {
                pos++;
            }
        }
    }
    cout<<ans<<endl;
    return;
}

int main() {
#ifdef bipinpathak
    (void)!freopen("input.txt", "r", stdin);
    (void)!freopen("output.txt", "w", stdout);
#endif
    ios::sync_with_stdio(false);
    cin.tie(NULL);
    auto start=clock();
    int t = 1;
    //cin>>t;
    for(int i=0; i<t; i++) {
        //cout<<"Case #"<<i+1<<": ";
        solve();
    }
    double used= (double) (clock()-start);
    used=(used*1000)/CLOCKS_PER_SEC;
    cerr<<fixed<<setprecision(2)<<used<<" ms"<<endl;
    return 0;
}


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

template<typename T>
void out(T x) { cout << x << endl; exit(0); }
#define watch(x) cout << (#x) << " is " << (x) << endl

using ll = long long;

const int maxn = 1e6 + 5;

int n;
int a[maxn],b[maxn],p[maxn],pinv[maxn];

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

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

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

    for (int i=1; i<=n; i++) {
	if (i==p[i]) continue;
	if (a[i] > b[p[i]]) continue;
	out(-1);
    }

    vector<pair<int,int>> ans;

    vector<int> ord(n);
    iota(ord.begin(),ord.end(),1);
    sort(ord.begin(),ord.end(),[&](int i, int j) {
	return a[i]<a[j];
    });

    // a[i] > b[p[i]]
    // a[j] > b[p[j]]
    // a[i] <= a[j], implies b[p[i]] < b[p[j]]

    for (int i: ord) {
	if (i==p[i]) continue;
	int j = pinv[i];
	int tmpi = p[i];
	int tmpj = p[j];
	swap(p[i],p[j]);
	pinv[tmpj]=i;
	pinv[tmpi]=j;
	assert(i==p[i]);
	ans.emplace_back(i,j);
    }

    cout<<ans.size()<<endl;
    for (auto p: ans) cout<<p.first<<" "<<p.second<<"\n";

    return 0;
}

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

// template {{{
#define  range(i, l, r) for (int i = (int)(l); i < (int)(r); (i) += 1)
#define rrange(i, l, r) for (int i = (int)(r) - 1; i >= (int)(l); (i) -= 1)

#define  whole(f, x, ...) ([&](decltype((x)) container) { return (f)(  begin(container),  end(container), ## __VA_ARGS__); })(x)
#define rwhole(f, x, ...) ([&](decltype((x)) container) { return (f)( rbegin(container), rend(container), ## __VA_ARGS__); })(x)

#define debug(x) cerr << "(" << __LINE__ << ")" << #x << ": " << (x) << endl

using i32 = int;
using u32 = unsigned int;
using i64 = long long;
using u64 = unsigned long long;

constexpr i32 mod   = 1e9 + 7;
// constexpr i32 mod   = 998244353;

constexpr i32 inf   = 1001001001;
constexpr i64 infll = 1001001001001001001ll;

constexpr i32 dx[] = {0, -1, 1, 0, -1, 1, -1, 1};
constexpr i32 dy[] = {-1, 0, 0, 1, -1, -1, 1, 1};

struct IoSetup { IoSetup(i32 x = 15){ cin.tie(0); ios::sync_with_stdio(0); cout << fixed << setprecision(x); cerr << fixed << setprecision(x); } } iosetup;

template <typename T = i64> T input() { T x; cin >> x; return x; }

template <typename T> ostream &operator<<(ostream &os, vector<T> &v) { range(i, 0, v.size()) { os << v[i] << (i + 1 != (int)v.size() ? " " : ""); } return os; }
template <typename T> istream &operator>>(istream &is, vector<T> &v) { for (T &in : v) is >> in; return is; }

template <typename T1, typename T2> ostream &operator<<(ostream &os, pair<T1, T2> p) { os << "(" << p.first << ", " << p.second << ")"; return os; }
template <typename T1, typename T2> istream &operator>>(istream &is, pair<T1, T2> &p) { is >> p.first >> p.second; return is; }

template <typename T> vector<T> make_vector(size_t a, T b) { return vector<T>(a, b); }
template <typename... Ts> auto make_vector(size_t a, Ts... ts) { return vector<decltype(make_vector(ts...))>(a, make_vector(ts...)); }

template <typename T1, typename T2> inline bool chmax(T1 &a, T2 b) { return a < b && (a = b, true); }
template <typename T1, typename T2> inline bool chmin(T1 &a, T2 b) { return a > b && (a = b, true); }
// }}}

void solve() {
  int n = input();
  vector< int > as(n), bs(n), ps(n);
  cin >> as >> bs >> ps;

  for (auto &p : ps) p--;

  vector< int > used(n, false);

  bool valid = true;
  vector< pair< int, int > > ans;

  for (int v = 0; v < n; v++) {
    if (used[v]) continue;

    vector< int > us;
    us.emplace_back(v);
    used[v] = true;

    for (int u = ps[v]; u != v; u = ps[u]) {
      us.emplace_back(u);
      used[u] = true;
    }

    if ((int)us.size() == 1) continue;

    int min_b = inf;
    int idx_b = -1;

    for (int i = 0; i < (int)us.size(); i++) {
      int u = us[i];
      if (as[u] <= bs[ps[u]]) {
        valid = false;
      }

      if (bs[ps[u]] < min_b) {
        min_b = bs[ps[u]];
        idx_b = i;
      }
    }

    int sz = us.size();
    for (int i = (idx_b - 1 + sz) % sz; i != idx_b; i = (i - 1 + sz) % sz) {
      ans.emplace_back(us[i] + 1, us[(i + 1) % sz] + 1);
    }
  }

  if (not valid) {
    cout << -1 << endl;
    return;
  }

  cout << (int)ans.size() << endl;
  for (auto &t : ans) {
    cout << t.first << " " << t.second << endl;
  }
}

signed main() {
  solve();
}


#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(ll i = 0; i < (n); ++i)
#define repA(i, a, n) for(ll i = a; i < (n); ++i)
#define repD(i, a, n) for(ll i = a; i > (n); --i)
#define trav(a, x) for(auto& a : x)
#define all(x) x.begin(), x.end()
#define sz(x) (long long) (x).size()
#define fill(a) memset(a, 0, sizeof(a))
#define fst first
#define snd second
// #define mp make_pair
#define pb push_back

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 dbg(x...) cout << "[" << #x << "] = ["; _print(x)
#else
#define dbg(x...)
#endif
const long double PI = 3.141592653589793238462643383;
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<long long int> vll;
typedef vector<double> vd;
typedef vector<pii> vii;
long long Ceil(long long a, long long b){
    if(a%b==0) return a/b;
    else return (a/b)+1;
}
ll p=1000000007;
// ll p = 1000000000000000000+5;
float E = 0.00000000000001;
ll power(ll x, ll y){
    if(y==0){
        return 1;
    }
    if(y%2==0){
        ll q=power(x,y/2);
        q=q%p;
        return (q*q)%p;
    }
    ll q=power(x,y/2);
    q=q%p;
    return ((x%p)*((q*q)%p))%p;
}
bool isPowerOfTwo (long long x)
{
    /* First x in the below expression is for the case when x is 0 */
    return x && (!(x&(x-1)));
}

long long int gcd(long long int a, long long int b){
    if (a == 0)
        return b;
    return gcd(b % a, a);
}
long long int mod(long long int a, long long int b) {
    long long int ret = a%b; return ret>=0? ret: ret+b;
}

int main(){
    std::ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif
    int t = 1;
    // cin>>t;
    while(t--){
        float a,b;
        cin>>a>>b;
        std::cout << std::fixed << std::setprecision(2);
        cout<<abs((b/a-1)*100);
    }
    return 0;
}

#include <algorithm>
#include <iostream>

int main() {
  int A, B;
  std::cin >> A >> B;
  std::cout << 100.0 * (1.0 - 1.0 * B / A) << std::endl;
  return 0;
}


#include <bits/stdc++.h>
//#include <atcoder/all>
#define rep(i,n,a) for(int i = a; i < (int)(n); i++)

using namespace std;

typedef long long ll;
typedef unsigned long long u_ll;
typedef pair<int, int> pair_;

const int INF = 1001001001;
const int dx[] = {-1, 0, 1, 0};
const int dy[] = {0, -1, 0, 1};
int k;
template<class T> void chmin(T& a, T b){
    if(a>b) a=b;
}
int main(){
    int n, m;
    cin >> n >> m;
    vector<ll> a(n), b(m);
    rep(i, n, 0) cin >> a[i];
    rep(i, m, 0) cin >> b[i];

    vector<vector<int>> dp(n+1, vector<int>(m+1, INF));
    int ans=0;
    if(n<m){
        rep(i, n, 0) if(a[i]!=b[i]) ans++;
        ans+=m-n;
    }
    else{
        rep(i, m, 0) if(a[i]!=b[i]) ans++;
        ans+=n-m;
    }

    //cout << ans << " ";

    dp[0][0]=0;

    rep(i, n+1, 0){
        rep(j, m+1, 0){
            if(i>0 && j>0){
                if(a[i-1]==b[j-1]){
                    chmin(dp[i][j], dp[i-1][j-1]);
                }
                else{
                    chmin(dp[i][j], dp[i-1][j-1]+1);
                }
            }
            if(i>0) chmin(dp[i][j], dp[i-1][j]+1);
            if(j>0) chmin(dp[i][j], dp[i][j-1]+1);
        }
    }
    ans=min(ans, dp[n][m]);
    cout << ans;

    return 0;
}

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> VI;
typedef vector<VI> VVI;
typedef pair<ll, ll> P;
#define FOR(i,a,b) for(ll i=ll(a);i<ll(b);++i)
#define rep(i,n)  FOR(i,0,n)
#define PRINT(V) for (auto v : (V)) cout << v << " "
#define ALL(n) begin(n),end(n)
struct cww{cww(){ios::sync_with_stdio(false);cin.tie(0);}}star;
const ll INF = numeric_limits<ll>::max();
const char clist[4] = {'A', 'T', 'C', 'G'};
int main()
{
    int n; cin >> n;
    string s; cin >> s;

    VI a(n+1), t(n+1), c(n+1), g(n+1);
    rep(i, n) {
        a[i+1] = a[i] + (s[i] == 'A');
        t[i+1] = t[i] + (s[i] == 'T');
        c[i+1] = c[i] + (s[i] == 'C');
        g[i+1] = g[i] + (s[i] == 'G');
    }
    ll ans = 0;
    rep(i, n) {
        for(int l=2; l<=n ; l = l+2) {
            if (i+l > n) continue;
            if ((a[i+l] - a[i] == t[i+l] - t[i])&&(c[i+l] - c[i] == g[i+l] - g[i])) {
                ++ans;
            }
        }
    }
    cout << ans << endl;
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int(i) = 0; (i) < (n); (i)++)
#define FOR(i, m, n) for(int(i) = (m); (i) < (n); (i)++)
#define All(v) (v).begin(), (v).end()
#define pb push_back
#define MP(a, b) make_pair((a), (b))
template <class T> vector<T> make_vec(size_t a, T val) {
    return vector<T>(a, val);
}
template <class... Ts> auto make_vec(size_t a, Ts... ts) {
    return vector<decltype(make_vec(ts...))>(a, make_vec(ts...));
}
using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using Graph = vector<vector<int>>;
template <typename T> struct edge {
    int to;
    T cost;
    edge(int t, T c) : to(t), cost(c) {}
};
template <typename T> using WGraph = vector<vector<edge<T>>>;
const int INF = 1 << 30;
const ll LINF = 1LL << 60;
const int MOD = 1e9 + 7;

int main() {
    int x;
    cin >> x;
    if(x < 0) {
        cout << 0 << endl;
    } else {
        cout << x << endl;
    }
}

#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
int main()
{
      ios_base::sync_with_stdio(0);
      cin.tie(0);
      cout.tie(0);
      string a;
  cin>>a;
  ll n=a.size();
  ll i;
  bool ok=true;
  for(i=0;i<n;i++)
  {
    if((i+1)%2!=0 && int(a[i])<=90 && int(a[i])>=65)
      ok=false;
	else if((i+1)%2==0 && int(a[i])<=120 && int(a[i])>=97)
      ok=false;
  }
  if(ok)
    cout<<"Yes";
  else
    cout<<"No";
    return 0;
}


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

int main() {
  int n;
  cin >> n;
  vector<pair<int, int>> coords;
  for (int i = 0; i < n; ++i) {
    int x, y;
    cin >> x >> y;
    coords.push_back({x, y});
  }
  for (int i = 0; i < n; ++i) {
    for (int j = i + 1; j < n; ++j) {
      for (int k = j + 1; k < n; ++k) {
        if ((coords[j].first - coords[i].first) * (coords[k].second - coords[i].second) == (coords[k].first - coords[i].first) * (coords[j].second - coords[i].second)) {
          cout << "Yes\n";
          return 0;
        }
      }
    }
  }
  cout << "No\n";
  return 0;
}

#include <bits/stdc++.h>
#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=a;i<=(ll)(b);i++)
#define FORD(i,a,b) for(ll i=a;i>=(ll)(b);i--)
#define ALL(x) (x).begin(),(x).end()
#define SIZE(x) ((ll)(x).size())
#define MAX(x) *max_element(ALL(x))
#define MIN(x) *min_element(ALL(x))
#define INF 1000000000
using namespace std;
typedef long long ll;

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

    int x[N], y[N];
    REP(i, N){
        cin >> x[i] >> y[i];
    }

    bool flag = false;
    FOR(i, 0, N-3){
        FOR(j, i+1, N-2){
            FOR(k, j+1, N-1){
                int resx, resy, posx, posy;
                resx = x[k] - x[i];
                resy = y[k] - y[i];
                posx = x[j] - x[i];
                posy = y[j] - y[i];

                //cout << i << " " << j << " " << k << endl;
                //cout << resx*posx + resy*posy << endl;
                if(resx*posy - resy*posx == 0){
                    flag = true;
                    break;
                }
            }
        }
    }

    if(flag) cout << "Yes" << endl;
    else cout << "No" << endl;

    return 0;
}


// #include <bits/stdc++.h>
#include <algorithm>
#include <cmath>
#include <iostream>
#include <map>
#include <vector>
#define int long long
#define all(a) a.begin(), a.end()
#define vi vector<int>
#define pii pair<int, int>
#define fe(i, a, b) for (int i = a; i <= (b); ++i)
#define fr(i, a, b) for (int i = b; i >= (a); --i)
using namespace std;

inline int in() {
    int s = 0, f = 0, ch = getchar();
    while (!isdigit(ch))
        f |= ch == '-', ch = getchar();
    while (isdigit(ch))
        s = (s << 3) + (s << 1) + (ch ^ 48), ch = getchar();
    return f ? -s : s;
}
const int N = 1e6 + 5;
const int mod = 998244353;
const int inf = ~(1ULL << 63);
int n, m, k;
int a[N], b[N], f[N];
int c[N];

int qp(int a, int b) {
    int sum = 1;
    while (b) {
        if (b & 1)
            sum = sum * a % mod;
        a = a * a % mod;
        b >>= 1;
    }
    return sum;
}
int inv(int a) {
    return qp(a, mod - 2);
}
bool flag[N];
int p[N], tot;

int find(int x) {
    return x == f[x] ? x : f[x] = find(f[x]);
}

struct node {
    int x, y;
};

int toint(string s, int r) {
    int ans = 0;
    for (auto i : s) {
        ans = ans * r + i - 48;
    }
    return ans;
}

node ve[N + 1];
void work() {
    n = in(), m = in();
    fe(i, 1, n) { a[i] = in(); }
    int tot = 0;
    fe(i, 1, m) { f[a[i]]++; }
    for (; f[tot]; tot++)
        ;

    int ans = tot;
    fe(i, 1, n - m) {
        f[a[i]]--;
        f[a[i + m]]++;
        if (f[a[i]] == 0 && tot > a[i]) {
            tot = a[i];
        }
        ans = min(ans, tot);
    }
    cout << ans;
}
signed main() {
#ifndef ONLINE_JUDGE
    freopen("1.in", "r", stdin);
    freopen("1.out", "w", stdout);
#endif
    // for (int _ = in(); _; --_)
    work();
    // system("pause");
    return 0;
}

#include <cstdio>
#include <vector>

typedef long long LL;
const int Mod = 998244353;
const int MN = 55;

int N, K, A[MN][MN], Ans;
std::vector<int> G[MN];

int c, vis[MN];
void DFS(int u) {
	vis[u] = 1;
	Ans = (LL)Ans * ++c % Mod;
	for (int v : G[u]) if (!vis[v]) DFS(v);
}

int main() {
	scanf("%d%d", &N, &K), Ans = 1;
	for (int i = 1; i <= N; ++i)
		for (int j = 1; j <= N; ++j)
			scanf("%d", &A[i][j]);
	for (int i = 1; i <= N; ++i)
		for (int j = 1; j <= N; ++j) if (i < j) {
			int ok = 1;
			for (int k = 1; k <= N; ++k)
				if (A[i][k] + A[j][k] > K)
					ok = 0;
			if (ok)
				G[i].push_back(j),
				G[j].push_back(i);
		}
	for (int i = 1; i <= N; ++i) if (!vis[i]) c = 0, DFS(i);
	for (int i = 1; i <= N; ++i) G[i].clear(), vis[i] = 0;
	for (int i = 1; i <= N; ++i)
		for (int j = 1; j <= N; ++j) if (i < j) {
			int ok = 1;
			for (int k = 1; k <= N; ++k)
				if (A[k][i] + A[k][j] > K)
					ok = 0;
			if (ok)
				G[i].push_back(j),
				G[j].push_back(i);
		}
	for (int i = 1; i <= N; ++i) if (!vis[i]) c = 0, DFS(i);
	printf("%d\n", Ans);
	return 0;
}


#include <bits/stdc++.h>

#define int long long

#define pii pair<int, int>

#define x1 x1228
#define y1 y1228

#define left left228
#define right right228

#define tm tm228

#define pb push_back
#define eb emplace_back

#define mp make_pair

#define ff first
#define ss second

#define all(x) x.begin(), x.end()
#define debug(x) cout << #x << ": " << x << endl;
#define TIME (ld)clock()/CLOCKS_PER_SEC

using namespace std;
typedef long long ll;
typedef long double ld;

const int maxn = 3e5 + 7, mod = 1e9 + 7, MAXN = 1e6 + 7;
const double eps = 1e-9;
const ll INF = 1e18, inf = 1e15;
mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());
int n;
int a[maxn], b[maxn];

void solve() {
    cin >> n;
    for (int i = 0; i < n; ++i) cin >> a[i];
    for (int i = 0; i < n; ++i) cin >> b[i];
    int cur = 0;
    for (int i = 0; i < n; ++i) cur += a[i];
    vector<int> odd, even;
    for (int i = 0; i < n; i += 2) odd.pb(b[i] - a[i]);
    for (int i = 1; i < n; i += 2) even.pb(b[i] - a[i]);
    sort(all(odd));
    reverse(all(odd));

    sort(all(even));
    reverse(all(even));

    int ans = cur;
    int c = 0;
    for (int i = 0; i < n / 2; ++i) {
        c += odd[i] + even[i];
        ans = max(ans, cur + c);
    }
    cout << ans;
}

signed main() {
#ifdef LOCAL
    freopen("TASK.in", "r", stdin);
    freopen("TASK.out", "w", stdout);
#else

#endif // LOCAL
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.precision(20);
    cout << fixed;
    int t = 1;
    for (int i = 0; i < t; ++i) {
        solve();
    }
    return 0;
}

#include<iostream>
#include<stdio.h>
#include<math.h>
#include<string>
#include<string.h>
#include<algorithm>
#include<vector>
#include<set>
#define ll long long
const int maxn = 2e5 + 10;
using namespace std;
int m = 0, n, cha[maxn], l, r, qz[maxn], a[maxn], b[maxn];
int main(){
    ll res = 0;
    scanf("%d", &n);
    for (int i = 0; i < n; ++i) {
        scanf("%d", &a[i]);
    }
    for (int i = 0; i < n; ++i) {
        scanf("%d", &b[i]); res += b[i];
    }
    for (int i = 0; i < n; ++i) {
        if(i & 1) qz[i / 2] = a[i] - b[i];
        else cha[i / 2] = a[i] - b[i];
    }
    sort(qz, qz + n / 2);
    reverse(qz, qz + n / 2);
    sort(cha, cha + n / 2); reverse(cha, cha + n / 2);
    while (m < n / 2){
        if(qz[m] + cha[m] <= 0) break;
        else {
            res += qz[m] + cha[m]; m++;
        }
    }
    printf("%lld\n", res);
}


#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pll = pair<long long, long long>;
constexpr char ln =  '\n';
constexpr long long MOD = 1000000007;
constexpr long long INF = 1000000000 + 100;
constexpr long long LINF = 1000000000000000000 + 100;
#define all(v) v.begin(), v.end()
#define rep(i, n) for(int i=0;i<(n);i++)
#define rept(i, j, n) for(int i=(j); i<(n); i++)
#define rrep(i, n) for(int i=(n); i>=0; 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; }

int dx[4] = {0,1,0,1};
int dy[4] = {0,0,1,1};

int main(){
    int H, W; cin >> H >> W;
    vector<string> g(H); rep(i, H)cin >> g[i];

    int res = 0;
    rep(i, H-1){
        rep(j, W-1){
            int b = 0;
            rep(k, 4)if(g[i+dy[k]][j+dx[k]]=='#')b++;
            if(b%2==1)res++;
        }
    }
    cout << res << ln;
}

#include <bits/stdc++.h>
using namespace std;
#define ALL(x) (x).begin(),(x).end()
#define COUT(x) cout<<(x)<<"\n"
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define REP(i,n) for(int i=0;i<n;i++)
#define YES(x) cout<<(x?"YES":"NO")<<"\n"
#define Yes(x) cout<<(x?"Yes":"No")<<"\n"
#define dump(x) cout<<#x<<" = "<<(x)<<"\n"
#define endl "\n"
using G = vector<vector<int>>;
using M = map<int,int>;
using P = pair<int,int>;
using PQ = priority_queue<int>;
using PQG = priority_queue<int,vector<int>,greater<int>>;
using V = vector<int>;
using ll = long long;
using edge = struct { int to; int cost; };
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(b<a){a=b; return 1;} return 0;}
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;

int main() {
  IOS;
  string a,b;
  cin >> a >> b;
  int suma=0,sumb=0;
  REP(i,a.size()) {
    suma += a[i] - '0';
  }
  REP(i,b.size()) {
    sumb += b[i] - '0';
  }
  COUT(max(suma, sumb));

  return 0;
}


#include <bits/stdc++.h>

const long long INF = 1e9;
const long long MOD = 1e9 + 7;
//const long long MOD = 998244353;
const long long LINF = 1e18;
using namespace std;

#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define POSSIBLE(n) cout << ((n) ? "POSSIBLE" : "IMPOSSIBLE"  ) << endl
#define Possible(n) cout << ((n) ? "Possible" : "Impossible"  ) << endl
#define dump(x)  cout << #x << " = " << (x) << endl
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) for(int i=0;i<(n);++i)
#define REPR(i,n) for(int i=n;i>=0;i--)
#define COUT(x) cout<<(x)<<endl
#define SCOUT(x) cout<<(x)<<" "
#define VECCOUT(x) for(auto&youso_: (x) )cout<<right<<setw(10)<<youso_<<" ";cout<<endl
#define ENDL cout<<endl
#define CIN(...) int __VA_ARGS__;CINT(__VA_ARGS__)
#define LCIN(...) long long __VA_ARGS__;CINT(__VA_ARGS__)
#define SCIN(...) string __VA_ARGS__;CINT(__VA_ARGS__)
#define VECCIN(x) for(auto&youso_: (x) )cin>>youso_
#define mp make_pair
#define PQ priority_queue<long long>
#define PQG priority_queue<long long,V,greater<long long>>

typedef long long ll;
typedef vector<long long> vl;
typedef vector<long long> vi;
typedef vector<bool> vb;
typedef vector<char> vc;
typedef vector<vl> vvl;
typedef vector<vi> vvi;
typedef vector<vb> vvb;
typedef vector<vc> vvc;
typedef pair<long long, long long> pll;

#define COUT(x) cout<<(x)<<endl
void CINT(){}
template <class Head,class... Tail>
void CINT(Head&& head,Tail&&... tail){
    cin>>head;
    CINT(move(tail)...);
}
template<class T>
void mod(T &x) {
    x %= MOD;
    x += MOD;
    x %= MOD;
}

ll GCD(ll a, ll b) {
    if(b == 0) return a;
    else return GCD(b, a%b);
}

struct COMB{
    vl fact, fact_inv, inv;
    void init_nCk(long long SIZE) {
        fact.resize(SIZE + 5);
        fact_inv.resize(SIZE + 5);
        inv.resize(SIZE + 5);
        fact.at(0) = fact.at(1) = fact_inv.at(0) = fact_inv.at(1) = inv.at(1) = 1;
        for(long long i = 2; i < SIZE + 5; i++) {
            fact.at(i) = fact.at(i - 1)*i%MOD;
            inv.at(i) = MOD - inv.at(MOD%i)*(MOD/i)%MOD;
            fact_inv.at(i) = fact_inv.at(i - 1)*inv.at(i)%MOD;
        }
    }
    long long nCk (long long n, long long k) {
        assert(!(n < k));
        assert(!(n < 0 || k < 0));
        return fact.at(n)*(fact_inv.at(k)*fact_inv.at(n - k)%MOD)%MOD;
    }
};
ll extGCD(ll a, ll b, ll &x, ll &y) {
    if(b == 0) {
        x = 1;
        y = 0;
        return a;
    }
    ll d = extGCD(b, a%b, y, x);
    y -= a/b*x;
    return d;
}

void Main() {
    LCIN(A, B, C, D);
    ll ans = (A + C*D - B - 1)/(C*D - B);
    if(C*D - B <= 0) cout << -1 << endl;
    else cout << ans << endl;
}

int main() {
    cout << fixed << setprecision(15);
    Main();
    return 0;
}

#include <bits/stdc++.h>
#define ll long long
#define fastio ios_base::sync_with_stdio(false); cin.tie(NULL);
#define pll pair<ll, ll>
#define plll pair<ll, pll>
using namespace std;

ll a, b, c, d, cnt = 0, red, cyan, beda;
bool bisa = true;

int main(){
    fastio;
    cin >> a >> b >> c >> d;
    red = a;
    cyan = 0;
    while(red > cyan * d){
        red += b;
        cyan += c;
        cnt++;
        if(cnt >= 1e9){bisa = false; break;}
    }
    if(bisa) cout << cnt;
    else cout << -1;
}


#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define pb push_back
#define mii map <int, int>
#define mll map <ll, ll>
#define pii pair <int, int>
#define pll pair <ll, ll>
#define vi vector <int>
#define vd vector <double>
#define vll vector <ll>
#define fi first
#define se second
#define si set <int>
#define sll set <ll>
#define spii set <pii>
#define vs vector <string>
#define vpii vector <pair <int, int> >
#define vpll vector <pair <long long, long long> >
#define vvi vector <vector <int> >
#define vvpii vector <vector <pii > >
#define vb vector <bool>
#define vvb vector <vb>
#define mp make_pair
#define vvll vector <vll>
#define vsi vector <si>
#define rep(i, n) for (int i = 0; i < (n); i++)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define MANX MAXN
#define itn int
#define dbg(x); {cout<<#x<<"="<<x<<", ";}
#define in(x); { for (auto &to : x) cin>>to;}
#define out(x); { for (auto &to : x) cout<<to<<" ";cout<<'\n'; }

const ll INFLL = 1e18;
const int MAXN = 1e6+100;
const ll INF = 1e9;
const int mod1 = 1e9+7;
const int mod2 = 1e9+21;
int add(int a,int b)
{
    a+=b;
    if (a>=mod1)
        return a-mod1;
    return a;
}

int mult(int a,int b)
{
    return 1ll*a*b%mod1;
}

int sub(int a,int b)
{
    a-=b;
    if (a<0)
        return a+mod1;
    return a;
}

int bin_pow(int base,ll deg)
{
    if (deg==0)
        return 1;
    int t=bin_pow(base,deg/2);
    if (deg&1)
        return 1ll*t*t%mod1*base%mod1;
    else
        return 1ll*t*t%mod1;
}
int C(int n,int k)
{
    int ans=1;
    for (int i=n-k+1;i<=n;i++)
        ans=mult(ans,i);
    for (int i=1;i<=k;i++)
        ans=mult(ans,bin_pow(i,mod1-2));
    return ans;
}
void solve()
{
    int n,m;
    cin>>n>>m;
    vi a(n);
    in(a);
    int sum=accumulate(all(a),0);
    if (sum>m)
    {
        cout<<0<<'\n';
        return;
    }
    m=m-sum;
    int k=sum+n;
    cout<<C(m+k,k)<<'\n';
}

int main() {
    #ifdef Mip182
    #else
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    #endif
    #ifdef Mip182
    freopen("a.in", "r", stdin);
    #endif
    int _t;
    _t=1;
//    cin>>_t;
    while (_t--)
        solve();
    #ifdef Mip182
    cout<<'\n'<<"Time : "<<(double)(clock())/CLOCKS_PER_SEC<<'\n';
    #endif
}

#include <bits/stdc++.h>

using namespace std;

template<class T>
using vec = vector<T>;
template<class T>
using v2d = vector<vector<T>>;

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

const ll M = 1e9+7;

int main()
{
    int h, w;
    cin>>h>>w;
    v2d<int> b(h, vec<int>(w, 1));
    v2d<ll> r(h, vec<ll>(w, 0));
    v2d<ll> vert(h, vec<ll>(w, 0));
    v2d<ll> hori(h, vec<ll>(w, 0));
    v2d<ll> diag(h, vec<ll>(w, 0));
    r[0][0] = 1;
    vert[0][0] = 1;
    hori[0][0] = 1;
    diag[0][0] = 1;
    string s;
    for(int i = 0; i < h; i++)
    {
        cin>>s;
        for(int j = 0; j < w; j++)
        {
            s[j] == '#' && b[i][j]--;
        }
    }
    for(int i = 0; i < h; i++)
    {
        for(int j = 0; j < w; j++)
        {
            if (!b[i][j])
            {
                continue;
            }
            if (i)
            {
                r[i][j] += vert[i-1][j];
            }
            if (j)
            {
                r[i][j] += hori[i][j-1];
            }
            if (i && j)
            {
                r[i][j] += diag[i-1][j-1];
            }
            vert[i][j] = r[i][j];
            hori[i][j] = r[i][j];
            diag[i][j] = r[i][j];
            if (i)
            {
                vert[i][j] += vert[i-1][j];
            }
            if (j)
            {
                hori[i][j] += hori[i][j-1];
            }
            if (i && j)
            {
                diag[i][j] += diag[i-1][j-1];
            }
            r[i][j] %= M;
            vert[i][j] %= M;
            hori[i][j] %= M;
            diag[i][j] %= M;
        }
    }
    cout<<r[h-1][w-1]<<'\n';
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{
    ll n;
    cin>>n;
    ll i=1;
    ll ans=0;
    while(i)
    {
       if((i*(i+1))/2>=n)
       {
           ans=i;
           break;
       }
       i++;
    }
    cout<<ans<<endl;
    return 0;
}

#include <iostream>
#include <bits/stdc++.h>
#include <fstream>
using namespace std;
typedef long long ll;
typedef long double ld;
#define fast ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);

int main()
{
    fast
    int n, cnt = 0;
    cin >> n;
    if (n%100 == 0) n++,cnt++;
    while(n % 100)
        n++,cnt++;
    cout << cnt;
}


//#include <atcoder/all>
#include <bits/stdc++.h>
//#include <windows.h>

//#include <time.h>
using namespace std;
//using namespace atcoder;
using ll = long long;
#define all(A) A.begin(),A.end()
using vll = vector<ll>;
#define rep(i, n) for (long long i = 0; i < (long long)(n); i++)
using Graph = vector<vector<tuple<ll, ll, ll>>>;

int main() {
    ll N;
    cin>>N;
    vll A(N);
    rep(i,N)cin>>A[i];
    sort(all(A));
    ll M=N/2;
    double K=double(A[M])/2.0;
    double s=0;
    rep(i,N){
       s+=K+A[i]-min(2*K,double(A[i]));
    }
    s/=N;
    cout<<setprecision(16)<<s<<endl;
}

#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
typedef long long int lli;
typedef unsigned long long int ulli;
typedef long double ld;
typedef vector<lli> vi;
typedef vector<vi> vvi;
typedef pair<lli, lli> pii;
#define vec(s) vector<s>
#define vvec(s) vector<vector<s>>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define Yes(x) cout << (x ? "Yes" : "No") << endl;
#define YES(x) cout << (x ? "YES" : "NO") << endl;
#define out(s) cout << s << endl;
#define Reverse(x) reverse(all(x));
#define Sort(x) sort(all(x));
#define pb(s) push_back(s);
#define sp " "
#define INF 10000000000
#define LINF 9000000000000000000
#define all(s) s.begin(), s.end()
void vout(vi v)
{
    for (lli i = 0; i < v.size(); i++)
        cout << v.at(i) << endl;
}
int main()
{
    lli n;
    cin >> n;
    vi a(n);
    rep(i, n)
    {
        cin >> a[i];
    }
    lli ans = 2e9;
    rep(i, 1 << (n - 1))
    {
        lli xored = 0;
        lli ored = 0;
        rep(j, n + 1)
        {
            if (j < n)
            {
                ored |= a[j];
            }
            if (j == n || (i >> j & 1))
            {
                xored ^= ored;
                ored = 0;
            }
        }
        ans = min(ans, xored);
    }
    out(ans);
}


#include <algorithm>
#include <cmath>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <set>
#include <string>
#include <unordered_set>
#include <vector>

#define REP(i, n) for(int i = 0; i < n; ++i)
using namespace std;
using LLONG = long long;
const LLONG MOD = 1000000007;

int main()
{
	int N; cin >> N;
	string S, X; cin >> S >> X;
	reverse(S.begin(), S.end());
	reverse(X.begin(), X.end());

	// rem[i][j]:Tの余りがiのとき、次の桁にjを付けたときの余り
	int rem[7][10];
	REP(i, 7) REP(j, 10)
	{
		rem[i][j] = (i * 10 + j) % 7;
	}

	// Taが勝つのは最後に余り０のときのみ
	vector<bool> tWin(7, false);
	tWin[0] = true;

	REP(i, N)
	{
		int s = static_cast<int>(S[i] - '0');
		char x = X[i];

		if (x == 'T')
		{
			vector<bool> nexWin(7, false);
			REP(prevR, 7)
			{
				// どちらかの手で勝てるならprevRで勝てる
				if (tWin[rem[prevR][0]] || tWin[rem[prevR][s]])
				{
					nexWin[prevR] = true;
				}
			}
			tWin = nexWin;
		}
		else
		{
			vector<bool> nexWin(7, false);
			REP(prevR, 7)
			{
				// どちらかともの手で勝てるときのみprevRで勝てる
				// さもなくばAokiが妨害する
				if (tWin[rem[prevR][0]] && tWin[rem[prevR][s]])
				{
					nexWin[prevR] = true;
				}
			}
			tWin = nexWin;
		}
	}
	cout << (tWin[0] ? "Takahashi" : "Aoki") << endl;
}

#include <bits/stdc++.h>
#define rep(i,a,b) for(int i=a,i##end=b;i<=i##end;i++)
#define drep(i,a,b) for(int i=a,i##end=b;i>=i##end;i--)
typedef long long ll;
inline int read() {
	int x=0,f=1;char c=getchar();
	while(c<48||c>57){if(c=='-')f=-1;c=getchar();}
	while(c>=48&&c<=57)x=(x<<1)+(x<<3)+(c^48),c=getchar();
	return x*f;
}
using namespace std;
const int M=2e5+5;
int dp[M][10];// dp[i][j]:算到第i位时为j是否必胜
int len;
string a,b;
int DP(int n,int now){
	if(n==len){
//		printf("%d\n",now);
		return now==0;
	}
	if(dp[n][now]!=-1)return dp[n][now];
	int num;
	int p=b[n]-'0';
//	printf("n=%d,b=%c,p=%d\n",n,b[n],p);
	if(a[n]=='A'){
		num=(now*10+p)%7;
		if(DP(n+1,num)==0)return dp[n][now]=0;
		num=(now*10)%7;
		if(DP(n+1,num)==0)return dp[n][now]=0;
		return dp[n][now]=1;
	}else {
		num=(now*10+p)%7;
//		printf("now=%d,num=%d\n",now,num);
		if(DP(n+1,num)==1)return dp[n][now]=1;
		num=(now*10)%7;
		if(DP(n+1,num)==1)return dp[n][now]=1;
		return dp[n][now]=0;
	}
}
int main() {
	memset(dp,-1,sizeof(dp));
	len=read();
	cin>>b;
	cin>>a;
	if(DP(0,0))puts("Takahashi");
	else puts("Aoki");
	return 0;
}


#include<iostream>
using namespace std;

int main()
{
	int X, Y, Z,count=0;

	cin >> X >> Y >> Z;

	while (Y * Z > X * count)
	{
		count++;
	}

	cout << count-1 << endl;

	cin >> X;

	return 0;
}

#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
#define ll long long
int main(){
    int n, s, d;
    cin >> n >> s >> d;
    vector<vector<int>> M(n, vector<int>(2));
    rep(i, n) cin >> M[i][0] >> M[i][1];
    rep(i, n){
        if (M[i][0] < s && M[i][1] > d){
            cout << "Yes" << endl;
            return 0;
        }
    }
    cout << "No" << endl;
    return 0;
}


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

#define rep(i, a) for(int i=0;i<a;i++)
#define repA(i,a,b) for(int i=a;i<b;i++)
#define l list
#define v vector
#define u_m unordered_map
#define itr iterator
#define nm(a) numeric_limits<a>::max()
typedef long long ll;
const int mxN=2e5;
ll n,arr[mxN],prime[15]={2,3,5,7,11,13,17,19,23,29,31,37,41,43,47};
ll best(bool choose[15],int index){
	if(index==15){
		for(ll i=0;i<n;i++){
			bool did=0;
			for(ll j=0;j<15;j++){
				if(choose[j]&&arr[i]%prime[j]==0){
					did=1;
					break;
				}
			}
			if(did==0)return numeric_limits<ll>::max();
		}
		ll idk=1;
		rep(i,15){if(choose[i])idk*=prime[i];}
		return idk;
	}
	choose[index]=0;
	ll ans=best(choose,index+1);
	choose[index]=1;
	return min(ans,best(choose,index+1));
}
void solve(){
	cin>>n;
	rep(i,n)cin>>arr[i];
	bool empty[15];
	memset(empty,0,sizeof(empty));
	cout<<best(empty,0)<<endl;
}

int main(){
	ios::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	int t=1;
	/*#ifnef ONLINEJUDGE
	freopen("input.txt","r",stdin);
	freopen("output.txt","w",stdout);
	#endif
	*/
	while(t--){
		solve();
	}
	return 0;
}

#include <bits/stdc++.h>

#define SORT(v, n) sort(v, v + n);
#define VSORT(v) sort(v.begin(), v.end());
#define size_t unsigned long long
#define ll long long
#define rep(i, a) for (int i = 0; i < (a); i++)
#define repr(i, a) for (int i = (int)(a)-1; i >= 0; i--)
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define FORR(i, a, b) for (int i = (int)(b)-1; i >= a; i--)
#define ALL(a) a.begin(), a.end()
using namespace std;
int si()
{
  int x;
  scanf("%d", &x);
  return x;
}
long long sl()
{
  long long x;
  scanf("%lld", &x);
  return x;
}
string ss()
{
  string x;
  cin >> x;
  return x;
}
void pi(int x) { printf("%d ", x); }
void pl(long long x) { printf("%lld ", x); }
void pd(double x) { printf("%.15f ", x); }
void ps(const string &s) { printf("%s ", s.c_str()); }
void br() { putchar('\n'); }

const ll MOD = 1e9 + 7;
const ll INF = 1e9 + 5;

struct mint
{
  int n;
  mint(int n_ = 0) : n(n_) {}
};

mint operator+(mint a, mint b)
{
  a.n += b.n;
  if (a.n >= MOD)
    a.n -= MOD;
  return a;
}
mint operator-(mint a, mint b)
{
  a.n -= b.n;
  if (a.n < 0)
    a.n += MOD;
  return a;
}
mint operator*(mint a, mint b) { return (long long)a.n * b.n % MOD; }
mint &operator+=(mint &a, mint b) { return a = a + b; }
mint &operator-=(mint &a, mint b) { return a = a - b; }
mint &operator*=(mint &a, mint b) { return a = a * b; }

typedef pair<int, int> P;

string s, t, u;
int a, b, result;

int main()
{
  cin >> a >> b;
  if (a + b >= 15 && b >= 8)
    result = 1;
  else if (a + b >= 10 && b >= 3)
    result = 2;
  else if (a + b >= 3)
    result = 3;
  else
    result = 4;

  cout << result << endl;
}


#include <bits/stdc++.h>

using namespace std;

#define ar array
#define ll long long

const int MAX_N = 1e5 + 1;
const ll MOD = 1e9 + 7;
const ll INF = 1e9;

void solve() {
    int n;
    cin>>n;
    vector<int> v(n);
    for(int i=0;i<n;i++){
        cin>>v[i];
    }
    sort(v.begin(),v.end());
    for(int i=1;i<n-1;i++){
        if(v[i]==v[i-1]){
            cout<<"No\n";
            return;
        }
    }
    cout<<"Yes\n";

}

int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
    int tc = 1;
    // cin >> tc;
    for (int t = 1; t <= tc; t++) {
        // cout << "Case #" << t  << ": ";
        solve();
    }
}

#include <bits/stdc++.h>
using namespace std;
#define rep(i,a,b) for(ll i=a;i<b;i++)
#define pb push_back
typedef long long ll;
typedef long double ld;
const ll INF = 9223372036854775807;
const ll MOD = 1000000007;
const long double PI = acos(-1);
#define mp make_pair
#define all(v) v.begin(), v.end()
#define F first
#define S second
typedef vector<ll> vi;
typedef map<int, int> mii;
typedef vector<vi> vvi;

 //debugger
void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}

template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifndef ONLINE_JUDGE
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define debug(x...)
#endif

// debugger end
//global variables

//functions

int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    //int test;
   // cin>>test;
   // while(test--)
   // {
    //    solve();
    //}
   ll n;
   cin>>n;
   set<ll> s;

   rep(i,0,n)
   {
        ll temp;
        cin>>temp;

        if(temp>n)
        {
            cout<<"No"<<endl;
            return 0;
        }

        s.insert(temp);
   }

   if(s.size()==n)
   {
    cout<<"Yes"<<endl;
   }
   else
   {
    cout<<"No"<<endl;
   }

 return 0;
}


#include <bits/stdc++.h>
namespace IO{
    char buf[1000000],*p1,*p2;
    inline char getc(){
        if(p1==p2) p2=(p1=buf)+fread(buf,1,1000000,stdin);
        return p1==p2?EOF:*(p1++);
    }
    template<typename tp>inline void r(tp &n){
        n=0;char c=getc();
        while(!isdigit(c)) c=getc();
        while( isdigit(c)) n=n*10+c-48,c=getc();
    }
    template<typename tp>inline void w(tp  n){
        if(n/10) w(n/10);
        putchar(n%10+48);
    }
};
using namespace IO;
const int N=1e5+5;
using namespace std;
int n,L;
long long a[N],b[N];
int main(){

    //freopen("1.in","r",stdin);

    r(n),r(L);
    for(int i=1;i<=n;++i) r(a[i]);
    for(int i=1;i<=n;++i) r(b[i]);
    a[n+1]=L+1,b[n+1]=L+1;
    for(int i=n+1;i>=1;--i)
        a[i]=a[i]-a[i-1]-1,b[i]=b[i]-b[i-1]-1;
    long long ans=0,j=1,st=1;
    for(int i=1;i<=n+1;++i){
        if(!b[i]) continue;
        while(!a[j]) ++j;st=j;
        long long cur=0;
        while(cur<b[i]&&j<=n+1) cur+=a[j++];
        if(cur!=b[i]) {puts("-1");return 0;}
        ans+=max(0ll,j-1-i)+max(0ll,i-st);
    }
    w(ans);
    return 0;
}

#include "bits/stdc++.h"

#define MOD  998244353
#define rep(i, n) for(ll i=0; i < (n); i++)
#define rrep(i, n) for(ll i=(n)-1; i >=0; i--)
#define ALL(v) v.begin(),v.end()
#define rALL(v) v.rbegin(),v.rend()
#define FOR(i, j, k) for(ll i=j;i<k;i++)
#define debug_print(var) cerr << #var << "=" << var <<endl;
#define DUMP(i, v)for(ll i=0;i<v.size();i++)cerr<<v[i]<<" "
#define fi first
#define se second

using namespace std;
typedef long long int ll;
typedef vector<ll> llvec;
typedef vector<double> dvec;
typedef pair<ll, ll> P;
typedef long double ld;
struct edge{ll x, c;};

ll mod(ll a, ll mod){
  ll res = a%mod;
  if(res<0)res=res + mod;
  return res;
}

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

ll modinv(ll a, ll mod){
  ll b=mod, u=1, v=0;
  while(b){
    ll t=a/b;
    a-=t*b; swap(a, b);
    u-=t*v; swap(u, v);
  }
  u%=mod;
  if(u<0)u+=mod;
  return u;
}

ll gcd(ll a, ll b){
  ll r = a%b;
  if(r==0) return b;
  else return gcd(b, a%b);
}

bool is_prime(ll n){
  ll i = 2;
  if(n==1)return false;
  if(n==2)return true;
  bool res = true;
  while(i*i <n){
    if(n%i==0){
      res = false;
    }
    i = i+1;
  }

  //if(i==1)res = false;
  if(n%i==0)res=false;
  return res;
}
/**************************************
** A main function starts from here  **
***************************************/
int main(){
  ll a, b, c;
  cin >> a >> b >> c;
  ll A = mod((a+1)*a/2,MOD);
  ll B = mod((b+1)*b/2,MOD);
  ll C = mod((c+1)*c/2,MOD);
  cout << mod(mod(C*B, MOD)*A, MOD)<<endl;

  return 0;
}


#include <iostream>
using namespace std;

int main()
{
	int m, h;
	cin >> m >> h;
	cout << (h % m == 0 ? "Yes" : "No") << endl;
	return 0;
}

#include<bits/stdc++.h>

using namespace std;

#define  GODSPEED       ios:: sync_with_stdio(0);cin.tie(0);cout.tie(0);cout<<fixed;cout<<setprecision(15);
#define  f              first
#define  s              second
#define  newl           cout<<"\n";
#define  pb             push_back
#define  mset(a,x)      memset(a,x,sizeof(a))
#define  debv(a)        for(auto it: a)cout<<it<<" ";newl;
#define  deb1(a)        cout<<a<<"\n";
#define  deb2(a,b)      cout<<a<<" "<<b<<"\n";
#define  deb3(a,b,c)    cout<<a<<" "<<b<<" "<<c<<"\n";
#define  deb4(a,b,c,d)  cout<<a<<" "<<b<<" "<<c<<" "<<d<<"\n";
#define  uniq(a)        a.resize(unique(a.begin(), a.end()) - a.begin());
#define  all(a)         a.begin(),a.end()

typedef  long long             ll;
typedef  long double           ld;
typedef  pair<ll, ll>          pll;
typedef  vector<ll>            vll;
typedef  vector<pll>           vpll;

const ll   N     =  2e6 + 5;
const ll   mod   =  998244353;
const ll   INF   =  0x7f7f7f7f7f7f7f7f;
const int  INFi  =  0x7f7f7f7f;
const ll   LEVEL =  log2(N) + 1;

int m, h;

void solve() {
	cin >> m >> h;
	if(h % m == 0) deb1("Yes")
	else deb1("No")
}

int main() {
	GODSPEED;
	int test = 1;
	//cin >> test;
	for (int i = 1; i <= test; i++) {
		solve();
	}
}