#include <iostream>
using namespace std;
int main(void){
    int v,t,s,d;
    cin >> v >> t >> s >> d;
    if(v*t <= d && v*s >= d){
        cout << "No" << endl;
    }
    else cout << "Yes" << endl;
}

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

#define ff              first
#define ss              second
#define int             long long
#define pb              push_back
#define mp              make_pair
#define pii             pair<int,int>
#define vi              vector<int>
#define mii             map<int,int>
#define pqb             priority_queue<int>
#define pqs             priority_queue<int,vi,greater<int> >
#define setbits(x)      __builtin_popcountll(x)
#define zrobits(x)      __builtin_ctzll(x)
#define mod             1000000007
#define inf             1e18
#define ps(x,y)         fixed<<setprecision(y)<<x
#define w(x)            int x; cin>>x; while(x--)

int32_t main()
{
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    //fsolve();
  	int v,t,s,d;
  cin>>v>>t>>s>>d;
  //int g=d/v;

  if(d<v*t || d>v*s){
    cout<<"Yes"<<endl;
  }
  else{
    cout<<"No"<<endl;
  }
    return 0;
}


#include <stdio.h>
#include <stdlib.h>
#include <string>
#include <iostream>
#include <utility>
#include <algorithm>
#include <vector>
#include <list>
#include <stack>
#include <queue>
#include <unordered_map>
#include <map>
#include <unordered_set>
#include <set>
#include <tuple>
#include <cassert>
#include <cmath>
using namespace std;
using ll = long long;
const int mod = 1e9 + 7;

#define read_int(X) \
    ll X;           \
    scanf("%lld\n", &X);

#define read_two_int(X, Y) \
    ll X, Y;               \
    scanf("%lld %lld\n", &X, &Y);

#define read_three_int(X, Y, Z) \
    ll X, Y, Z;                 \
    scanf("%lld %lld %lld\n", &X, &Y, &Z);

#define read_four_int(X, Y, Z, W) \
    ll X, Y, Z, W;                \
    scanf("%lld %lld %lld %lld\n", &X, &Y, &Z, &W);

int main()
{
    read_int(N);
    ll ans0 = 0;
    ll ans1 = 0;
    ll ans2 = 0;
    for (ll i = 0; i < N; i++)
    {
        ll x;
        scanf("%lld", &x);
        ans0 += abs(x);
        ans1 += x * x;
        ans2 = max(abs(x), ans2);
    }
    printf("%lld\n%.15Lf\n%lld\n", ans0, sqrt((long double)ans1), ans2);
}

#include <bits/stdc++.h>
// #include <atcoder/all>
// using namespace atcoder;
#define rep(i, start, end) for (long long i = start; i < end; ++i)
#define repreverse(i, start, end) for (long long i = start; i >= end; --i)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define inrange(a, x, b) (a <= x && x <= b)
#define len(x) ((long long)(x).size())
#define lcm(a, b) ((a) / __gcd((a), (b)) * (b))
using namespace std;
using ll = long long;
using ld = long double;
using vll = vector<ll>;
using vllvll = vector<vll>;
using vc = vector<char>;
using vcvc = vector<vc>;
using pll = pair<ll, ll>;
template<class T> void print(T x,bool cl=1){cout<<(cl?"\x1b[36m":"")<<x<<(cl?"\x1b[39m":"")<<'\n';}
template<class T> void print1d(T x,ll n=-1,bool cl=true){if(n==-1)n=x.size();rep(i,0,n){cout<<(cl?"\x1b[36m":"")<<x[i]<<(i==n-1?'\n':' ');}cout<<(cl?"\x1b[39m":"");}
template<class T> void print2d(T x,ll r=-1,ll c=-1,bool cl=1){if(r==-1)r=x.size();if(c==-1)c=x[0].size();rep(i,0,r)print1d(x[i],c,cl);}
template<class T, class U> bool isin(T el, U container) { return find(all(container), el) != container.end(); }
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; }
template<class T> bool even(T n) { return ! (n & 1); }
template<class T> bool odd(T n) { return n & 1; }
template<class T> ll rup(T a, T b) { return a % b ? a / b + 1 : a / b; }
template<class T> ld deg2rad(T deg) { return M_PI * deg / 180.0; }
template<class T> ld rad2deg(T rad) { return 180.0 * rad / M_PI; }
const long double pi = M_PI;
const long long inf = 1LL << 60;
const long long mod = 1e9 + 7;
ll intpow(ll a, ll n, ll _mod=numeric_limits<ll>::max()) { ll p=1; while (n) { if (n&1) p=p*a%_mod; a=a*a%_mod; n>>=1; } return p; }
ll modc(ll a, char op, ll b, ll _mod=mod)
{
        a %= _mod; b %= _mod; ll res = 1;
        switch (op) {
        case '+': res = (a + b) % _mod; break;
        case '-': res = (a - b) % _mod; break;
        case '*': res = a * b % _mod; break;
        case '/': res = modc(a, '*', modc(b, '^', _mod-2, _mod), _mod); break;
        case '^': res = intpow(a, b, _mod); break;
        case 'P': rep(i, a-b+1, a+1) res = modc(res, '*', i, _mod); break;
        case 'C': res = modc(modc(a, 'P', b, _mod), '/', modc(b, 'P', b, _mod)); break;
        }
        if (res < 0) { res += _mod; } return res;
}

int main()
{
        ll N;
        cin >> N;
        vll x(N);
        rep(i, 0, N) cin >> x[i];

        ll a = 0;
        rep(i, 0, N) a += abs(x[i]);

        ld b = 0.0;
        rep(i, 0, N) b += abs(x[i]) * abs(x[i]);
        b = sqrt(b);

        ll c = -inf;
        rep(i, 0, N) {
                if (abs(x[i]) > c) {
                        c = abs(x[i]);
                }
        }

        cout << setprecision(21) << a << '\n' << b << '\n' << c << endl;
}


#include<bits/stdc++.h>
using namespace std;
int main() {

    long long n;
    cin >> n;
    long long i = 1;
    while(n>0) {
        n -= i;
        i += 1;
    }
    cout<<i-1<<endl;
    return 0;
}

#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define REP(i,m,n) for (int i = (m); i < (n); ++i)
#define rrep(i,n) for (int i = (n)-1; i >= 0; --i)
#define RREP(i,m,n) for (int i = (n)-1; i >= (m); ++i)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
using namespace std;
using ll = long long int;
using vec = vector<int>;
using P = pair<int,int>;
const int INF = 1e9+7;

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

  int x = 1;
  while (x * (x+1) < 2 * n) {
    x++;
  }

  cout << x << endl;
}


#include<iostream>
#include<set>
#include<cstring>
using namespace std;
const int aa=2e5+7;
bool a[aa];
int main()
{
	memset(a,0,sizeof(a));
	int N;
	cin>>N;
	int sum=0;
	for(int i=0;i<N;i++)
	{
		int m;
		cin>>m;
		a[m]=1;
		while(a[sum]==1)
		{
			sum++;
		}
		cout <<sum<<'\n';
	}
	return 0;
}

// Jai Shree Ram

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

#define rep(i,a,n)     for(int i=a;i<n;i++)
#define ll             long long
#define int            long long
#define pb             push_back
#define all(v)         v.begin(),v.end()
#define endl           "\n"
#define x              first
#define y              second
#define gcd(a,b)       __gcd(a,b)
#define mem1(a)        memset(a,-1,sizeof(a))
#define mem0(a)        memset(a,0,sizeof(a))
#define sz(a)          (int)a.size()
#define pii            pair<int,int>
#define hell           1000000007
#define elasped_time   1.0 * clock() / CLOCKS_PER_SEC

template<typename T1,typename T2>istream& operator>>(istream& in,pair<T1,T2> &a){in>>a.x>>a.y;return in;}
template<typename T1,typename T2>ostream& operator<<(ostream& out,pair<T1,T2> a){out<<a.x<<" "<<a.y;return out;}
template<typename T,typename T1>T maxs(T &a,T1 b){if(b>a)a=b;return a;}
template<typename T,typename T1>T mins(T &a,T1 b){if(b<a)a=b;return a;}

int solve(){
 		int n; cin >> n;
 		vector<int>a(n+1),p1(n+1),p2(n+1);
 		rep(i,1,n+1){
 			cin >> a[i];
 			if(i%2)p1[i] = a[i];
 			else p2[i] = a[i];
 			p1[i] += p1[i-1];
 			p2[i] += p2[i-1];
 		}
 		int ans = 0;
 		map<int,int>mp;
 		int l = 0;
 		for(int i = 1; i <= n; i++){
 			ans += mp[p1[i] - p2[i]];
 			mp[p1[l]-p2[l]]++;
 			l++;
 		}
 		cout << ans << endl;
 return 0;
}
signed main(){
    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    #ifdef SIEVE
    sieve();
    #endif
    #ifdef NCR
    init();
    #endif
    int t=1;//cin>>t;
    while(t--){
        solve();
    }
    return 0;
}


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

#define ll long long int
#define mp make_pair
#define pb push_back
#define pf push_front
#define F first
#define S second
#define MOD 1000000007
#define MAXN   1000001
#define MODA 998244353
#define all(a)      (a).begin(),(a).end()
#define allr(a)      (a).rbegin(),(a).rend()

ll power(ll a,ll b){
    ll result=1;
    while(b>0){
        int lastbit=(b&1);
        if(lastbit){
            result=(result*a);
        }
        a=(a*a);
        b=b>>1;
    }
    return result;
}

ll power2(ll a,ll b,ll p){
    ll result=1;
    while(b>0){
        int lastbit=(b&1);
        if(lastbit){
            result=(result*a)%p;
        }
        a=(a*a)%p;
        b=b>>1;
    }
    return result%p;
}

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

vector<ll> Sieve(int n){
    bool prime[n+1];
    memset(prime, true, sizeof(prime));
    for (int p=2; p*p<=n; p++){
        if (prime[p] == true){
            for (int i=p*p; i<=n; i += p)
                prime[i] = false;
        }
    }
    vector<ll>v;
    for (int p=2; p<=n; p++)
        if (prime[p]) v.pb(p);
    return v;
}

vector<ll> SeiveOfEratosthenes(int n){
    vector<ll>v(n+1,0);
    for(int i=0;i<=n;i++){
        v[i]=i;
    }

    for (int p=2; (p*p)<=n; p++){
        if (v[p] == p){
            v[p]=p;
            for (int i=p*p; i<=n; i += p) {
                v[i] = p;
            }
        }
    }
    return v;
}

vector<ll> SmallestPrimeFactors(int n){
    vector<ll>spf(n+1,0);
    spf[1] = 1;
    for (int i=2; i<=n; i++){
        spf[i] = i;
    }
    for (int i=4; i<=n; i+=2){
        spf[i] = 2;
    }
    for (int i=3; (i*i)<=n; i++){
        if (spf[i] == i){
            for (int j=i*i; j<MAXN; j+=i) {
                if (spf[j] == j){
                    spf[j] = i;
                }
            }
        }
    }
    return spf;
}

void shortest(map<int,vector<pair<int,ll>>>m,int src,int n,ll *dist){
    bool visited[n+1];
    set<pair<ll,int>>s;
    for(int i=0;i<=n;i++){
        dist[i]=-1;
        visited[i]=false;
    }

    s.insert(mp(0ll,src));
    dist[src]=0;
    while(!s.empty()){
        auto t=s.begin();
        ll dis=(*t).F;
        int u=(*t).S;
        s.erase(t);
        if(visited[u]){
            continue;
        }
        visited[u]=true;
        for(auto tt:m[u]){
            int v=tt.F;
            ll w=tt.S;
            if(!visited[v]){
                if(dist[v]!=-1 && dist[v]>dis+w){
                    s.erase(mp(dist[v],v));
                    dist[v]=dis+w;
                    s.insert(mp(dist[v],v));
                }else if(dist[v]==-1){
                    dist[v]=dis+w;
                    s.insert(mp(dist[v],v));
                }
            }
        }
    }
}

int main(){

    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);

    int ttttt=1;
//    cin>>ttttt;
    for(int tttt=1;tttt<=ttttt;tttt++){

        ll n;
        cin>>n;
        string x="";
        while(n>0){
            x+=(n%10+'0');
            n/=10;
        }
        reverse(all(x));
        n=x.size();

        if(n%2){
            ll a[12]={0,0,0,9,0,99,0,999,0,9999,0,99999};
            cout<<a[n];
        }else{
            int t=n/2;
            int j=0;
            ll first=0;
            ll po=t;
            ll second=0;

            while(t<n){
                ll y=power(10ll,po-1);
                first+=((x[j]-'0')*y);
                second+=((x[t]-'0')*y);
                t++;
                j++;
                po--;
            }

            ll ans=first-1;
            if(second>=first){
                ans++;
            }
            cout<<ans;
        }
        cout<<endl;
    }

    return 0;
}

#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int (i) = 0; (i) <(n); (i)++)
#define so(v) sort(v.begin(),v.end())
using ll = long long;
using vi=vector<int>;
using vvi=vector<vi>;
const int MAX = 510000;
const int MOD = 1000000007;
ll gcd(ll a, ll b)
{
   if (a%b == 0)
   {
       return(b);
   }
   else
   {
       return(gcd(b, a%b));
   }
}
ll lcm(ll a, ll b)
{
   return a * b / gcd(a, b);
}
long long fac[MAX], finv[MAX], inv[MAX];
// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}
// 二項係数計算
long long com(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

int main() {
    int h,w,x,y;
    cin>>h>>w>>x>>y;
    x--,y--;
    string s[h];
    rep(i,h)cin>>s[i];
    int yoko=0;
    rep(i,w){
        if(s[x][i]=='.')yoko++;
        else{
            if(i>y)break;
            yoko=0;
        }
    }
    int tate=0;
    rep(i,h){
        if(s[i][y]=='.')tate++;
        else{
            if(i>x)break;
            tate=0;
        }
    }
    cout<<tate+yoko-1<<endl;
}


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

int main() {
  int x,y;
  cin >> x >> y;
  if (x==y) cout << x << endl;
  else cout << 3-x-y << endl;
}

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

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

    int x, y;
    cin >> x >> y;
    int mov[3] = {0};
    mov[x]++; mov[y]++;
    if(x==y){
        cout << x << "\n";
    }
    else{
        for(int i=0; i<3; i++){
            if(!mov[i]) cout << i << "\n";
        }
    }

    return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define rep(i,a,n) for (int i=a;i<n;i++)//iをaからn
#define per(i,n,a) for (int i=a-1;i>=n;i--)//iをnからa
#define db(x) cout << #x << " = " << x << endl
#define db2(x, y) cout << "(" << #x << ", " << #y << ") = (" << x << ", " << y << ")\n"; //デバッグ用
#define all(x) (x).begin(), (x).end()
#define INF 1000000000000 //10^12:∞
#define MOD 1000000007 //10^9+7:合同式の法
#define pb push_back
#define F first
#define S second
typedef long long ll;
//sort(all(a)); ソート
//sort(all(a),greater<int>()); 逆順ソート
//a.erase(unique(all(a)), a.end()); ソート後に重複を削除
//cout<< std::fixed << std::setprecision(15)<<0.000001<<endl; 小数点以下を表示させる

int main() {
    ll a,b,w;
    cin>>a>>b>>w;

    ll minans=INF,maxans=0;
    ll kosuu=1;
    bool flag=false;

    while(true){

    if(kosuu*a<=w*1000&&w*1000<=kosuu*b){
    minans=kosuu;
    flag=true;
    while(true){
    maxans=max(maxans,kosuu);
    kosuu++;
    if(kosuu*a>w*1000){
        break;
    }
    }
    }
    kosuu++;
    if(kosuu*a>w*1000){
        break;
    }
    }

    if(flag){
    cout<<minans<<" "<<maxans<<endl;
    }else{
    cout<<"UNSATISFIABLE"<<endl;
    }
 return 0;
}

#include <bits/stdc++.h>

int main() {
    std::vector<int> a(3);
    std::cin >> a[0] >> a[1] >> a[2];
    std::sort(a.begin(), a.end());
    if (a[1] - a[0] == a[2] - a[1]) {
        std::cout << "Yes" << std::endl;
    } else {
        std::cout << "No" << std::endl;
    }
}


#include<cstdio>
#include<iostream>
#include<cmath>
#include<cstring>
#include<cctype>
#include<cstdlib>
#include<algorithm>
#include<vector>
#define fs(i,x,y) for(int i=(x),_=(y);i<=_;++i)
#define fn(i,x,y) for(int i=(x),_=(y);i>=_;--i)
#define tor(i,v,x) for(int i=head[x],v=to[i];i;i=nxt[i],v=to[i])
#define Li inline
#define R register int
#define ls(x) ch[x][0]
#define rs(x) ch[x][1]
#define mpi(x,y) make_pair(x,y)
#define pi pair<int,int>
//#define int ll
using namespace std;
typedef long long ll;
template<typename T>
void read(T &x){
	x=0;char ch=getchar();bool f=0;
	while(ch<'0'||ch>'9'){
		if(ch=='-')f=1;
		ch=getchar();
	}
	while(ch>='0'&&ch<='9')x=(x<<1)+(x<<3)+ch-'0',ch=getchar();
	x=f?-x:x;
}

const int N=2e5+7;
int n,m;
int a[N],b[N],p[N],id[N],q[N];
vector<pi>v;

bool cmp(int lhs,int rhs){
	return b[lhs]>b[rhs];
}

signed main(){
	read(n);
	fs(i,1,n)read(a[i]);
	fs(i,1,n)id[i]=i,read(b[i]);
	fs(i,1,n)read(p[i]),q[p[i]]=i;
	sort(id+1,id+n+1,cmp);
	fs(i,1,n){
		int x=id[i];
		if(q[x]==x)continue;
		if(a[q[x]]>b[x]&&a[x]>b[p[x]]){
			v.push_back(mpi(q[x],x));
			p[q[x]]=p[x];
			q[p[x]]=q[x];
		}else{
			printf("-1");return 0;
		}
	}
	int len=v.size();
	printf("%d\n",len);
	fs(i,0,len-1){
		printf("%d %d\n",v[i].first,v[i].second);
	}
	return 0;
}

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

int main() {
    ll n;
    std::cin >> n;
    vector<ll> a(n),b(n),p(n);
    priority_queue<pair<ll,ll>,vector<pair<ll,ll>>> pq;
    for (int i = 0; i < n; i++) {
        std::cin >> a[i];
    }
    for (int i = 0; i < n; i++) {
        std::cin >> b[i];
        pq.push({b[i],i});
    }
    vector<ll> f(n);
    for (int i = 0; i < n; i++) {
        std::cin >> p[i];
        p[i]--;
        f[p[i]]=i;
    }
    vector<string> ans;
    while(!pq.empty()){
        // 重さ、荷物番号
        auto [weight, index] = pq.top();pq.pop();
        auto current_owner = f[index];
        auto current_bag   = index;
        auto true_owner = index;
        if(current_owner == true_owner)continue;
        auto true_owner_bag = p[true_owner];

        if(a[current_owner]>b[current_bag]&&a[true_owner]>b[true_owner_bag]){
            ans.push_back(to_string(current_owner+1)+" "+to_string(true_owner+1));
            f[true_owner_bag] = current_owner;
            f[current_bag] = true_owner;
            p[current_owner] = true_owner_bag;
            p[true_owner] = current_bag;
        }else{
            std::cout << -1 << std::endl;
            return 0;
        }
    }
    std::cout << ans.size() << std::endl;
    for (auto e : ans) {
        std::cout << e << std::endl;
    }
}


#include<bits/stdc++.h>
using namespace std;
#define int long long
#define N 600007
signed main(){
    int n;
    cin>>n;
    int arr[n];
    map<int , int> m;
    for(int i = 0 ; i < n ; i++){
         cin>>arr[i];
         m[arr[i]]=i;
    }
    int st = 0;
    int l = 0;
    vector<int> ans;
    for(int i = 1 ; i <= n ;i++){
        int temp = m[i];
           for(int j = m[i] ; j > st ; j--){
            m[arr[j]]-=1;
            m[arr[j-1]]+=1;
                   swap(arr[j] , arr[j-1]);
                   ans.push_back(j);
                   l++;
                   // cout<<"indices of "<<arr[j]<<" is "<< m[arr[j]]<<endl;
                   // cout<<"index of "<<arr[j-1]<<" is "<< m[arr[j-1]]<<endl;
           }
          // cout<<st<<" se "<<temp<<"tk"<<endl;
           st = temp;
           bool ok = false;
           while(i < n && m[i+1] < st){
                i++;
                ok = true;
           }
    }
    // cout<<"arr: "<<endl;
    // for(auto it:arr){
    //     cout<<it<<" ";
    // }
    // cout<<endl;
    if(l <= n-1){
        bool ok = true;
          for(int i = 0 ; i < n-1 ; i++){
                if(arr[i] > arr[i+1]){
                        ok = false;
                        break;
                }
          }
          if(ok){
             for(auto it:ans){
                cout<<it<<endl;
             }
             return 0;
          }
          else{
            cout<<"-1"<<endl;
            return 0;
          }
    }
    else{
        cout<<"-1"<<endl;
        return 0;
    }
}

//----------BHAVIK DIWANI(PICT_COMP)---------------
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define test ll t; cin>>t; while(t--)
#define fastio ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define mod 1000000007
#define ll long long
#define int long long
#define ull unsigned long long
#define MAX 1000005
#define pb push_back
#define mkp make_pair
#define vi vector<int>
#define pii pair<int,int>
#define endl '\n'
#define vs vector<string>
#define mii map<int,int>
#define msi map<string,int>
#define vpii vector< pair<int, int > >
#define vpsi vector< pair< string ,int > >
#define forci(p,q) for(int i=p;i<q;i++)
ll gcd(ll a,ll b){ if(b==0) return a;    return gcd(b,a%b);}
ll lcm(ll a,ll b) { return (a/gcd(a,b)*b);}
ull power(ull a, ull b) {a %= mod;  ull res = 1;  while (b > 0) { if (b & 1) res = res * a % mod;  a = a * a % mod;  b >>= 1; }  return res%mod; }
ll modmul(ll x, ll y){return (x*y)%mod;}
ll modadd(ll x, ll y){return (x+y)%mod;}
ll modsub(ll x, ll y){return (x-y+mod)%mod;}
ll fact[1000007]={0};
void facto() {fact[0]=1;fact[1]=1;for(int i=2;i<1000007;i++)fact[i]=(fact[i-1]*i)%mod;}
ll ncr(ll n,ll r) {ll res=1; res=fact[n]; res=(res*(power(fact[r],mod-2)))%mod; res=(res*(power(fact[n-r],mod-2)))%mod; return res;}
ll npr(ll n,ll r) {ll res=1; res=fact[n]; res=(res*(power(fact[n-r],mod-2)))%mod; return res;}
inline long long toint(const std::string &s) {std::stringstream ss; ss << s; long long x; ss >> x; return x;}
inline std::string tostring(long long number) {std::stringstream ss; ss << number; return ss.str();}
inline std::string tobin(long long x) {return std::bitset<63>(x).to_string();}
/*bool prime[MAX];
ull sieve(){memset(prime,true,sizeof(prime));for(ull p=2;p*p<MAX;p++){if(prime[p]==true){for(ull i=2*p;i<MAX;i+=p){prime[i]=false;}}}prime[0]=0;prime[1]=0;
}*/
/*
int inv[1000001]={0};int invf[1000001]={0};
void findinverse(){
	inv[0]=1;
	inv[1] = 1;
	for(int i = 2; i <=1e6 ; ++i)
		inv[i] = (mod - (mod/i) * inv[mod%i] % mod) % mod;
	invf[0]=1;invf[1]=1;
	for(int i=2;i<=1e6;i++){
		invf[i]=invf[i-1]*inv[i]%mod;
	}
}*/
using namespace std;
using namespace __gnu_pbds;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> orderedSet;
typedef tree<int, null_type, less_equal<int>, rb_tree_tag, tree_order_statistics_node_update> orderedMultiset;
int solve()
{
	int n=4;
	int a[4];
	cin>>a[0]>>a[1]>>a[2]>>a[3];
	int mask=1<<n;
	int tot=a[0]+a[1]+a[2]+a[3];
	for(int i=0;i<mask;i++){
		int sum=0;
		for(int j=0;j<n;j++){
			if(i & (1<<j))
				sum+=a[j];
		}
		if(sum==tot-sum){
			cout<<"Yes";
			return 0;
		}
	}
	cout<<"No";
	return 0;
}
signed main()
{
	fastio;
//	test
		solve();
}


#include<bits/stdc++.h>
#define all(v) v.begin(), v.end()
#define sz(x) (int)x.size()
#define ini(x, y) memset(x, y, sizeof(x));
#define pb push_back
#define fi first
#define se second
using namespace std;
using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
const int MOD = (int)1e9 + 7;
const int MAX = (int)2e9;
const double PI = acos(-1);

int prime[1001];
vector<int> P;
int l, r;
ll sol(vector<int>& fac, int i) {
	ll res = 0;
	for (int sub = (1 << sz(fac)) - 1; sub; sub = (sub - 1) & (1 << (sz(fac))) - 1) {
		int val = 1;
		int cnt = 0;
		for (int j = 0; j < sz(fac); j++) {
			if ((1 << j) & sub) {
				val *= fac[j];
				cnt++;
			}
		}
		if (val != 1) {
			int k = r / val - i / val;
			if (cnt % 2) res += k;
			else res -= k;
		}
	}
	return res;
}
int main(void) {
	ios::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr);
	//freopen("input.txt", "r", stdin);
	for (int i = 2; i <= 1000; i++) {
		if (prime[i] == 0) {
			P.pb(i);
			for (int j = 2; j * i <= 1000; j++) {
				prime[i * j] = 1;
			}
		}
	}
	ll ans = 0;
	 cin >> l >> r;
	for (int i = max(2, l); i < r; i++) {
		int k = i;
		vector<int> fac;
		int idx = 0;
		for (int i = 0; i < sz(P); i++) {
			if (k == 1) break;
			if (k % P[i] == 0) {
				fac.pb(P[i]);
				while (k % P[i] == 0) k /= P[i];
			}
		}
		if (k > 1) fac.pb(k);
		ans += sol(fac, i);
		ans -= r / i - 1;
	}
	cout << ans*2;
}

#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<utility>
#include<set>
#include<stack>
#include<list>
#include<deque>
#include<bitset>
#include<iomanip>
#include<cstring>
#include<sstream>
#include<cstdio>
#include<cstdlib>
#include<climits>
#include<cmath>
#include<cctype>

#define pb push_back
#define mp make_pair
#define rep(i,a,b) for(int i=a;i<=b;i++)
#define ren(i,a,b) for(int i=a;i>=b;i--)
#define ff first
#define ss second
#define pll pair<long long int,long long int>
#define pii pair<int,int>
#define vll vector<long long int>
#define vii vector<int>
#define gi(n) scanf("%d",&n)
#define gll(n) scanf("%lld",&n)
#define gstr(n) scanf("%s",n)
#define gl(n) cin >> n
#define oi(n) printf("%d",n)
#define oll(n) printf("%lld",n)
#define ostr(n) printf("%s",n)
#define ol(n) cout << n
#define os cout<<" "
#define on cout<<"\n"
#define o2(a,b) cout<<a<<" "<<b
#define all(n) n.begin(),n.end()
#define present(s,x) (s.find(x) != s.end())
#define cpresent(s,x) (find(all(s),x) != s.end())
#define tr(container, it) for(__typeof(container.begin()) it = container.begin(); it != container.end(); it++)
using namespace std;

typedef unsigned long long int ull;
typedef long long int ll;
typedef long double ld;
typedef vector<vector<ll> > mat;

int main()
{ios_base::sync_with_stdio(false);
cin.tie(0);
int n,k;
cin>>n>>k;
vll c(n+5,0);
rep(i,0,n-1)
{
	int x;
	cin>>x;
	c[x]++;
}

ll cnt=min(c[0],1ll*k);
ll ans=cnt;
rep(i,1,n)
{
	cnt=min(cnt,c[i]);
	ans+=cnt;
}
ol(ans);
return 0;
}


#line 2 "/Users/kaage/Desktop/ProgrammingWorkspace/library/other/template.hpp"
#define _CRT_SECURE_NO_WARNINGS
#pragma target("avx2")
#pragma optimize("O3")
#pragma optimize("unroll-loops")
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <ctime>
#include <deque>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <list>
#include <map>
#include <memory>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <string.h>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
#define rep(i,n) for(int i=0;i<(n);i++)
#define REP(i,n) for(int i=1;i<=(n);i++)
#define all(V) V.begin(),V.end()
typedef unsigned int uint;
typedef long long lint;
typedef unsigned long long ulint;
typedef std::pair<int, int> P;
typedef std::pair<lint, lint> LP;
constexpr int INF = INT_MAX/2;
constexpr lint LINF = LLONG_MAX/2;
constexpr double eps = DBL_EPSILON;
constexpr double PI=3.141592653589793238462643383279;
template<class T>
class prique :public std::priority_queue<T, std::vector<T>, std::greater<T>> {};
template <class T, class U>
inline bool chmax(T& lhs, const U& rhs) {
	if (lhs < rhs) {
		lhs = rhs;
		return 1;
	}
	return 0;
}
template <class T, class U>
inline bool chmin(T& lhs, const U& rhs) {
	if (lhs > rhs) {
		lhs = rhs;
		return 1;
	}
	return 0;
}
inline lint gcd(lint a, lint b) {
	while (b) {
		lint c = a;
		a = b; b = c % b;
	}
	return a;
}
inline lint lcm(lint a, lint b) {
	return a / gcd(a, b) * b;
}
bool isprime(lint n) {
	if (n == 1)return false;
	for (int i = 2; i * i <= n; i++) {
		if (n % i == 0)return false;
	}
	return true;
}
template<typename T>
T mypow(T a, lint b) {
	T res(1);
	while(b){
		if(b&1)res*=a;
		a*=a;
		b>>=1;
	}
	return res;
}
lint modpow(lint a, lint b, lint m) {
	lint res(1);
	while(b){
		if(b&1){
			res*=a;res%=m;
		}
		a*=a;a%=m;
		b>>=1;
	}
	return res;
}
template<typename T>
void printArray(std::vector<T>& vec) {
	rep(i, vec.size()){
		std::cout << vec[i];
		std::cout<<(i==(int)vec.size()-1?"\n":" ");
	}
}
template<typename T>
void printArray(T l, T r) {
	T rprev = std::prev(r);
	for (T i = l; i != rprev; i++) {
		std::cout << *i << " ";
	}
	std::cout << *rprev << std::endl;
}
LP extGcd(lint a,lint b) {
	if(b==0)return {1,0};
	LP s=extGcd(b,a%b);
	std::swap(s.first,s.second);
	s.second-=a/b*s.first;
	return s;
}
LP ChineseRem(const lint& b1,const lint& m1,const lint& b2,const lint& m2) {
	lint p=extGcd(m1,m2).first;
	lint tmp=(b2-b1)*p%m2;
	lint r=(b1+m1*tmp+m1*m2)%(m1*m2);
	return std::make_pair(r,m1*m2);
}
template<typename F>
inline constexpr decltype(auto) lambda_fix(F&& f){
	return [f=std::forward<F>(f)](auto&&... args){
		return f(f,std::forward<decltype(args)>(args)...);
	};
}
#line 2 "main.cpp"
int N,A[100010],B[100010];
bool used[50010];
int main(){
	std::cin>>N;
	rep(i,N)std::cin>>A[i];
	rep(i,N)std::cin>>B[i];
	std::vector<P> vec[2];
	lint ans=0;
	for(int i=0;i<N;i+=2){
		int memo=std::max(A[i]+A[i+1],B[i]+B[i+1]);
		ans+=memo;
		vec[0].emplace_back(A[i]+B[i+1]-memo,i/2);
		vec[1].emplace_back(A[i+1]+B[i]-memo,i/2);
	}
	std::sort(all(vec[0]),std::greater<P>());
	std::sort(all(vec[1]),std::greater<P>());
	int now[2]={};
	while(true){
		while(now[0]<N/2&&used[vec[0][now[0]].second])now[0]++;
		while(now[1]<N/2&&used[vec[1][now[1]].second])now[1]++;
		if(now[0]==N/2||now[1]==N/2)break;
		if(vec[0][now[0]].first+vec[1][now[1]].first<=0)break;
		ans+=vec[0][now[0]].first+vec[1][now[1]].first;
		used[vec[0][now[0]].second]=true;
		used[vec[1][now[1]].second]=true;
		now[0]++;now[1]++;
	}
	std::cout<<ans<<std::endl;
	return 0;
}

#include <bits/stdc++.h>
using namespace std;
#define per(i,a,b) for(int i=(b)-1;i>=a;i--)
#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define de(x) cout<<#x<<" = "<<x<<"\n"
#define dd(x) cout<<#x<<" = "<<x<<" "
#define mes(p) memset(p,0,sizeof(p))
#define all(x) x.begin(),x.end()
#define rson mid+1,r,rt<<1|1
#define sz(x) (int)x.size()
#define lson l,mid,rt<<1
#define mp make_pair
#define pb push_back
#define ls (rt<<1)
#define rs (ls|1)
#define se second
#define fi first
typedef pair <int ,int > pii;
typedef vector <int > vi;
typedef long long ll;
typedef unsigned long long ull;
typedef double db;
const ll LINF = 0x3f3f3f3f3f3f3f3f;
const int INF = 0x3f3f3f3f;
const int mod = 1e9+7;

const int maxn= 1e5+5;
const int N = 1e6 + 6;
int n;
int a[maxn], b[maxn];
vi v[4];
int main(){
	scanf("%d", &n);
	ll ans = 0;
	rep(i,0,n)scanf("%d", &a[i]), ans+=a[i];
	rep(i,0,n) scanf("%d", &b[i]), b[i] -= a[i], v[i&1].pb(b[i]);
	rep(i,0,2) sort(all(v[i])), reverse(all(v[i]));
	rep(i,0,n/2){
		if(v[0][i] + v[1][i] > 0)
			ans += 1ll*v[0][i] + v[1][i];
	}
	cout << ans;
    return 0;
}


    /* Great things never come from comfort zones,
    "whatever the mind of a man can conceive and believe,it can achieve." */

    #include <bits/stdc++.h>

   // #include <ext/pb_ds/assoc_container.hpp>
  //  #include <ext/pb_ds/tree_policy.hpp>

    using namespace std;

  //  using namespace __gnu_pbds;
  //  using ordered_set = tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update>;

    void my_dbg() { cout << endl; }
    template<typename Arg, typename... Args> void my_dbg(Arg A, Args... B)
    { cout << ' ' << A; my_dbg(B...); }
    #define dbg(...) cout << "(" << #__VA_ARGS__ << "):", my_dbg(__VA_ARGS__)

    #define ll long long
    #define dd double
    #define scf(n) scanf("%d",&n)
    #define lscf(n) scanf("%lld",&n)
    #define lpri(n) printf("%lld ",n)
    #define pri(n) printf("%d ",(int)n)
    #define prin(n) printf("%d\n",(int)n)
    #define lprin(n) printf("%lld\n",n)
    #define rep(i,ini,n) for(int i=ini;i<(int)n;i++)
    #define show(a) for(auto xy: a) pri(xy); printf("\n");

    #define pb push_back
    #define mp make_pair
    #define F first
    #define S second
    #define all(x)     x.begin(),x.end()
    #define SET(a,b) memset(a,b,sizeof(a))
    #define tc   int tt; scf(tt); while(tt--)

    #define inf INT_MAX
    #define ninf INT_MIN
    #define gcd __gcd
    #define bitcount(n) __builtin_popcount(n)

    const ll mod=1e9+7;
    const int N = 1e6+7;

    int main()
    {
        int n; scf(n);

        int a[n],b[n];

        rep(i,0,n)scf(a[i]);

        rep(i,0,n)scf(b[i]);

        int x=0;

        rep(i,0,n)x+=(a[i]*b[i]);

        if(x==0)printf("Yes\n");

        else
            printf("No\n");

    }

#include <bits/stdc++.h>
using namespace std;
void __print(int x) {cout << x;}
void __print(long x) {cout << x;}
void __print(long long x) {cout << x;}
void __print(unsigned x) {cout << x;}
void __print(unsigned long x) {cout << x;}
void __print(unsigned long long x) {cout << x;}
void __print(float x) {cout << x;}
void __print(double x) {cout << x;}
void __print(long double x) {cout << x;}
void __print(char x) {cout << '\'' << x << '\'';}
void __print(const char *x) {cout << '\"' << x << '\"';}
void __print(const string &x) {cout << '\"' << x << '\"';}
void __print(bool x) {cout << (x ? "true" : "false");}

template<typename T, typename V>
void __print(const pair<T, V> &x) {cout << '{'; __print(x.first); cout << ','; __print(x.second); cout << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cout << '{'; for (auto &i: x) cout << (f++ ? "," : ""), __print(i); cout << "}";}
void _print() {cout << "]"<<endl;}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cout << ", "; _print(v...);}
#define deb(x...) cout << #x << " = ["; _print(x)
template<typename T,typename T1>T amax(T &a,T1 b){if(b>a)a=b;return a;}
template<typename T,typename T1>T amin(T &a,T1 b){if(b<a)a=b;return a;}
// =================
#define f(i, k, n) for (int i = k; i < n; i++)
#define r(i, k, n) for (int i = k; i >= n; i--)
#define ll long long
// #define int ll
#define pb push_back
#define fr first
#define sc second
#define len(s) s.size()
#define all(v) v.begin(), v.end()
#define tr(it, v) for (auto &it : v)
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef map<int, int> mii;
typedef vector<pii> vpii;
typedef vector<string> vs;
typedef vector<vi> vvi;
// =================

const int mod = 1e9+7;
const int N = 3e5 + 1;

void solve()
{
    int n,k;
    cin>>n>>k;
    ll cnt=0;
    int sum=max(k+2,2);
    while (sum<=2*n)
    {
        int req=sum-k;
        int r1=min(n,sum-1),l1=max(sum-r1,1);
        int r2=min(n,req-1) , l2= max(req-r2,1);
        // deb(sum,req);
        sum++;
        // deb(l1,r1,l2,r2);
        if(max(l1,r1)>n || max(l2,r2)>n || min(l1,r1)<1 || min(l2,r2)<1) continue;
        cnt+= 1ll*(abs(r1-l1) + 1)*(abs(r2- l2) + 1);
        // deb(cnt);
    }

    cout<<cnt;
}

signed main()
{
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);

    int t = 1;
    while (t--)
        solve();
    // cerr<<(1000*clock())/CLOCKS_PER_SEC<<"ms";
    return 0;
}


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

int main(){
    int N; cin >> N;
    vector<double> a(N),b(N),c(N),d(N);
    for(int _=0; _<2; _++){
        for(int i=0; i<N; i++) cin >> a[i] >> b[i];
        int x = 0, y = 0;
        for(int i=0; i<N; i++){
            x += a[i];
            y += b[i];
            a[i] *= N;
            b[i] *= N;
        }
        for(int i=0; i<N; i++){
            a[i] -= x;
            b[i] -= y;
        }
        swap(a,c);
        swap(b,d);
    }
    for(int i=0; i<N; i++){
        if(a[i]!=0 || b[i]!=0){
            swap(a[i],a[0]);
            swap(b[i],b[0]);
        }
    }
    string ans = "No";
    const double eps = 1e-6;
    for(int i=0; i<N; i++){
        double angle = atan2(d[i],c[i])-atan2(b[0],a[0]);
        bool flag = true;
        for(int j=0; j<N; j++){
            double A = a[j]*cos(angle)-b[j]*sin(angle);
            double B = a[j]*sin(angle)+b[j]*cos(angle);
            bool flag2 = false;
            for(int k=0; k<N; k++){
                if(std::abs(A-c[k])<=eps && std::abs(B-d[k])<=eps) flag2 = true;
            }
            flag &= flag2;
        }
        if(flag) ans = "Yes";
    }
    cout << ans << endl;
}

#include <bits/stdc++.h>

using namespace std;

typedef long long int ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<bool> vb;
typedef vector <string> vs;
typedef vector<vector<int>> vvi;
typedef pair<int,int> pi;

//#define int ll
#define forl(i,a,b) for (int i = a; i < b; i++)
#define rfor(i,b,a) for (int i = b; i >= a; i--)
#define f first
//#define s second
#define pb push_back
#define mp make_pair
#define srt(x) sort(x.begin(), x.end())
#define sumup(x) accumulate(x.begin(), x.end(), 0)
#define PI 3.141592653589793238
// #define MOD 1000000007
#define rep(i,n) for(int i=0; i<n; i++)
#define rep1(i,n) for(int i=1; i<=n; i++)
#define rrep(i,n) for(int i = n-1; i >= 0; i--)
#define rrep1(i,n) for(int i=n; i>=1; i--)
#define YES cout<<"YES\n"
#define NO cout<<"NO\n"

const ll M=1e9+7;
long long mod(long long x){
    return ((x%M + M)%M);
}
long long add(long long a, long long b){ //(a+b)%M
    return mod(mod(a)+mod(b));
}
long long mul(long long a, long long b){ //(a*b)%M
    return mod(mod(a)*mod(b));
}
long long modPow(int x, int y){ //(x^y)%M
    if(y==0) return 1LL;
    if(y==1) return mod(x);
    long long res=1;
    while(y){
        if(y%2==1)
            res=mul(res,x);
        x=mul(x,x);
        y/=2;
    }
    return res;
}
const int N=2e5+2;
int fact[N];

void precalc(){
    fact[0]=1;
    for(int i=1;i<N;i++){
        fact[i]=mul(fact[i-1],i);
    }
}
ll inv(ll x){
    return modPow(x,M-2);
}
ll divide(ll a, ll b){
    return mul(a,inv(b));
}
ll nCr(ll n, ll r){
    return divide(fact[n],mul(fact[r],fact[n-r]));
}

void io() {
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
}

// number of partition sticks.. from 0 to n-1
// loop from 1 to n for first partition
// recurse on the left part for partitions-1; until no patition

void solve() {
    int n; cin>>n;
    vl a(n);
    rep(i,n) cin>>a[i];

if(n==1) {
    cout<<a[0]<<"\n"; return;
}

ll range = (1<<(n-1))-1;
ll ans = INT_MAX;
for(ll j=0; j<range; j++) {
    // convert to binary digits and do partitions alongwith
    vector<ll> b;
    ll total = 0;
    for(ll i=0; i<n; i++) {
        total |= a[i];
        if(j&(1<<i)) {
            b.push_back(total);
            total = 0;
        }
    }
    if(total) b.push_back(total);
    ll cal = 0;
    for(auto el: b) cal ^= el;

    ans = min(ans, cal);

}

cout<<ans;

    return;
}
int32_t main() {
    io();
    int t=1;
    //cin>>t;
    while(t--) {
        solve();
    }
    return 0;
}


#include <bits/stdc++.h>

using namespace std;
using ll = long long;

int main() {
  cin.tie(0), ios::sync_with_stdio();
  int n, mn = 1001, mx = -1, x;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> x;
    mx = max(mx, x);
  }
  for (int i = 0; i < n; i++) {
    cin >> x;
    mn = min(mn, x);
  }
  if (mx > mn) cout << "0\n";
  else
    cout << mn - mx + 1 << '\n';
}

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

int main(void){
    int N;
    cin >> N;
    int A[N], B[N];
    vector<int> x;
    rep(i, N) cin >> A[i];
    rep(i, N) cin >> B[i];

    rep(i, N){
        if(i==0){
            for(int j=A[i]; j<=B[i]; j++){
                if(A[i]<=j && B[i]>=j) x.push_back(j);
            }
        }else{
            rep(j, x.size()){
                if(x[j]<A[i] || x[j]>B[i]){
                    x.erase(x.begin()+j);
                    j--;
                }
            }
        }
    }

    cout << x.size() << endl;

    return 0;
}


#include<bits/stdc++.h>
#define ll long long
using namespace std;
int main()
{
    ll a,b,c,d;
    cin>>a>>b>>c>>d;
    ll count=0;
    ll cyan=a;
    ll red=0;

    while(cyan>red)
    {
        if(count>100000)
        {
            cout<<-1<<endl;
            return 0;
        }
        cyan+=b;
        red+=c;
        count++;
        if(cyan<=red*d)
        break;
    }
    cout<<count<<endl;

}

#include <iostream>
#include <vector>
#include <unordered_map>
#include <deque>
#include <list>
#include <set>
#include <random>
#include <deque>
#include <unordered_set>

using namespace std;
using ll = long long;
const ll BIG = 1000000007;

int main() {
    ll x1,y1,x2,y2;
    cin >> x1 >> y1 >> x2 >> y2;
    if(x1 == x2 && y1 == y2){
        cout << 0 << endl;
    }
    else if((x1 + y1) == (x2 + y2) || (x1 - y1) == (x2 - y2) || (abs(x1 - x2) + abs(y1 - y2)) <= 3){
        cout << 1 << endl;
    }
    else{
        if((x1 + y1) % 2 == (x2 + y2) % 2){
            cout << 2 << endl;
        }
        else{
            for(ll x = x1 - 3;x <= x1 + 3;++x){
                for(ll y = y1 - 3;y <= y1 + 3;++y){
                    if((abs(x - x1) + abs(y - y1)) <= 3){
                        if(((x + y) == (x2 + y2)) || ((x - y) == (x2 - y2))){
                            cout << 2 << endl;
                            return 0;
                        }
                    }
                }
            }
            cout << 3 << endl;
        }
    }
}


#include<bits/stdc++.h>
using namespace std;
void dfs(vector<vector<int > > &g,int s,int &n,int &m,int &ans,vector<int > &vis)
{
  if(vis[s])
    return;

  vis[s]=1;
  for(unsigned int i=0;i<g[s].size();i++)
  {
    if(!vis[g[s][i]])
    { ans++;
    dfs(g,g[s][i],n,m,ans,vis);
    }
  }
  return ;
}
int main()
{
  int n;
  int m;
  cin>>n>>m;
  vector<vector<int> > g(n);

  for(int i=0;i<m;i++)
  {
    int x,y;
    cin>>x>>y;
    x=x-1;
    y=y-1;
    g[x].push_back(y);
  }
  int ans= n;

  for(int i=0;i<n;i++)
  { vector<int> vis;
   for(int j=0;j<n;j++)
     vis.push_back(0);
   int a=0;

    dfs(g,i,n,m,a,vis) ;
   ans+=a;
   // ans+=(long long int) (a  );
  // cout<<"i"<<i<<" "<<a<<endl;
  }
  cout<<ans<<endl;
  return 0;
}

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

ll ans = 0;
vector<bool> seen;

void dfs(Graph &g,int v){

   seen.at(v) = true;
   ans++;
   for(auto nv:g.at(v)){
       if(!seen.at(nv)){
       dfs(g,nv);
       }
   }
   return;
}
int main(){
   int n,m;
   cin >> n >> m;
   Graph g(n);
   rep(i,m){
       int a,b;
       cin >> a >> b;
       a--; b--;
       g.at(a).push_back(b);
   }

   rep(i,n){
       seen.assign(n, false);
       dfs(g,i);
   }
   cout << ans << endl;
}


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

#define int long long
const int MOD = (int)1e9 + 7;

int binpow(int a, int b) {
    a %= MOD;
    int res = 1;
    while (b > 0) {
        if (b & 1)
            res = res * a % MOD;
        a = a * a % MOD;
        b >>= 1;
    }
    return res;
}
int inverse(int x){
    return binpow(x, MOD - 2);
}

void solve()
{
    int N, Q;
    cin >> N >> Q;
    vector<int> A(N);
    for(int i = 0; i < N; i++)  cin >> A[i];
    sort(A.begin(), A.end());
    auto search = [&](int K){
        int l = 0, r = N - 1;
        while(l <= r){
            int mid = (l + r) / 2;
            int num = A[mid] - (mid + 1);
            if(num == K){
                if(mid > 0 && ((A[mid - 1] - mid) == K)){
                    r = mid - 1;
                    continue;
                }
                return A[mid] - 1;
            }
            if(num < K) l = mid + 1;
            else if(K < num)    r = mid - 1;
        }
        if(r < 0)   return K;
        int less = A[r] - (r + 1);
        K -= less;
        return A[r] + K;
    };
    while(Q--){
        int K;
        cin >> K;
        cout << search(K) << "\n";
    }
}

signed main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0), cout.tie(0);
    solve();
    cerr << "Time elapsed : " << 1.0 * clock() / CLOCKS_PER_SEC << " sec \n ";
}

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

map <string, int> str;  // map のデータ構造を用意する。
string s[200010];

int main() {
	int n;

	cin >> n;
	rep(i, n) {
		cin >> s[i];
		if (s[i].at(0)=='!'){
			if (str[s[i]]==1){
				cout << s[i].substr(1) << endl;
				return 0;
			}
			str[s[i]]=10;
		}else{
			if (str['!'+s[i]]==10){
				cout << s[i] << endl;
				return 0;
			}
			str['!'+s[i]]=1;
		}
	}
	cout << "satisfiable" << endl;
	return 0;
}


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

#define mp make_pair
#define pb push_back
#define ll long long int
#define sd(x) scanf("%lld",&x)
#define sdi(x) scanf("%d",&x)
#define sdc(c) scanf("%c",&c)
#define inf 1000000000000000000ll
#define pll pair<ll,ll>
#define pii pair<int,int>
#define fastio ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define bits(x) __builtin_popcountll(x)
#define ld long double
#define test() ll test; cin>>test; while(test--)
#define fi first
#define se second
#define all(x) x.begin(),x.end()

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

inline ll GCD(ll x, ll y) {
    if(x<y) swap(x,y);
    if(x==0) return y;
    if(y==0) return x;
    return GCD(x%y,y);
}

ll phi(ll n) {
    ll result = n;
    for (ll i = 2; i * i <= n; i++) {
        if(n % i == 0) {
            while(n % i == 0)
                n /= i;
            result -= result / i;
        }
    }
    if(n > 1)
        result -= result / n;
    return result;
}

ll power(ll x, ll n, ll mod) {
    ll res = 1;
    x %= mod;
    while(n) {
        if(n&1) {
            res = ((res*x)%mod+mod)%mod;
        }
        x = ((x*x)%mod+mod)%mod;
        n>>=1;
    }

    return res;
}

const int MOD = 1e9+7;

inline ll add(ll x, ll y, ll MOD) {
    x %= MOD;
    y %= MOD;
    ll ans = (x+y)%MOD;
    return ans;
}

inline ll mul(ll x,ll y, ll MOD) {
    x %= MOD;
    y %= MOD;
    ll ans = ((x*y)%MOD+MOD)%MOD;
    return ans;
}

ll N,M;
ll adj[20][20]={0};

int main() {
    fastio;

    cin>>N>>M;

    /*if(M==0) {
        cout<<"N"<<endl;
        return 0;
    }*/

    ll x,y;
    for(int i=1;i<=M;i++) {
        cin>>x>>y;
        adj[x][y] = 1;
        adj[y][x] = 1;
    }

    ll MX = (1<<N);
    ll BT = MX-1;
    vector<ll> v;
    bool check=false;
    vector<ll> dp(MX+1,0);
    dp[0]=1;
    ll ans = 0;
    for(ll i=1;i<MX;i++) {
        // if(bits(i)==1) continue;
        v.clear();
        for(int j=0;j<N;j++) {
            if((i>>j)&1) {
                v.pb(j+1);
            }
        }

        check=true;
        for(int j=0;j<v.size();j++) {
            for(int k=j+1;k<v.size();k++) {
                if(!adj[v[j]][v[k]]) {
                    check=false;
                    break;
                }
            }
        }

        if(check) {
            dp[i] = 1;
        }
    }

    vector<ll> G(MX+1,inf);
    G[0]=0;
    for(ll i=1;i<MX;i++) {
        if(dp[i]) {
            G[i] = 1;
            continue;
        }

        for(ll mask = i;mask>0;mask = (i&(mask-1))) {
            G[i] = min(G[i],G[mask]+G[i^mask]);
        }
    }

    ans = G[BT];
    cout<<ans<<endl;
}

#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define all(x) x.begin(),x.end()
#define pll  pair <long long,long long>
#define ss second
#define ff first
#define inf (ll)1e18
#define mod 998244353
#define ld long double
#define fast  ios_base::sync_with_stdio(false);cin.tie(NULL);
#define bug(x) cout << #x <<": " << x << '\n';
#define endl "\n"
#define size sz
const ll N=101 ;
ll n ;
vector<pair<ld,ld>>v ;
vector<ll>adj[N] ;
ld get_dist(ll i,ll j)
{
	return (v[i].ff-v[j].ff)*(v[i].ff-v[j].ff)+(v[i].ss-v[j].ss)*(v[i].ss-v[j].ss) ;
}
bool check(ld r)
{
	ll vis[n] ;
	for(ll i=0;i<n;i++) vis[i]=false ;

	queue<ll>q ;

	for(ll i=0;i<n;i++)
	{
		if(100.0-v[i].ss<2.0*r)
		{
			vis[i]=true ;
			q.push(i) ;
		}
	}

	while(!q.empty())
	{
		ll node=q.front() ;

		if(v[node].ss+100.0<2.0*r) return false ;

		q.pop() ;

		for(ll child:adj[node])
		{
			if(vis[child]==false)
			{
				vis[child]=true ;
				q.push(child) ;
			}
		}
	}
	return true ;
}
int main(){
	fast ;
	cin>>n ;
	for(ll i=0;i<n;i++){
		ld x,y ;
		cin>>x>>y ;
		v.pb({x,y}) ;
	}
	ld low=0.0,high=100.0,ans=1.0 ;
	while((high-low)>=0.000000001){
		ld mid=(low+high)/2.0 ;
		for(ll i=0;i<N;i++) adj[i].clear() ;
		for(ll i=0;i<n;i++){
			for(ll j=i+1;j<n;j++){
				ld dist=get_dist(i,j) ;
				if(dist<4.0*mid*mid) adj[i].pb(j), adj[j].pb(i);
			}
		}
		if(check(mid))  ans=mid,low=mid ;
		else high=mid ;
	}
	cout<<fixed<<setprecision(10)<<ans ;
}


#include <bits/stdc++.h>
#define br cout << "\n";
#define pb push_back
#define ll long long
#define ff first
#define ss second
#define all(x) x.begin(),x.end()
#define in(a , idx , n ) for (int i = idx ; i < n ; ++i)cin >>a[i];
#define fix() cout <<fixed <<  std::setprecision(10)

using namespace std;
const int MOD = 1000*1000*1000 + 7 ;
const int MAXN = 1000*1000 +10 ;
const ll INF = 1e18 ;

void solve(){
	string s , t ;
	cin >> s >> t  ;
	if ( s[0] == 'Y')
		cout<<((char)((int)t[0]-32));
	else
		cout << t[0];
	br

}

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

return 0 ;
}

#line 1 "C.cpp"
#include <bits/stdc++.h>
using namespace std::literals::string_literals;
using i64 = std::int_fast64_t;
using std::cout;
using std::cerr;
using std::endl;
using std::cin;

#if defined(DONLINE_JUDGE)
	#define NDEBUG
#elif defined(ONLINE_JUDGE)
	#define NDEBUG
#endif

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

int main() {
	int h, w; scanf("%d%d", &h, &w);
	std::vector<std::string> s(h);
	for(auto& v: s) std::cin >> v;

	int ans = 0;
	for(int i = 0; i < h; i++) {
		for(int j = 0; j < w; j++) {
			if(s[i][j] == '.') {
				if(i - 1 >= 0 and j - 1 >= 0 and s[i - 1][j] == '#' and s[i][j - 1] == '#') ans++;
				if(i - 1 >= 0 and j + 1 <  w and s[i - 1][j] == '#' and s[i][j + 1] == '#') ans++;
				if(i + 1 <  h and j - 1 >= 0 and s[i + 1][j] == '#' and s[i][j - 1] == '#') ans++;
				if(i + 1 <  h and j + 1 <  w and s[i + 1][j] == '#' and s[i][j + 1] == '#') ans++;
			} else {
				if(s[i - 1][j] == '.' and s[i][j - 1] == '.') ans++;
				if(s[i - 1][j] == '.' and s[i][j + 1] == '.') ans++;
				if(s[i + 1][j] == '.' and s[i][j - 1] == '.') ans++;
				if(s[i + 1][j] == '.' and s[i][j + 1] == '.') ans++;
			}
		}
	}
	printf("%d\n", ans);
	return 0;
}


#include <bits/stdc++.h>
using namespace std;
using ll=long long;using vl=vector<ll>;
using vi=vector<int>;using vs=vector<string>;using vc=vector<char>;
using vvl=vector<vl>;using pl=pair<ll,ll>;using vvc=vector<vc>;
using vd=vector<double>;using vpl=vector<pl>;using vb=vector<bool>;
#define rep(i,r) for(ll i=0;i<(r);i++)
#define Rep(i,l,r) for(ll i=(l);i<(r);i++)
#define print(n) cout<<(n)<<endl
#define all(a)  (a).begin(),(a).end()
#define sortp(d) sort(all(d))
#define sortm(d) sort(d.rbegin(),d.rend())
//cout<<fixed<<setprecision(15)<<
//priority_queue<pl,vpl,greater<pl>>
void yn(bool b){print(b?"Yes":"No");exit(0);}
ll gcd(ll a,ll b) {if(b==0)return a;else return gcd(b,a%b);}
ll lcm(ll a,ll b){return a/gcd(a,b)*b;}
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){return modpow(a, mod - 2, mod);}
ll p=0,q=0,r=0,inf=100000000000000000,mod=1000000007;
ll dx[8]={1,0,-1,0,1,-1,-1,1},dy[8]={0,1,0,-1,1,1,-1,-1};
//ここから本質←ほんまか？
double pi=3.141592653589793238462643383279;
ll fac[10000001],inv[10000001],facinv[10000001];
void cominit(ll max){fac[0]=1;fac[1]=1;inv[1]=1;facinv[0]=1;facinv[1]=1;
for(int i=2;i<=max;i++){fac[i]=(fac[i-1]*i)%mod;
inv[i]=mod-inv[mod%i]*(mod/i)%mod;facinv[i]=facinv[i-1]*inv[i]%mod;}}
ll com(ll n,ll k){return fac[n]*(facinv[k]*facinv[n-k]%mod)%mod;}
int main()
{
  ll z,m;cin>>z>>m;
  mod=998244353;
  cominit(z+m);
  Rep(i,1,m+1)
  {
    ll n=i;
    q=1;
    for(ll div=2;div*div<=n;div++)
    {
        if(n%div!=0)continue;
        ll tmp=0;
        while(n%div==0)n/=div,tmp++;
        //div^tmpが素因数
        /*any*/
      	q*=com(z+tmp-1,tmp);
      	q%=mod;
    }
    if(n!=1){/*any*/q*=z;q%=mod;}
    p+=q;
    p%=mod;
  }
  print(p);
}
//中１水コーダーになりたいんです...お願いします...後輩にカッコつけたいんです...マジで...
//てかもう中１終わるの流石にバグだろ
//↑それな
//劇団ひとり定期
//さみし()
//そういえばコーヒーは美味しいですね。魔剤なんか飲むなら黙ってコーヒー
//コメントの使い方ってこういう感じですよね！？

#include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <ctime>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <vector>
#define setIO(x) freopen(x".in", "r", stdin), freopen(x".out", "w", stdout)
#define closefile fclose(stdin), fclose(stdout)
#define m_p make_pair
#define sz(x) (int)x.size()
#define see(x) cerr << x << " "
#define seeln(x) cerr << x << endl
#define out(x) cerr << #x << " = " << x << " "
#define outln(x) cerr << #x << " = " << x << endl
#define outarr(x, l, r) {cerr<< #x"[" << l << " ~ " << r << "] = "; for (int _i = l; _i <= r; ++_i) cerr << x[_i] << " "; cerr << endl;}
using namespace std;
typedef long long ll;
typedef pair <int, int> pii;
#define gc() getchar()
//#define gc() (p1 == p2 && (p2 = (p1 = buf) + fread(buf, 1, 1 << 21, stdin), p1 == p2) ? EOF : *p1++)
char buf[1 << 21], *p1 = buf, *p2 = buf;
template <class T> void read(T &x)
{
    x = 0; int c = gc(); int flag = 0;
    while (c < '0' || c > '9') flag |= (c == '-'), c = gc();
    while (c >= '0' && c <= '9') x = (x << 3) + (x << 1) +(c ^ 48), c = gc();
    if (flag) x = -x;
}
template <class T> T _max(T a, T b){return b < a ? a : b;}
template <class T> T _min(T a, T b){return a < b ? a : b;}
template <class T> bool checkmax(T &a, T b){return a < b ? a = b, 1 : 0;}
template <class T> bool checkmin(T &a, T b){return b < a ? a = b, 1 : 0;}
const int N = 200005, mod = 998244353;
void add(int &a, int b){a += b; (a >= mod) && (a -= mod);}
void sub(int &a, int b){a -= b; (a < 0) && (a += mod);}
void mul(int &a, int b){a = (ll)a * b % mod;}
int Add(int a, int b){a += b; return a >= mod ? a - mod : a;}
int Sub(int a, int b){a -= b; return a < 0 ? a + mod : a;}
int Mul(int a, int b){return (ll)a * b % mod;}
int qpow(int a, int b){int ans = 1; while (b) {if (b & 1) ans = (ll)ans * a % mod; a = (ll)a * a % mod; b >>= 1;} return ans;}
vector<int> f[N];
int n, m, lim;
int ans = 0;
int fac[N], ifac[N];
void init()
{
	read(n); read(m);
	for (int i = 1; i <= m; ++i) for (int j = i; j <= m; j += i) if (i > 1) f[j].push_back(i);
	fac[0] = 1; for (int i = 1; i <= n; ++i) fac[i] = Mul(fac[i - 1], i);
	ifac[n] = qpow(fac[n], mod - 2); for (int i = n - 1; i >= 0; --i) ifac[i] = Mul(ifac[i + 1], i + 1);
}

const int K = 448;
int cnt = 0;
void dfs(int x, int s, int co, int num)
{
	if (m < (ll)x * s) x = K + 1;
	if (x > K)
	{
		add(ans, Mul(fac[n], Mul(ifac[n - num], co)));
		if (K + 1 <= m / s && num < n)
		{
			int pq = m / s - K;
			add(ans, Mul(Mul(fac[n], pq), Mul(ifac[n - 1 - num], co)));
		}
		return;
	}
	int now = s, lim = m / x;
	for (int i = 0; i <= n - num; ++i)
	{
		dfs(x + 1, now, Mul(co, ifac[i]), num + i);
		if (now > lim) break;
		now *= x;
	}
}

void solve()
{
	dfs(2, 1, 1, 0);
	outln(cnt);
	printf("%d\n", ans);
}

int main()
{
	init();
	solve();
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
int main(){
    int m,h;
    cin>>m>>h;
    if(h%m==0){
        cout<<"Yes\n";
    }
    else{
        cout<<"No\n";
    }
    return 0;
}

#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
typedef long long ll;
#define F first
#define S second
#define YES(n)cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl

int main(){
    int M,H;
    cin>>M>>H;
    Yes(H%M==0);
    return 0;
}


#include<cstdio>
#include<cstring>
#include<cmath>
#include<cassert>
#include<iostream>
#include<iomanip>
#include<map>
#include<unordered_map>
#include<set>
#include<unordered_set>
#include<vector>
#include<algorithm>
#include<string>
#include<queue>
using namespace std;
#define DEBUG(x) cout<<#x<<"="<<x<<endl
#define DEBUG2(x,y) cout<<#x<<"="<<x<<","<<#y<<"="<<y<<endl
typedef long long ll;
const int MAXN=1;
const ll MOD=1;
ll _gcd(ll a,ll b){if(b==0)return a;return _gcd(b,a%b);}
ll gcd(ll a,ll b){a=abs(a),b=abs(b);if(a<b)swap(a,b);return _gcd(a,b);}
ll qpow(ll a,ll n){ll rt=1;while(n){if(n&1)rt=(rt*a)%MOD;a=a*a%MOD;n>>=1;}return rt;}
ll factor[MAXN];
ll inv[MAXN];
void cal_factor(){factor[0]=1;for(int u=1;u<MAXN;u++){factor[u]=(factor[u-1]*u)%MOD;}}
void cal_factor_inv(){inv[0]=1;inv[MAXN-1]=qpow(factor[MAXN-1],MOD-2);for(int u=MAXN-2;u>=1;u--){inv[u]=inv[u+1]*(u+1)%MOD;}}
void init_factor(){cal_factor();cal_factor_inv();}
ll C(ll n,ll k){if(n<k)return 0;return factor[n]*qpow(factor[n-k],MOD-2)%MOD*qpow(factor[k],MOD-2)%MOD;}
struct mat{
    ll m[3][3];
    mat(){
        memset(m,0,sizeof(m));
    }
    mat(ll a[3][3]){
        memcpy(m,a,sizeof(m));
    }
    mat operator * (const mat mt){
        //m (3,3)
        mat tmp;
        for(int u=0;u<3;u++){
            for(int v=0;v<3;v++){
                for(int k=0;k<3;k++){
                    tmp.m[u][v]+=m[u][k]*mt.m[k][v];
                }
            }
        }
        return tmp;
    }
    mat operator *=(const mat &mt){
        return *this=(*this)*mt;
    }
    friend ostream& operator<<(ostream &out,const mat &m){
        for(int u=0;u<3;u++){
            for(int v=0;v<3;v++){
                cout<<m.m[u][v]<<" ";
            }
            cout<<"\n";
        }
        return out;
    }
};
ll pat[][3][3]={
    {0,1,0,-1,0,0,0,0,1},
    {0,-1,0,1,0,0,0,0,1},
    {-1,0,0,0,1,0,0,0,1},
    {1,0,0,0,-1,0,0,0,1}
};
mat get_mat(int op,int p){
    if(op==1||op==2){
        return mat(pat[op-1]);
    }else if(op==3){
        pat[op-1][0][2]=2*p;
        return mat(pat[op-1]);
    }else if(op==4){
        pat[op-1][1][2]=2*p;
        return mat(pat[op-1]);
    }
}
pair<ll,ll> pt_trans(pair<ll,ll>pt,mat &m){
    ll x,y;
    x=m.m[0][0]*pt.first+m.m[0][1]*pt.second+m.m[0][2];
    y=m.m[1][0]*pt.first+m.m[1][1]*pt.second+m.m[1][2];
    return {x,y};
}
void solve(){
    // ll a1[3][3]={2,0,0,0,2,0,0,0,2},
    // a2[3][3]={1,2,3,4,5,6,7,8,9};
    // mat m1(a1),m2(a2);
    vector<mat>macc;
    vector<pair<ll,ll>>pts;
    int n;
    cin>>n;
    for(int u=0;u<n;u++){
        ll x,y;
        cin>>x>>y;
        pts.push_back({x,y});
    }
    int m;
    cin>>m;
    for(int t=0;t<m;t++){
        int op,p;
        cin>>op;
        if(op==3||op==4)cin>>p;
        if(t==0){
            macc.push_back(get_mat(op,p));
        }else {
            macc.push_back(get_mat(op,p)*macc.back());
        }
    }
    int q;
    cin>>q;
    while(q--){
        int a,b;
        cin>>a>>b;
        b--;
        if(a==0){
            cout<<pts[b].first<<" "<<pts[b].second<<"\n";
            continue;
        }
        a--;
        auto p=pt_trans(pts[b],macc[a]);
        cout<<p.first<<" "<<p.second<<"\n";
    }
}
// #define LOCAL
int main()
{
#ifdef LOCAL
    freopen("in.txt","r",stdin);
#endif
    ios::sync_with_stdio(false);
    cin.tie(0);
    solve();
}

#include<bits/stdc++.h>
using namespace std;
#ifndef ONLINE_JUDGE
#define dbg(x...) do { cout << "\033[32;1m " << #x << " -> "; err(x); } while (0)
void err() { cout << "\033[39;0m" << endl; }
template<template<typename...> class T, typename t, typename... A>
void err(T<t> a, A... x) { for (auto v: a) cout << v << ' '; err(x...); }
template<typename T, typename... A>
void err(T a, A... x) { cout << a << ' '; err(x...); }
#else
#define dbg(...)
#endif
typedef long long ll;
typedef pair<int,int> pi;
typedef vector<int> vi;
template<class T> using vc=vector<T>;
template<class T> using vvc=vc<vc<T>>;
template<class T> void mkuni(vector<T>&v)
{
    sort(v.begin(),v.end());
    v.erase(unique(v.begin(),v.end()),v.end());
}
ll rand_int(ll l, ll r) //[l, r]
{
    static mt19937_64 gen(chrono::steady_clock::now().time_since_epoch().count());
    return uniform_int_distribution<ll>(l, r)(gen);
}
template<class T>
void print(T x,int suc=1)
{
    cout<<x;
    if(suc==1) cout<<'\n';
    else cout<<' ';
}
template<class T>
void print(const vector<T>&v,int suc=1)
{
    for(int i=0;i<v.size();i++)
    print(v[i],i==(int)(v.size())-1?suc:2);
}
const int maxn=1e4+7;
const int mod=998244353;
int main()
{
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int n;
    cin>>n;
    vi a(n);
    for(int i=0;i<n;i++) cin>>a[i];
    vc<vi> dp(n+1,vi(maxn));
    int sum=0;
    dp[0][0]=1;
    for(int i=1;i<=n;i++)
    {
        sum+=a[i-1];
        for(int j=n-1;j>=0;j--)
        {
            for(int k=a[i-1];k<maxn;k++)
                dp[j+1][k]=(dp[j+1][k]+dp[j][k-a[i-1]])%mod;
        }
    }
    if(sum%2!=0) print(0);
    else{
        ll ans=0;
        for(int i=0;i<=n;i++)
        {
            ll cur=dp[i][sum/2];
            //dbg(i,cur);
            for(int j=1;j<=i;j++) cur=cur*j%mod;
            for(int j=1;j<=n-i;j++) cur=cur*j%mod;
            ans=(ans+cur)%mod;
        }
        print(ans);
    }
}


#include<cstdio>
#include<algorithm>
#include<cmath>
using namespace std;
typedef long long ll;
const int mod=1e9+7;
int n,m;
int sa;
int ans1,ans2;
int ksm(ll ta,int tp){
    int s=1;
    for(;tp;ta=ta*ta%mod,tp>>=1) if(tp&1) s=ta*s%mod;
    return s;
}
int main(){
    scanf("%d %d",&n,&m);
    m+=n;
    for(int i=1,a;i<=n;i++){
        scanf("%d",&a); sa+=a;
    }
    sa+=n;
    ans1=ans2=1;
    if(m<sa){
        printf("0\n");
        return 0;
    }
    for(int i=1;i<=sa;i++) ans1=1ll*ans1*i%mod;
    for(int i=1;i<=sa;i++) ans2=1ll*ans2*(m-i+1)%mod;
    printf("%lld\n",1ll*ans2*ksm(ans1,mod-2)%mod);
    return 0;
}

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

template<typename T>
int ex(T p){
  T a = 1;
  if(p == 0){
    return a;
  }
  else{
    for(T i = 1; i <= p; i++){
      a = a*i%1000000007;
    }
    return a;
  }
}
template<typename T>
int eq(T p, T q){
    T r,s = 0,nextp,prevp = 0,prev2p = 1;
    if(q != 1){
        while(s != 1){
            r = p/q; s = p%q;
            nextp = prevp;
            prevp = prev2p - r * prevp;
            prev2p = nextp;
            p = q; q = s;
        }
    return prevp;
    }
    else{
      return 0;
    }
}
template<typename T>
int com(T p,T q){
  T a,b,c,mod = 1000000007;
  a = ex(p);
  b = ex(q);
  for(T i = 1; i <= p-q; i++){
    b = b*i%mod;
  }
  if(b != 1){
    c = ((1 - eq(mod,b)*mod )/b + mod) %mod;
  }
  else{
    c = 1;
  }
  return a*c%mod;
}
template<typename T>
int gcd(T p,T q){
    T s;
    while(q != 0){
        s = p%q;
        p = q; q = s;
    }
    return p;
}

template<typename T>
int point(const vector<T> &P){
  T sum = 0;
  for(T i = 1; i < 10; i++){
    if(P[i] == 0){
      sum += i;
    }
    else{
      T t = 1;
      for(T j = 0; j < P[i]; j++){
        t*=10;
      }
      sum += i*t;
    }
  }
  return sum;
}

int main() {
  int a,b;
  cin >> a >> b;
  cout << 2*a-b+100 << endl;
}


  #include <bits/stdc++.h>
using namespace std;
#define int               long long
#define pb                push_back
#define ppb               pop_back
#define pf                push_front
#define ppf               pop_front
#define all(x)            (x).begin(),(x).end()
#define uniq(v)           (v).erase(unique(all(v)),(v).end())
#define sz(x)             (int)((x).size())
#define fr                first
#define sc                second
#define pii               pair<int,int>
#define vi                vector<int>
#define vii               vector<pii>
#define mi                map<int,int>
#define mii               map<pii,int>
#define rep(i,a,b)        for(int i=a;i<b;i++)
#define el                 '\n'

void solve()
{
    int a,b;
    cin>>a>>b;

    if(a>=b){
      int cnt=0;
      rep(i,1,a+1){
        cout<<i<<' ';
        cnt+=i;
      }
      rep(i,1,b){
        cout<<-1*i<<' ';
        cnt-=i;
      }
      cout<<-1*cnt<<el;
    }
    else{
         int cnt=0;
      rep(i,1,b+1){
        cout<<-1*i<<' ';
        cnt+=i;
      }
      rep(i,1,a){
        cout<<1*i<<' ';
        cnt-=i;
      }
      cout<<1*cnt<<el;
    }

}

signed main()
{

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

  #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
  #endif

   int t=1;
  // cin>>t;

   while(t--) solve();
   return 0;
}

#include <iostream>
#include<cstring>
#include<vector>
#include<algorithm>
#include<math.h>
#include<climits>
using namespace std;

int main() {
#ifndef ONLINE_JUDGE
	freopen("in.txt", "r", stdin);
	freopen("ou.txt", "w", stdout);
#endif
	int a, b; cin >> a >> b;
	vector<int> v, v1;
	if (a > b) {
		int sum = 0, sum1 = 0;
		for (int i = 1; i <= a; i++) {
			v.push_back(i);
			sum += i;
		}
		for (int i = 1; i <= b - 1; i++) {
			v1.push_back(-i);
			sum1 += i;
		}
		v1.push_back(sum1 - sum);
	}
	else if (a < b) {
		int sum = 0, sum1 = 0;;
		for (int i = 1; i <= b; i++) {
			v1.push_back(-i);
			sum += i;
		}
		for (int i = 1; i <= a - 1; i++) {
			v.push_back(i);
			sum1 += i;
		}
		v.push_back((sum - sum1));

	}
	else {
		for (int i = 1; i <= a; i++) {
			v1.push_back(-i);
			v.push_back(i);
		}
	}
	for (int i = 0; i < v.size(); i++)
		cout << v[i] << " ";
	for (int i = 0; i < v1.size(); i++)
		cout << v1[i] << " ";
}


#include <iostream>
#include <iomanip>
#include <cmath>
#include <algorithm>
#include <string>
#include <vector>
#include <set>
using namespace std;

#define rep(i, n) for(int i = 0; i < n; i++)
using ll = long long int;

int main(){
    int a, b; cin >> a >> b;
    cout << (a+b)/2 << " " << (a-b)/2 << endl;
    return 0;
}

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

int main() {
    ll N, M;
    cin >> N >> M;

    if ((M > 0 && M >= N - 1) || M < 0) {
        cout << -1 << endl;
        return 0;
    }

    vector<P> ans(N);
    rep(i, N) { ans[i] = make_pair(3 * (i + 1), 3 * (i + 1) + 1); }

    if (M > 0) ans[N - 1].first = 3 * ((N - 1) - (M + 1) + 1) - 1;

    rep(i, N) { cout << ans[i].first << " " << ans[i].second << endl; }
}


//#pragma GCC optimize("Ofast")
//#pragma GCC optimize("O2")
//#pragma GCC optimize("O3")
//#pragma GCC optimize("unroll-loops")
////
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx")
#include <bits/stdc++.h>

#include <utility>

#define all(x) (x).begin(), (x).end()
#define allp(x) (x)->begin(), (x)->end()

#define pb push_back

using namespace std;
void dout() { cerr << endl; }
//typedef long long ll;
template <typename Head, typename... Tail>
void dout(Head H, Tail... T) {
    cerr << H << ' ';
    dout(T...);
}

using ll = long long;
//#ifdef __int128
//using hll = __int128;
//#endif
using pii = pair<ll, ll>;
using ld = long double;

template <typename T>
void do_uniq(vector<T> &vec){
    sort(all(vec));
    vec.resize(unique(all(vec)) - vec.begin());
}

#ifndef ONLINE_JUDGE
clock_t timestamp_start = clock();
void time_calc()
{
    cerr << (ld)(clock() - timestamp_start) / CLOCKS_PER_SEC << "\n";
}
#endif

#ifdef _getchar_nolock
#else
#    define _getchar_nolock getchar_unlocked
#endif

#define integer int

const integer mod = 998244353;

integer ml(integer a, integer b) {
    return (a * 1ll * b) % mod;
}

integer add(integer a, integer b) {
    integer rt = a + b;
    if (rt < mod) return rt;
    return rt - mod;
}

integer sub(integer a, integer b) {
    return add(a, mod - b);
}

integer sq(integer a) {
    return ml(a, a);
}

integer b_p(integer b, ll p) {
    if (p == 0) return 1;
    if (p & 1) return ml(b, b_p(b, p - 1));
    return sq(b_p(b, p >> 1));
}

const ll inf = 1e18 + 231;

#define solvsh
//#define multi

#ifdef solvsh

void precalc() {}
const int INF = 2e9;

const int MAXN = 1e4 + 32;
const int MAXM = 2e5 + 32;

pair<pair<ll, pair<ll, ll>>, pair<ll, pair<ll, ll>>> eqs[MAXM];

void solve() {

    int n;
    cin >> n;
    vector<pair<int, int>> v;
    for (int i = 0; i < n; ++i) {
        int x, y;
        cin >> x >> y;
        v.push_back({x, y});
    }

    eqs[0] = {{1, {0, 0}},
              {0, {1, 0}}};

    int m;
    cin >> m;

    for (int i = 1; i <= m; ++i) {
        int p;
        cin >> p;
        if (p == 1) {
            eqs[i] = {
                    eqs[i - 1].second,
                    {-eqs[i - 1].first.first, {-eqs[i - 1].first.second.first, -eqs[i - 1].first.second.second}}
            };
        } else if (p == 2) {
            eqs[i] = {
                    {-eqs[i - 1].second.first, {-eqs[i - 1].second.second.first, -eqs[i - 1].second.second.second}},
                    eqs[i - 1].first
            };
        } else if (p == 3) {
            int x;
            cin >> x;
            eqs[i] = {
                    {-eqs[i - 1].first.first, {-eqs[i - 1].first.second.first, 2 * x - eqs[i - 1].first.second.second}},
                    eqs[i - 1].second
            };
        } else {
            int y;
            cin >> y;
            eqs[i] = {
                    eqs[i - 1].first,
                    {-eqs[i - 1].second.first,
                     {-eqs[i - 1].second.second.first, 2 * y - eqs[i - 1].second.second.second}}
            };
        }
    }

    int q;
    cin >> q;

    while (q--) {
        int a, b;
        cin >> a >> b;
        --b;
        auto eq = eqs[a];
        ll x = v[b].first;
        ll y = v[b].second;

        cout << eq.first.first * x + eq.first.second.first * y + eq.first.second.second << " "
             << eq.second.first * x + eq.second.second.first * y + eq.second.second.second << "\n";
    }
}

#else

void precalc() {}

void solve() {}

#endif

void multisolve() {
    precalc();
    int t;

    cin >> t;

    int i = 1;
    while (t--) {
        solve();
        i++;
    }
}

void singlesolve (){
    precalc();
    solve();
}

#ifndef ONLINE_JUDGE

void gen() {
}

#endif

#define int int
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr), cout.tie(nullptr);
    cout << fixed << setprecision(20);

#ifdef multi
    //            gen();
    multisolve();
#else
    singlesolve();
//    gen();
#endif

}

/**
 * Author: Daniel
 * Created Time: 2021-04-03 10:23:06
**/

#include <bits/stdc++.h>

using namespace std;

#define F first
#define S second
#define ER erase
#define IS insert
#define PI acos(-1)
#define PB pop_back
#define MP make_pair
#define MT make_tuple
#define LB lower_bound
#define UB upper_bound
#define EB emplace_back
#define lowbit(x) (x & -x)
#define SZ(x) ((int)x.size())
#define ALL(x) x.begin(), x.end()
#define RALL(x) x.rbegin(), x.rend()
#define SOS ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);cout<<fixed<<setprecision(10)

typedef long long LL;
typedef vector<LL> VL;
typedef vector<int> VI;
typedef vector<bool> VB;
typedef pair<LL, LL> PLL;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef unsigned long long ULL;
typedef pair<double, double> PDD;
typedef vector<pair<LL, LL> > VPLL;
typedef vector<pair<int, int> > VPII;

template <typename A> using VE = vector<A>;
template <typename A> using USET = unordered_set<A>;
template <typename A> using HEAP = priority_queue<A>;
template <typename A, typename B> using PA = pair<A, B>;
template <typename A, typename B> using UMAP = unordered_map<A, B>;
template <typename A> using RHEAP = priority_queue<A, vector<A>, greater<A> >;

template <typename A> A MAX(const A &a) { return a; }
template <typename A> A MIN(const A &a) { return a; }
template <typename A> A MAX(const A *a, const A *b) { return *max_element(a, b); }
template <typename A> A MIN(const A *a, const A *b) { return *min_element(a, b); }
template <typename A, typename... B> A MAX(const A &a, const B&... b) { return max(a, MAX(b...)); }
template <typename A, typename... B> A MIN(const A &a, const B&... b) { return min(a, MIN(b...)); }
template <typename A, typename B = typename std::iterator_traits<A>::value_type> B MAX(A a, A b) { return *max_element(a, b); }
template <typename A, typename B = typename std::iterator_traits<A>::value_type> B MIN(A a, A b) { return *min_element(a, b); }

mt19937 rng((unsigned int)chrono::steady_clock::now().time_since_epoch().count());

///////////////////////////////////////////////////////////////////////////
//////////////////// DO NOT TOUCH BEFORE THIS LINE ////////////////////////
///////////////////////////////////////////////////////////////////////////

// check the limitation!!!
const int N = 100010, M = 1010;

// read the question carefully!!!
int main()
{
    SOS;

    int n;
    cin >> n;
    VPLL a(n);
    for (auto &[x, y] : a) cin >> x >> y;
    int m;
    cin >> m;
    bool flag = false;
    LL sx = 1, sy = 1;
    LL cx = 0, cy = 0;
    VE<tuple<bool, LL, LL, LL, LL>> op;
    op.EB(MT(flag, sx, cx, sy, cy));
    for (int i = 0; i < m; i ++ )
    {
        int t;
        cin >> t;
        if (t == 1)
        {
            flag = !flag;
            sx = -sx;
            cx = -cx;
            swap(sx, sy);
            swap(cx, cy);
        }
        else if (t == 2)
        {
            flag = !flag;
            sy = -sy;
            cy = -cy;
            swap(sx, sy);
            swap(cx, cy);
        }
        else if (t == 3)
        {
            LL p;
            cin >> p;
            sx = -sx;
            cx = 2 * p - cx;
        }
        else if (t == 4)
        {
            LL p;
            cin >> p;
            sy = -sy;
            cy = 2 * p - cy;
        }
        else assert(false);
        op.EB(MT(flag, sx, cx, sy, cy));
    }
    int q;
    cin >> q;
    for (int i = 0; i < q; i ++ )
    {
        int c, b;
        cin >> c >> b;
        b -- ;
        LL x, y;
        auto [flag, sx, cx, sy, cy] = op[c];
        if (!flag) x = sx * a[b].F + cx, y = sy * a[b].S + cy;
        else x = sx * a[b].S + cx, y = sy * a[b].F + cy;
        cout << x << ' ' << y << '\n';
    }
    return 0;
}

// GOOD LUCK!!!


#include <iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<map>
#include<set>
#include<stack>
#include<queue>
#include<math.h>
using namespace std;
typedef long long ll;
#define int long long
#define double long double
typedef vector<int> VI;
typedef pair<int, int> pii;
typedef vector<pii> VP;
typedef vector<string> VS;
typedef priority_queue<int> PQ;
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; }
#define fore(i,a) for(auto &i:a)
#define REP(i,n) for(int i=0;i<n;i++)
#define eREP(i,n) for(int i=0;i<=n;i++)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define eFOR(i,a,b) for(int i=(a);i<=(b);++i)
#define SORT(c) sort((c).begin(),(c).end())
#define rSORT(c) sort((c).rbegin(),(c).rend())
#define LB(x,a) lower_bound((x).begin(),(x).end(),(a))
#define UB(x,a) upper_bound((x).begin(),(x).end(),(a))
#define INF 1000000000
#define LLINF 9223372036854775807
#define mod 1000000007
#define eps 1e-12
//priority_queue<int,vector<int>, greater<int> > q2;

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

	int S, P; cin >> S >> P;
	int n = P;
	vector<int> ret;
	for (int i = 1; i*i <= n; ++i)
	{
		if (n%i == 0)
		{
			ret.push_back(i);
			if (i*i != n)
			{
				ret.push_back(n / i);
			}
		}
	}
	int ans = 0;
	SORT(ret);
	int s = 0, t = ret.size() - 1;
	while (t >= 0) {
		if (ret[s] + ret[t] == S)ans++;
		s++;
		t--;
	}

	if (ans) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}

	return 0;
}

#include <bits/stdc++.h>
//#pragma GCC optimize("Ofast,unroll-loops")
//#pragma GCC target("avx,avx2,sse,sse2")

using namespace std;

void solve(){
    int64_t s, p;
    cin >> s >> p;
    vector<int64_t> div;

    for (int64_t i = 1; i*i <= p; i++)
    {
        if(i*i == p) div.push_back(i);
        else if(p % i == 0) {
            div.push_back(i);div.push_back(p/i);
        }
    }

    sort(div.begin(), div.end());
    int d = div.size();
    string ans = "No\n";

    for (int i = 0; i < d; i++)
    {
        if(div[i] + p / div[i] == s){
            ans = "Yes\n";
        }
    }

    cout << ans;
}

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

	int32_t tt = 1;
	//cin >> tt;

	while(tt-->0) solve();

	return 0;
}


#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define BE(x) x.begin(), x.end()

int main() {
    int h, w;
    cin >> h >> w;
    vector<string> s(h);
    for (auto &x : s) cin >> x;

    vector<bitset<2>> cnt;
    for (int j = 0; j < w; j++) {
        bitset<2> bs;
        int jj = j;
        for (int i = 0; jj >= 0 && i < h; i++, jj--) {
            if (s[i][jj] == 'R') bs[0] = true;
            else if (s[i][jj] == 'B') bs[1] = true;
        }
        cnt.push_back(bs);
    }
    for (int i = 1; i < h; i++) {
        bitset<2> bs;
        int ii = i;
        for (int j = w-1; ii < h && j >= 0; ii++, j--) {
            if (s[ii][j] == 'R') bs[0] = true;
            else if (s[ii][j] == 'B') bs[1] = true;
        }
        cnt.push_back(bs);
    }

    ll ans = 1;
    for (auto &x : cnt) {
        if (x[0] && x[1]) {
            cout << 0 << endl;
            return 0;
        }
        else if (!(x[0] || x[1])) {
            ans = ans * 2LL % 998244353LL;
        }
    }
    cout << ans << endl;
}

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

const int64_t inf = 998244353;

int main() {
    int H, W, HW, k=1;
    int64_t ans = 1;
    cin >> H >> W;
    HW = H + W - 1;
    string S, AllS;
    vector<int> vec(HW);
    bool f = true;
    cin >> S;
    AllS = S;
    for(int i = 1; i < H; i++){
        cin >> S;
        if(!f) continue;
        for(int j = 0; j < W-1; j++){
            if(S.at(j) == '.') continue;
            if(AllS.at(j+k) == '.'){
                AllS.at(j+k) = S.at(j);
                continue;
            }
            if(S.at(j) != AllS.at(j+k)){
                ans = 0;
                f = false;
                break;
            }
        }
        AllS += S.at(W-1);
        k++;
    }
    if(!f) cout << '0' << endl;
    else{
        for(auto c: AllS){
            if(c == '.'){
                ans = (ans*2)%inf;
            }
        }
        cout << ans << endl;
    }
}


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

int main(){

    int n,k;
    cin >> n >> k;
    vector<pair<unsigned long long int,unsigned long long int>> f(n);
    for(int i=0; i<n; i++){
        cin >> f[i].first >> f[i].second;
    }
    sort(f.begin(),f.end());

    unsigned long long int money = k;
    unsigned long long int cur = 0;
    for(int i=0; i<n; i++){
        unsigned long long int tmp = f[i].first - cur;
        if(tmp<=money){
            money -= tmp;
            money += f[i].second;
            cur = f[i].first;
        }else{
            break;
        }
    }

    unsigned long long int ans = cur + money;
    cout << ans << endl;

}

#include<bits/stdc++.h>

using namespace std;

#define LL           long long
#define ULL          long long unsigned
#define LD           long double
#define ff              first
#define ss              second
#define FOR(i,n)     for(int i=0;i<n;i++)
#define FLR(i,n)     for(LL i=0;i<n;i++)
#define RFOR(i,n)    for(int i=n-1;i>=0;i--)
#define RFLR(i,n)    for(LL i=n-1;i>=0;i--)
#define rep(i,a,b)   for(int i=a;i<=b;i++)
#define repl(i,a,b)  for(LL i=a;i<=b;i++)
#define fast         ios_base::sync_with_stdio(0);cin.tie(0);
#define all(a)       a.begin(),a.end()
#define ABS(x)       ((x)<0?-(x):(x))
#define NL           "\n"
#define pb           push_back
#define mk              make_pair
#define pi           acos(-1.0)
#define prec(n)      fixed << setprecision(n)
#define sq(a)          (a)*(a)

int main()
{
    fast;
    LL i,j,k,a,b,n,ans=0,prev=0,sum=0;
    map<LL,LL>mp;
    cin>>n>>k;
    //ans=k;
    FOR(i,n){
        cin>>a>>b;
        mp[a]+=b;
    }
    sum+=k;
    for(auto it:mp){
        if(it.ff<=sum){
            k-=(it.ff-prev);
            k+=it.ss;
            prev=it.ff;
            sum+=it.ss;
        }
        else {
            ans=prev+k;
            //cout<<sum<<endl;
            //cout<<ans;
            //return 0;
            break;
        }
    }
    ans=prev+k;
    cout<<sum;

}


#include <bits/stdc++.h>

using namespace std;

int main()
{
    int n,x;
    long long sum=0;
    cin>>n>>x;
    for(int i=1;i<=n;i++)
    {
        int v,p;
        cin>>v>>p;
        sum+=(v*p);
        if(sum>x*100)
        {
            cout<<i;
            break;
        }
    }
    if(sum<=x*100)
        cout<<-1;
    return 0;
}

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

#define  int               long long int
#define  ld                long double
#define  f(i,j,n)            for(int i = j; i <= n; i++)
#define  r(i,n,j)           for(int i = n; i >= j; i--)
#define  all(container)       container.begin() , container.end()
#define  sz(container)        (int)container.size()
#define  T             int ttt; cin >> ttt; while(ttt--)
#define fast    ios_base::sync_with_stdio(false),cin.tie(NULL),cout.tie(NULL);

int32_t main()
{
    fast
    int n,k,ans=0;  cin>>n>>k;
    int ff=1e15;
    f(i,1,n){
        int x,y;    cin>>x>>y;
        ans+= x*y;
        if(ans>k*100){
            cout<<i;
            exit(0);
        }
    }
    cout<<"-1";
}


#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
typedef long long li;
#define rep(i,n) for(int i=0;i<(n);i++)
#define df 0
template<class T> void print(const T& t){ cout << t << "\n"; }
template<class T, class... Ts> void print(const T& t, const Ts&... ts) { cout << t; if (sizeof...(ts)) cout << " "; print(ts...); }

int main(){
  string s; cin >>s;
  reverse(s.begin(),s.end());
  vector<int> cnt(26,0);
  int n=s.size();
  int pre=-1,past=-1;
  li ans=0;
  rep(i,n){
    int a=s[i]-'a';
    if(pre==a){
      ans+=i-cnt[a];
      for(int& x:cnt)x=0;
      cnt[a]=i+1;
    }else cnt[a]++;
    pre=a;
  }
  print(ans);
}

    #pragma GCC optimize ("-O3")
    #include <bits/stdc++.h>

    using namespace std;

    typedef long long ll;
    typedef long double ld;
    typedef pair<int,int> p32;
    typedef pair<ll,ll> p64;
    typedef pair<double,double> pdd;
    typedef vector<ll> v64;
    typedef vector<int> v32;
    typedef vector<vector<int> > vv32;
    typedef vector<vector<ll> > vv64;
    typedef vector<vector<p64> > vvp64;
    typedef vector<p64> vp64;
    typedef vector<p32> vp32;
    ll MOD = 998244353;
    #define forn(i,e) for(ll i = 0; i < e; i++)
    #define forsn(i,s,e) for(int i = s; i < e; i++)
    #define rforn(i,s) for(ll i = s; i >= 0; i--)
    #define rforsn(i,s,e) for(ll i = s; i >= e; i--)
    #define ln "\n"
    #define dbg(x) cout<<#x<<" = "<<x<<ln
    #define mp make_pair
    #define pb push_back
    #define fi first
    #define se second
    #define INF 1e18
    #define fast_cin() ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)
    #define all(x) (x).begin(), (x).end()
    #define sz(x) ((ll)(x).size())

    ll mpow(ll a, ll b){
        if(b >= (MOD-1)) b %= (MOD-1);
        if(b==0) return 1;
        ll t1 = mpow(a,b/2);
        t1 *= t1;
        t1 %= MOD;
        if(b%2) t1 *= a;
        t1 %= MOD;
        return t1;
    }

    ll mpow(ll a, ll b, ll p){
        if(b==0) return 1;
        ll t1 = mpow(a,b/2,p);   t1 *= t1;
        t1 %= p;
        if(b%2) t1 *= a;
        t1 %= p;
        return t1;
    }
    ll modinverse(ll a, ll m){
        ll m0 = m;
        ll y = 0, x = 1;
        if (m == 1) return 0;
        while (a > 1){
            ll q = a / m;
            ll t = m;
            m = a % m, a = t;
            t = y;
            y = x - q * y;
            x = t;
        }
        if (x < 0) x += m0;
        return x;
    }
    ll range(ll l, ll r){
        return l + rand()%(r-l+1);
    }

    int main()
    {
        ll t=1;
        //cin>>t;
        while(t--)
        {
          	string s;
          	cin>>s;
          	ll ans=0,pp=-1;
          	char pc = '*';
          	vector<ll>ps(26,0);
          	ll n = s.length();
          	ps[s[n-1]-'a']++;
          	ps[s[n-2]-'a']++;
          	for(ll i=s.length()-3;i>=0;i--)
          	{
          		ps[s[i]-'a']++;
          		if(s[i]==s[i+1])
          		{
      				ans += s.length()-i-ps[s[i]-'a'];
      				for(ll j=0;j<26;j++)ps[j]=0;
      				ps[s[i]-'a'] = n-i;
          		}

          		//cout<<ans<<" ";
          	}
          	//cout<<endl;
          	cout<<ans<<endl;
        }
    }


#include<bits/stdc++.h>

using namespace std;
typedef long long int lld;
#define rep(i,a,b) for(int i=a;i<b;i++)
#define trav(a,v) for(auto a:v)
#define MOD 998244353
lld DP[10000][10000];

lld calc(int a, int b){
  //cout<<a<<" "<<b<<endl;
  if(a<0 || b<0 || a<b)return 0;
  //out<<a<<" "<<b<<endl;
  if(DP[a][b]!=-1)return DP[a][b];
  //cout<<a<<" "<<b<<endl;
  DP[a][b]=0;
  DP[a][b]+=calc(a-1,b-1);
  DP[a][b]+=calc(a,2*b);
  DP[a][b]%=MOD;
  return DP[a][b];
}
/*lld manual(int a, int b){
  int cnt=0;
  rep(i,0,a+1){
    rep(j,0,a+1){
      rep(k,0,a+1){
	rep(l,0,a+1){
	  rep(m,0,a+1){
	    rep(n,0,a+1){
	    if(i+j+k+l+m+n==a && (i+2*j+4*k+8*l+16*m+32*n)==b*32)cnt++;
	    }
	  }
	}
      }
    }
  }
  return cnt;
}*/
int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n,k;
  cin>>n>>k;
  rep(i,0,n+1){
    rep(j,0,n+1){
      DP[i][j]=-1;
      if(i==0)DP[i][j]=0;
      if(j==0)DP[i][j]=0;
    }
  }
  DP[0][0]=1;
  cout<<calc(n,k)<<endl;
  /*rep(i,0,n+1){
    rep(j,0,k+1){
      if(manual(i,j)!=calc(i,j))cout<<i<<" "<<j<<" "<<calc(i,j)<<" "<<manual(i,j)<<endl;
    }
  }*/

  return 0;
}

#include<bits/stdc++.h>
#define ll long long
#define dbg(x) cout<<#x<<": "<<x<<endl;
#define N 200005
#define M 1000000007
#define pii pair<ll,ll>
#define fast ios_base::sync_with_stdio(0);cin.tie(0);
using namespace std;

ll bigmod(ll a,ll n)
{
    if(n==0)
        return 1;
    ll ans=bigmod(a,n/2);
    ans=(ans*ans)%M;
    if(n%2)
        ans=(ans*a)%M;
    return ans;
}
ll f[20];
ll inv[20];

string s;
ll k;
vector<char>all;

ll C(ll n,ll r)
{
    if(n<r)
        return 0;
    return f[n]*inv[r]%M*inv[n-r]%M;
}

ll dp[N][17][17];

ll run(int idx,int k1,int k2)
{
    if(idx==0)
    {
        return k1==0;
    }
    if(dp[idx][k1][k2]!=-1)
        return dp[idx][k1][k2];
    ll ans=0;
    if(k1>0)
    {
        ans+=1LL*k1*run(idx-1,k1-1,k2+1);
        ans%=M;
    }
    if(k2>0)
    {
        ans+=1LL*k2*run(idx-1,k1,k2);
        ans%=M;
    }
    return dp[idx][k1][k2]=ans;
}

int check(string s)
{
    int c=0,f=0;
    set<int>w;
    for(char p:s)
    {
        if(f)
        {
            w.insert(p);
        }
        else if(p!='0')
        {
            w.insert(p);
            f=1;
        }
    }
    return w.size();
}

main()
{
    memset(dp,-1,sizeof dp);
    f[0]=inv[0]=1;
    for(ll i=1; i<20; i++)
    {
        f[i]=f[i-1]*i%M;
        inv[i]=bigmod(f[i],M-2);
    }
    for(char x='0'; x<='9'; x++)
        all.push_back(x);
    for(char x='A'; x<='F'; x++)
        all.push_back(x);

    cin>>s>>k;
    set<char>upto;
    ll ans=0;

    for(ll i=0; i<s.size(); i++)
    {
        ll till=upto.size();
        for(char u:all)
        {
            if(u<s[i])
            {
                if(i==0&&u=='0')
                    continue;
                set<char>temp=upto;
                temp.insert(u);
                ll already=temp.size();
                ll baki=k-already;
                if(baki>=0)
                {
                    ll temp=1;
                    temp*=C(16-already,baki)*run(s.size()-i-1,baki,already);
                    ans+=temp;
                    //cout<<i<<' '<<u<<' '<<temp<<endl;
                    ans%=M;
                }
            }
        }
        upto.insert(s[i]);
    }
    for(ll i=1; i<s.size(); i++)
    {
        for(char u:all)
        {
            if(u=='0')
                continue;
            ll already=1;
            ll baki=k-already;
            if(baki>=0)
            {
                ll temp=1;

                temp*=C(16-already,baki)*run(s.size()-1-i,baki,already);
                ans+=temp;
                //cout<<i<<' '<<u<<' '<<temp<<endl;
                ans%=M;
            }
        }
    }
    if(upto.size()==k) ans++;
    ans%=M;
    cout<<ans;
}


#include <bits/stdc++.h>

long long extGCD(long long a, long long b, long long c, long long &x, long long &y){
    long long a_gcd = a;
    long long b_gcd = b;
    std::vector< long long > A, B;
    A.push_back(a_gcd);
    B.push_back(b_gcd);

    while(b_gcd != 0){
        long long tmp = a_gcd % b_gcd;
        a_gcd = b_gcd;
        b_gcd = tmp;
        A.push_back(a_gcd);
        B.push_back(b_gcd);
    }

    if(c % a_gcd != 0){
        x = -1e18;
        y = -1e18;
        return -1;
    }

    std::vector< long long > X(A.size()), Y(A.size());
    X[A.size() - 1] = c / a_gcd;
    Y[A.size() - 1] = 0;
    for(int i=A.size()-2; i>=0; i--){
        X[i] = Y[i+1];
        Y[i] = X[i+1] - (A[i] / B[i]) * X[i];
    }

    x = X[0];
    y = Y[0];

    b /= a_gcd;

    if(x >= 0){
        return x % b;
    }else{
        long long ret;
        ret = b - std::abs(x) % b;
        if(ret == b){
            ret = 0;
        }
        return ret;
    }

}

int main(){
    int T;
    std::cin >> T;
    std::vector< long long > ans(T);

    for(int t=0; t<T; t++){
        long long X, Y, P, Q;
        std::cin >> X >> Y >> P >> Q;

        long long min = 9223372036854775807;
        for(int p=P; p<P+Q; p++){
            for(int x=X; x<X+Y; x++){
                long long ret1, ret2;
                long long tmp = extGCD(P+Q, 2*(X+Y), x-p, ret1, ret2);
                if(tmp != -1){
                    min = std::min(min, p + (P+Q) * tmp);
                }
            }
        }

        ans[t] = min;

    }

    for(int i=0; i<T; i++){
        if(ans[i] == 9223372036854775807){
            std::cout << "infinity" << std::endl;
        }else{
            std::cout << ans[i] << std::endl;
        }
    }

    return 0;

}

#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <string>
#include <cmath>
#include <cstdio>
#include <iomanip>
#include <fstream>
#include <cassert>
#include <cstring>
#include <numeric>
#include <ctime>
#include <complex>
#include <bitset>
#include <random>
#include <climits>
#include <stack>

using namespace std;

typedef long long ll;
typedef long double ld;

#define int ll
#define double ld
#define loop(i, n) for(int i = 0; i < (int)n; ++i)
#define loop1(i, n) for(int i = 1; i <= (int)n; ++i)
#define F first
#define S second
#define pb push_back
#define pi pair <int, int>
#define all(x) begin(x), end(x)
#define ti tuple <int, int, int>
#define Point Vect
#define no {cout << "NO"; return;}
#define yes {cout << "Yes"; return;}
#define mkp make_pair
#define mkt make_tuple
#define cerr if(0) cerr

const int INF = 3e18;

int phi(int n) {
    int result = n;
    for (int i = 2; i * i <= n; ++i)
        if (n % i == 0) {
            while (n % i == 0)
                n /= i;
            result -= result / i;
        }
    if (n > 1)
        result -= result / n;
    return result;
}

int gcd(int a, int b) {
    while (b) {
        a %= b;
        swap(a, b);
    }
    return a;
}

int binpow(int x, int d, int mod) {
    int ans = 1;
    while (d) {
        if (d & 1)
            ans = ans * x % mod;
        x = x * x % mod;
        d >>= 1;
    }
    return ans;
}

int rev_mod(int a, int b, int m) {
    int d = gcd(a, m);
    if (b % d)
        return -1;
    a /= d, b /= d, m /= d;
    return binpow(a, phi(m) - 1, m) * b % m;
}

void solve() {
    int x, y, p, q;
    cin >> x >> y >> p >> q;
    int ans = INF, m = 2 * (x + y);
    for (int r1 = x; r1 < x + y; ++r1) {
        int cur = rev_mod(p + q, (r1 - p % m + m) % m, m);
        if (cur >= 0)
            ans = min(ans, cur * (p + q) + p);
    }
    for (int r2 = p; r2 < p + q; ++r2) {
        int cur = rev_mod(p + q, (x - r2 % m + m) % m, m);
        if (cur >= 0)
            ans = min(ans, cur * (p + q) + r2);
    }
    if (ans == INF)
        cout << "infinity\n";
    else
        cout << ans << "\n";
}

signed main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int t; cin >> t; loop(i, t)
    solve();
    return 0;
}


#include<bits/stdc++.h>
#define int long long
#define rint regester int
const int maxn = 1e6 + 10;
const int mod = 1e9 + 7;
using std::ios;
using std::cin;
using std::cout;
using std::max;
using std::min;
using std::sort;
using std::unique;
using std::lower_bound;
using std::swap;
using std::abs;
using std::acos;
using std::queue;
using std::map;
using std::string;
int read(){int x = 0,f = 1; char ch = getchar(); while(ch < '0' || ch > '9'){if(ch == '-')f = -1; ch = getchar();}while(ch >= '0' && ch <= '9'){x = (x << 1) + (x << 3) + (ch ^ 48); ch = getchar();} return x * f;}
int n, a[maxn], sum, p1;
double minn = 99824435353535.0;
signed main(){
	n = read();
	for(int i = 1; i <= n; i++)a[i] = read(), sum += a[i];
	sort(a + 1, a + 1 + n);
	for(int i = 1; i <= n; i++){
		double x = 0;
		p1 += a[i];
		if(2 * i - n > 0){
			x = a[i] / 2.0;
		}else
		x = a[i + 1] / 2.0;
		minn = min(minn, (double)(2 * i - n) * x - p1 + sum);
	}
	printf("%.19lf", (double)minn / n);
}

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#define int long long
#define IOS std::ios::sync_with_stdio(false); cin.tie(NULL);cout.tie(NULL);
#define pb push_back
#define mod 1000000007
//#define lld long double
#define mii map<int, int>
#define mci map<char, int>
#define msi map<string, int>
#define pii pair<int, int>
#define ff first
#define ss second
#define bs(yup,x) binary_search(yup.begin(),yup.end(),x) //it will return bollean value
#define lb(yup,x) lower_bound(yup.begin(),yup.end(),x)  //it will return the adress of the number which is equal to or just greater than x ,and if it is equal to yup.end() than their in no such number exist
#define ub(yup,x) upper_bound(yup.begin(),yup.end(),x)
#define all(x) (x).begin(), (x).end()
#define rep(i,x,y) for(int i=x; i<y; i++)
#define fill(a,b) memset(a, b, sizeof(a))
#define vi vector<int>
#define setbits(x) __builtin_popcountll(x)
using namespace std;
const long long N=262144, INF=2000000000000000000;
const long double EPS= 0.000000000001;
using namespace __gnu_pbds;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> order_set;

//order_of_key(x) --> will return number of numbers that are strictly less than x in set
//find_by_order(x) --> will return (x+1)th element in the set
//both are log(n) time

int power(int a, int b, int p)
    {
        if(a==0)
        return 0;
        int res=1;
        a%=p;
        while(b>0)
        {
            if(b&1)
            res=(res*a)%p;
            b>>=1;
            a=(a*a)%p;
        }
        return res;
    }
vi prime;
bool isprime[N];
void pre()
{
    for(int i=2;i<N;i++)
    {
        if(isprime[i])
        {
            for(int j=i*i;j<N;j+=i)
            isprime[j]=false;
            prime.pb(i);
        }
    }
    return;
}
/*
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

int getRand(int l, int r)
{
    uniform_int_distribution<int> uid(l, r);
    return uid(rng);
}
 */

int32_t main()
{
    IOS;
    //fill(isprime, true);
    //pre();
    int wertt=1;
    //cin>>wertt;
    for(int pppp=1;pppp<=wertt;pppp++)
    {
        int n;
        cin>>n;
        long double a[n];
        for(int i=0;i<n;i++) cin>>a[i];
        sort(a,a+n);
        long double x=(a[n/2]/2.0);
        long double ans=0;
        for(int i=0;i<n;i++)
        {
            ans+=(x+a[i]-min(x+x,a[i]));
        }
        ans=ans/((long double)(n));
        cout<<fixed << setprecision(15)<<ans;
    }
}


#define IOS ios::sync_with_stdio(false);
#define rep(i, a, n) for(ll i=a;i<=n;i++)

#include <bits/stdc++.h>

using namespace std;
typedef long long ll;
#define endl "\n"
const int INF = 0x3f3f3f3f;
const int mod = 1e9 + 7;
const int N = 1e6 + 10;
ll n, m, t, k, ans, cnt, sum, flag;
ll arr[N], vis[N];
char s[20][20];

int main() {
    IOS;
    cin >> n >> m;
    rep(i, 0, n-1) cin>>s[i];
    rep(i,0,n-2){
        rep(j,0,m-2){
            cnt=0;
            if(s[i][j]=='.') cnt++;
            if(s[i+1][j]=='.') cnt++;
            if(s[i][j+1]=='.') cnt++;
            if(s[i+1][j+1]=='.') cnt++;
            if(cnt==1||cnt==3) ans++;
        }
    }
    cout<<ans<<endl;
    return 0;
}

#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#include <climits>
#include <cstring>
#include <cassert>

using namespace std;
//using namespace atcoder;

#define REP(i, n) for (int i=0; i<(n); ++i)
#define RREP(i, n) for (int i=(int)(n)-1; i>=0; --i)
#define FOR(i, a, n) for (int i=(a); i<(n); ++i)
#define RFOR(i, a, n) for (int i=(int)(n)-1; i>=(a); --i)

#define SZ(x) ((int)(x).size())
#define ALL(x) (x).begin(),(x).end()

#define DUMP(x) cerr<<#x<<" = "<<(x)<<endl
#define DEBUG(x) cerr<<#x<<" = "<<(x)<<" (L"<<__LINE__<<")"<<endl;

template<class T>
ostream &operator<<(ostream &os, const vector<T> &v) {
    os << "[";
    REP(i, SZ(v)) {
        if (i) os << ", ";
        os << v[i];
    }
    return os << "]";
}

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

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 (b < a) {
        a = b;
        return true;
    }
    return false;
}

using ll = long long;
using ull = unsigned long long;
using ld = long double;
using P = pair<int, int>;
using vi = vector<int>;
using vll = vector<ll>;
using vvi = vector<vi>;
using vvll = vector<vll>;

const ll MOD = 1e9 + 7;
const int INF = INT_MAX / 2;
const ll LINF = LLONG_MAX / 2;
const ld eps = 1e-9;

// edit

void solve() {
    int H, W;
    cin >> H >> W;
    vector<vector<char>> S(H + 2, vector<char>(W + 2, '.'));
    REP(i, H) {
        REP(j, W) {
            cin >> S[i + 1][j + 1];
        }
    }
    int ans = 0;
    for (int i = 0; i <= H; ++i) {
        for (int j = 0; j <= W; ++j) {
            int cnt = 0;
            for (int di = 0; di <= 1; ++di) {
                for (int dj = 0; dj <= 1; ++dj) {
                    if (S[i + di][j + dj] == '#') cnt++;
                }
            }
            if (cnt % 2) {
                ans++;
            }
//            cerr << i << " " << j << " " << cnt << endl;
        }
    }
    cout << ans << endl;

}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(10);
//    std::ifstream in("input.txt");
//    std::cin.rdbuf(in.rdbuf());

    solve();

    return 0;
}