#include <bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef pair<int,int> pii;
#define pii pair<int,int>
#define pll pair<long long,long long>

#define fi first
#define se second

#define pb push_back
#define sz(x) ((int) (x).size())
#define rep(i,n) for (int i=1;i <=int(n);i++)
#define rrep(i,n) for (int i=int(n);i >= 1 ;i--)
#define ffor(i,n) for (int i=0;i <int(n);i++)
#define rfor(i,n) for (int i=int(n-1);i >= 0;i--)
#define all(x) x.begin(),x.end()
#define make_unique(x) sort(all((x))); (x).resize(unique(all((x))) - (x).begin())

//mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
//use rng() for random
ll fac[4000002];
const ll MOD = 1e9 + 7;
ll power(ll  x,ll y )
{
    ll res = 1;     // Initialize result

    x = x % MOD; // Update x if it is more than or
                // equal to p

    if (x == 0) return 0; // In case x is divisible by p;

    while (y > 0)
    {
        // If y is odd, multiply x with result
        if (y & 1)
            res = (res*x) % MOD;

        // y must be even now
        y = y>>1; // y = y/2
        x = (x*x) % MOD;
    }
    return res;
}
ll invmul(ll a, ll b){
     return a*power(b,MOD-2) % MOD;
};

ll nck ( ll n , ll k ){
    // cout <<(invmul(fac[n],fac[k])%MOD+MOD)%MOD  <<' ' <<  fac[n-k] << '\n';
     if (k < 0 || n - k  < 0) return 0;
     ll res =fac[n];
     res = invmul(res,fac[k]) % MOD;
     res = invmul(res,fac[n-k]) % MOD;
     return res;
}
int main()
{
     ios_base::sync_with_stdio(false);
     cin.tie(NULL);
     fac[0] = 1;
     rep(i,4000000) fac[i] = (fac[i-1] * i ) % MOD;
     ll n,m,k ; cin >> n >> m >> k ;
    if ( n > m + k) {
         cout << 0 << '\n'; return 0;
       }
    ll res = nck(n+m,n);
     if ( n <  k + 1 ){
          cout << res  << '\n'; return 0;
     }

  //  cout << res << '\n';
     ll bold = nck(n+m,n-k-1);
 //   cout << n+m  << ' ' << n - k << '\n';

    cout << ((res - bold)%MOD + MOD)%MOD << '\n';

     return 0;
}

/*
5 7
3 4 6 8 11
1 2 3 4 5 6 7
 */

#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(ll i=0;i<ll(n);i++)
#define REP(i,k,n) for(ll i=k;i<ll(n);i++)
#define all(a) a.begin(),a.end()
#define eb emplace_back
#define lb(v,k) (lower_bound(all(v),k)-v.begin())
#define ub(v,k) (upper_bound(all(v),k)-v.begin())
#define fi first
#define se second
#define PQ(T) priority_queue<T>
#define SPQ(T) priority_queue<T,vector<T>,greater<T>>
#define UNIQUE(a) sort(all(a));a.erase(unique(all(a)),a.end())
#define decimal cout<<fixed<<setprecision(10)
#define summon_tourist cin.tie(0);ios::sync_with_stdio(false)
using ll=long long;
using P=pair<ll,ll>;
using vi=vector<ll>;
using vvi=vector<vi>;
using vvvi=vector<vvi>;
constexpr ll inf=1001001001001001;
constexpr int INF=1001001001;
constexpr int mod=998244353;
template<class T> bool chmin(T&a,T b){if(a>b){a=b;return true;}return false;}
template<class T> bool chmax(T&a,T b){if(a<b){a=b;return true;}return false;}
template<class T> bool isin(T x,T l,T r){return (l)<=(x)&&(x)<=(r);}
template<class T> void out(T a){cout<<a<<'\n';}
template<class T> void outp(T a){cout<<'('<<a.fi<<','<<a.se<<')'<<'\n';}
template<class T> void outvp(T v){rep(i,v.size())cout<<'('<<v[i].fi<<','<<v[i].se<<')';cout<<'\n';}
template<class T> void outv(T v){rep(i,v.size()){if(i)cout<<' ';cout<<v[i];}cout<<'\n';}
template<class T> void outvv(T v){rep(i,v.size())outv(v[i]);}
void YesNo(bool b){if(b)out("Yes");else out("No");}
void yesno(bool b){if(b)out("yes");else out("no");}
void YESNO(bool b){if(b)out("YES");else out("NO");}
ll modpow(ll a,ll b){ll c=1;while(b>0){if(b&1){c=a*c%mod;}a=a*a%mod;b>>=1;}return c;}
vi calc(ll x){vi v;while(x>0){v.eb(x%10);x/=10;}reverse(all(v));return v;}

int h,w;
bool used[16][16];

int dfs(int i,int j,int a,int b){
    if(a<0||b<0) return 0;
    if(j==w){
        i++; j=0;
    }
    if(i==h) return 1;
    if(used[i][j]) return dfs(i,j+1,a,b);
    used[i][j]=true;
    int sum=0;
    sum+=(dfs(i,j+1,a,b-1));
    if(j<w-1&&!used[i][j+1]) sum+=dfs(i,j+2,a-1,b);
    if(i<h-1){
        used[i+1][j]=true;
        sum+=dfs(i,j+1,a-1,b);
        used[i+1][j]=false;
    }
    used[i][j]=false;
    return sum;
}

int main(){
    int a,b;
    cin>>h>>w>>a>>b;
    out(dfs(0,0,a,b));
}


//#pragma GCC optimize("O3,unroll-loops")
//#pragma GCC target("avx,avx2,fma")
#include <algorithm>
#include <bits/stdc++.h>
#include <unordered_map>
#include <unordered_set>

using namespace std;

#define PI              acos(-1.0)
#define No              cout<<"No\n"
#define Yes             cout<<"Yes\n"
#define no              cout<<"no\n"
#define yes             cout<<"yes\n"
#define NO              cout<<"NO\n"
#define YES             cout<<"YES\n"
#define MOD             (int)1000000007
#define int             long long
#define ll              long long
#define pii             pair<int, int>
#define fi              first
#define se              second
#define sf(a)           scanf("%lld", &a)
#define pf(a)           printf("%lld ", a)
#define pfn(a)          printf("%lld\n", a)
#define case(a)         cout<<"Case "<<a<<": ";
#define FASTIO          ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);
#define pb              push_back
#define mem(arr)        memset(arr, 0, sizeof(arr))
#define mem1(arr)       memset(arr, -1, sizeof(arr))
#define all(a)          a.begin(),a.end()
#define f(i,a,b)        for (int i = a; i<=b; i++)
#define fr(i,a,b)       for (int i = a; i>=b; i--)
#define rr              return 0
#define prec(n)         fixed<<setprecision(n)
#define maxpq           priority_queue<int>
#define minpq           priority_queue<int, vector<int>, greater<int> >
#define inf             (int)(1e18)
#define vi              vector<int>
#define vii             vector<pii>
#define sz(s)           s.size()
#define lcm(a,b)        (a*(b/gcd(a,b)))

int gcd(int a, int b)   {return __gcd(a,b);}

inline void normal(ll &a) { a %= MOD; (a < 0) && (a += MOD); }
inline ll modMul(ll a, ll b) { a %= MOD, b %= MOD; normal(a), normal(b); return (a*b)%MOD; }
inline ll modAdd(ll a, ll b) { a %= MOD, b %= MOD; normal(a), normal(b); return (a+b)%MOD; }
inline ll modSub(ll a, ll b) { a %= MOD, b %= MOD; normal(a), normal(b); a -= b; normal(a); return a; }
inline ll modPow(ll b, ll p) { ll r = 1; while(p) { if(p & 1LL) r = modMul(r, b); b = modMul(b, b); p >>= 1LL; } return r; }
inline ll modInverse(ll a) { return modPow(a, MOD-2); }
inline ll modDiv(ll a, ll b) { return modMul(a, modInverse(b)); }

inline bool checkBit(ll n, int i) { return n&(1LL<<i); }
inline ll setBit(ll n, int i) { return n or (1LL<<i);; }
inline ll resetBit(ll n, int i) { return n&(~(1LL<<i)); }

const double eps = 1e-9;

int dx[5] = {+1, +0, -1, -0};
int dy[5] = {+0, +1, -0, -1};
int XX[] = { -1, -1, -1, 0, 0, 1, 1, 1 };
int YY[] = { -1, 0, 1, -1, 1, -1, 0, 1 };

inline bool Equal(double x, double y) { return fabs(x-y)<eps; }
inline bool Greater(double x, double y){ return x-eps>y; }
inline bool Lesser(double x, double y){ return x+eps<y; }

#define error(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); cerr << '\n'; }
void err(istream_iterator<string> it) {}
template<typename T, typename... Args> void err(istream_iterator<string> it, T a, Args... args) { cerr << *it << " = " << a << " "; err(++it, args...); }

///Write what you need -->
/// nt, ft, kmp, tri, sufarr, ub_lb, lis
/// dsu, combi

///Template Ends Here////////////////////////////

signed main()
{
//    root = new trinode();
//    freopen("input.txt", "r", stdin);
//    freopen("output.txt", "w", stdout);

    FASTIO

//    int n;
//    cin>>n;
//
//    int a[n+1];
//    f(i, 1, n){
//        cin>>a[i];
//    }

    int x, y;
    cin>>x>>y;

    if(abs(x-y) < 3)
    Yes;
    else
    {
        No;
    }

//    tridel(root);
}

#define _USE_MATH_DEFINES

#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <ctime>
#include <complex>
#include <deque>
#include <functional>
#include <iostream>
#include <list>
#include <map>
#include <set>
#include <stack>
#include <string>
#include <tuple>
#include <vector>
#include <queue>

#define	INF   1010101010LL
#define INFLL 1010101010101010101LL

using namespace std;

const int mod = 1000000007;
//const int mod = 998244353;

int main()
{
	int n, m;
	cin >> n >> m;
	vector<int> a(n), b(m);
	for (int i = 0; i < n; i++) {
		cin >> a[i];
	}
	for (int i = 0; i < m; i++) {
		cin >> b[i];
	}

	vector<int> ans;
	for (int i = 0; i < n; i++) {
		bool ok = true;
		for (int j = 0; j < m; j++) {
			if (a[i] == b[j]) {
				ok = false;
				break;
			}
		}
		if (ok) {
			ans.emplace_back(a[i]);
		}
	}
	for (int i = 0; i < m; i++) {
		bool ok = true;
		for (int j = 0; j < n; j++) {
			if (b[i] == a[j]) {
				ok = false;
				break;
			}
		}
		if (ok) {
			ans.emplace_back(b[i]);
		}
	}
	sort(ans.begin(), ans.end());
	for (int i = 0; i < ans.size(); i++) {
		cout << ans[i] << (i + 1 == ans.size() ? "\n" : " ");
	}

	return 0;
}


#pragma GCC optimize("Ofast", "unroll-loops")

#include <bits/stdc++.h>

using namespace std;

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

ll N;

void input(void){ cin >> N; }

ll fix_b(int b){
    ll pow2b = (1LL << b);
    ll a_max = N / pow2b;
    ll c = N - pow2b * a_max;
    return (a_max + c + b);
}

int main(void){
    input();
    ll ans = (1LL << 60);
    for (int b = 0; b <= 60; ++b)
        ans = min(ans, fix_b(b));
    cout << ans << endl;
    return 0;
}

#include <bits/stdc++.h>
#define ll long long
#define pb push_back
#define task "talltree"
#define pll pair<ll, ll>
#define pii pair<pll, pll>
#define fi first
#define se second
#define ull unsigned long long

using namespace std;
const ll mod = 998244353;
const ll N = 1e5+5;

ll n, m, t, ans, k, a[N][22], b[N], c[N], tong,  cnt, q, d[N], dp[N];
struct point
{
    ll x, id;
    char s;
    bool operator < (const point& q)
    {
        return x < q.x;
    }
}p[N];
vector<pll> adj[N];

string s[N];
ll pw(ll k, ll n)
{
    ll total = 1;
    for(; n; n >>= 1)
    {
        if(n & 1)total = total * k % mod;
        k = k * k % mod;
    }
    return total;
}
ll A(ll u, ll v)
{
    if(u > v)return 0;
    return b[v] * c[v-u] % mod;
}
void sol()
{
    cin >> n;
    ans = n;
    while(n >= (1ll<<(t)))
    {
        ans = min(ans, n / (1ll<<t) + t + n % (1ll<<t));
        ++t;
    }
    cout << ans;

}
int main()
{
    if(fopen(task".inp", "r")){
       freopen(task".inp", "r", stdin);
       freopen(task".out", "w", stdout);
    }
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int ntest = 1;
    //cin >> ntest;
    while(ntest -- > 0)
    sol();
}
/*
3 5
1 2 3 3 1
4 3 2 5 3
2 6 6 2 5
1 2 2 2
2 1 3 3
3 2 3 3
3 5 1 3
*/


#include<iostream>

using namespace std;

int main()
{
    int n,a,b,miA,miB,ans,tmp;
    cin>>n;
    cin>>a>>b;
    miA=a;miB=b;ans=a+b;
    for(int i=1;i<n;i++)
    {
        cin>>a>>b;
        ans=min(ans,a+b);
        tmp=min((max(miA,b)),(max(miB,a)));
        ans=min(ans,tmp);
        miA=min(miA,a);
        miB=min(miB,b);
    }
    cout<<ans<<endl;
    return 0;
}

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

#define   fi(a,b) for(int i=a;i<b;i++)
#define   fj(a,b) for(int j=a;j<b;j++)
#define   ff first
#define   ss second
#define   ll long long
#define   ld long double
#define   ull unsigned long long
#define   bp(x) __builtin_popcount(x)
#define   pr(x) for(auto it: x) cout<<it<<" "; cout<<endl;
#define   getMax(x) max_element(x.begin(),x.end())
#define   getMin(x) min_element(x.begin(),x.end())
#define   endl "\n"
typedef   vector<int> vi;
typedef   vector< pair<int,int> > vii;
typedef   vector<long long> vl;
typedef   pair<int,int> pii;
typedef   pair<ll,ll> pll;
typedef   vector< pair<ll,ll> > vll;
//int dx[]={1,0,-1,0};
//int dy[]={0,1,0,-1};
//int dx[]={-1,0,1,1,1,0,-1,-1};
//int dy[]={-1,-1,-1,0,1,1,1,0};

void nikal_pehli_fursat_mai(){
    ll n;
    cin>>n;
    vl a(n), b(n);
    ll ans = 1e18;
    fi(0, n){
        cin>>a[i]>>b[i];
    }
    fi(0, n){
        fj(0, n){
            if(i==j) {
                ans = min(ans, a[i]+b[j]);
            }
            else {
                // cout<<a[i]<<" "<<i<<" "<<b[j]<<" "<<j<<endl;
                ans = min(ans, max(a[i], b[j]));
            }
        }
    }
    cout<<ans<<endl;
}

int main(){
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif
    ios::sync_with_stdio(0);
    cin.tie(0);
    int tc=1;
    // cin>>tc;
    while(tc--){
    nikal_pehli_fursat_mai();
    }
}


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

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

    long long K;
    cin >> K;

    vector<long long> d(K + 5, 0);
    for(long long a = 1; a <= K; ++a){
        for(long long b = 1; a * b <= K; ++b){
            long long c = K / (a * b);
            d[a * b] += c;
        }
    }

    long long answer = accumulate(d.begin(), d.begin() + K + 1, 0LL);

    cout << answer;

    return 0;
}

// Parasparopagraho Jīvānām

#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")

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

using namespace  __gnu_pbds ;
using namespace __gnu_cxx ;
using namespace std ;

typedef long long ll ;
typedef long double ldb ;

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

typedef vector<int> vi ;
typedef vector<ll> vll ;
typedef vector<pii> vpi ;
typedef vector<pll> vpl ;
typedef vector<int,pil> edges ;
typedef vector<vi> matrix ;
typedef priority_queue<int> pqu ;

template <class T> using Tree = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update> ;

#define rep(i,a,b) for (int i = (a); i <= (b); i++)
#define per(i,b,a) for (int i = (b); i >= (a); i--)

#define mp make_pair
#define eb emplace_back
#define pb push_back
#define pob pop_back
#define fi first
#define se second
#define ins insert
#define bk back
#define con continue
#define lbd lower_bound
#define ubd upper_bound

#define sz(x) (int)x.size()
#define all(x) begin(x), end(x)

#define pr cout << // I don't like this but my laptop's 'O' key is not functioning well

/* Careful when using long long
__builtin_clz(int x) {} //: the number of zeros at the beginning of the number
__builtin_ctz(int x) {} //: the number of zeros at the end of the number
__builtin_popcount(int x) {} //: the number of ones in the number
__builtin_parity(int x) {} //: the parity (even or odd) of the number of ones */

const int mod1 = 1000000007 ;
const int mod2 = 998244353 ;
const ll  infl = 4e18 ;
const int infi = 2e9 ;
const int maxn = 5e5 + 5 ;
const int block = 500 ;
const int logn = 31 ;
const int alpha = 27 ;
const ldb pi = acos(-1) ;

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count()) ;
int rng_lr(int a, int b)
{
    int ret ;
    ret = uniform_int_distribution<int>(a, b)(rng) ;
    return ret ;
    // For shuffling use shuffle(all, rng) ;
}

ll modpow(ll a, ll b, int MOD) { ll res = 1 ; while(b) { if(b&1) { res = res*a ; res %= MOD ; } a *= a ; a %= MOD ; b >>= 1 ; } return res%MOD ; }
void upmin(int &a, int b) { if(a < b) { a = b ; } }
void relax(int &a, int b) { if(a > b) { a = b ; } }
ll add(ll a, ll b, int MOD) { a += b ; if(a >= MOD) { a -= MOD ; } return  a ; }
ll sub(ll a, ll b, int MOD) { a -= b ; if(a < 0) { a += MOD ; } return a ; }
ll mul(ll a, ll b, int MOD) { b %= MOD ; a *= b ; a %= MOD ; return a ; }
ll inverse(ll a, ll MOD) { a = modpow(a, MOD - 2, MOD) ; return a ; }
ll lcm(ll a, ll b) { ll ret ; ll g = __gcd(a, b) ; ret = a/g ; ret = ret*b ; return ret ; }
int icast(char ch) { return int(ch-'a') ; }
void hyn(int a, int b) { if(a == b) cout << "YES\n" ; else cout << "NO\n" ; }
void pyd(int a, int b) { if(a == b) cout << "First\n" ; else cout << "Second\n" ; }

// Check constraints + overflows + types in typedef
int main()
{
    ios::sync_with_stdio(false) ;
    cin.tie(NULL) ;
    int k ;
    cin >> k ;
    ll res = 0 ;
    rep(a,1,k) {
    	int rb = k/a ;
    	rep(b,1,rb) {
    		int p = a*b ;
    		int rc = k/p ;
    		if(rc) {
    			res += (rc) ;
    		}
    	}
    }
    pr res << "\n" ;

    return 0 ;

}


# include <bits/stdc++.h>
# define rep(i, n) for(int i=0, i##_len=(n); i<i##_len; ++i)
# define reps(i, n) for(int i=1, i##_len=(n); i<=i##_len; ++i)
# define rrep(i, n) for(int i=((int)(n)-1); i>=0; --i)
# define rreps(i, n) for(int i=((int)(n)); i>0; --i)
# define ALL(x) (x).begin(), (x).end()
# define SZ(x) ((int)(x).size())
# define pb push_back
# define optimize_cin() cin.tie(0); ios::sync_with_stdio(false)
using namespace std;
typedef long long lint;
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; }

void solve() {
    string N;
    cin >> N;

    int ans = 1000;
    for(int i=1;i<(1<<N.size());i++ ){
        int tmp=0;
        int cnt = 0;
        for(int j=0;j<N.size();j++){
            if(i&(1<<j)) tmp += N[j]-'0';
            else cnt++;
        }

        if(tmp%3 == 0){
            ans = min(ans, cnt);
        }
    }
    if(ans==1000) cout << -1 << endl;
    else cout << ans << endl;
}
signed main() {

    solve();

    return 0;
}

#include <cstdio>
#include <iostream>
#include <algorithm>
#include <cstring>
#include <queue>
#include <vector>
#include <stack>
#include <string>
#include <bitset>
#include <set>
#include <cmath>
#define LL long long
#define ull unsigned long long
using namespace std;
const int MAXN = 25;
int n;
int ans = 25;
LL ret = 0;

LL vis[(int)3e5 + 5];

char s[MAXN];

void dfs (int dep) {
	//++ret;
	LL x = 0;
	//if (dep > n) return ;
	int q = 0;
	for (int i=0; i<n; ++i)
		if (s[i] != 'a') q |= (1 << i);
	if (vis[q]) return ;
	vis[q] = 1;
	for (register int i = 0; i < n; ++i)
		if (s[i] != 'a') x *= 10ll, x += s[i] - '0';
	//cout << x << endl;

	if (x - 3ll * (x / 3ll) == 0) {
		//cout << x << endl;
		ans = min (ans, dep);
		return ;
	}
	for (register int i = n-1; ~i; --i)
		if (s[i] ^ 'a') {
			char c = s[i];
			s[i] = 'a', dfs (dep + 1);
			s[i] = c;
		}
}

int main() {
#ifdef IN
	freopen ("x.in", "r", stdin);
	freopen ("x.out", "w", stdout);
#endif
	int i,j,k;
	int x;
	scanf ("%s", s), n = strlen (s);
	//cout << n << endl;
	dfs (0);
	if (ans < n) printf ("%d", ans);
	else printf ("-1");
	//cout << "\n" << ret;
	return 0;
}


#pragma region

#include <bits/stdc++.h>

#define _GLIBCXX_DEBUG

using namespace std;

using ll = long long;
using ld = long double;
const int INF = INT_MAX;
const ll LLINF = LLONG_MAX;

#define all(x) x.begin(), x.end()

#define rep(i, s, e) for(ll i = s; i < e; ++i)
#define repr(i, s, e) for(ll i = s; i > e; --i)

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

void CIN() {}
template<class T, class ...Ts> void CIN(T &&t, Ts &&...ts){ cin >> t; CIN(ts...); }
void COUT() { cout << endl; }
template<class T, class ...Ts> void COUT(T &&t, Ts &&...ts){ cout << t << " "; COUT(ts...); }

#pragma endregion

int main()
{
    cin.tie(nullptr);

    string n; cin >> n;
    int len_n = n.size(), max_step = n.size();
    rep(step, 0, max_step) {
        int same = 1;
        rep(idx, 0, len_n / 2) {
            if (n[idx] != n[len_n - idx - 1]) {
                same = 0;
                break;
            }
        }
        if (same) {
            cout << "Yes" << endl;
            return 0;
        } else {
            n = '0' + n;
            len_n ++;
            continue;
        }
    }
    cout << "No" << endl;
    return 0;
}

#include <iostream>
#include <algorithm>
#include <map>
#include <set>
#include <queue>
#include <bitset>
#include <climits>
#include <cmath>
#include <complex>
#include <functional>
#include <cassert>
#include <stack>
#include <numeric>
#include <iomanip>
#include <limits>
#include <random>
#include <unordered_set>

typedef int64_t ll;
typedef std::pair<int, int> Pii;
typedef std::pair<ll, ll> Pll;
typedef std::pair<double, double> Pdd;

#define rip(_i, _n, _s) for (int _i = (_s); _i < (int)(_n); _i++)
#define all(_l) _l.begin(), _l.end()
#define rall(_l) _l.rbegin(), _l.rend()
#define MM << " " <<

template<typename _T>
using MaxHeap = std::priority_queue<_T>;
template<typename _T>
using MinHeap = std::priority_queue<_T, std::vector<_T>, std::greater<_T>>;

template<typename _T>
inline bool chmax(_T &_l, const _T _b) {
    if (_l < _b) {
        _l = _b;
        return true;
    }
    return false;
}
template<typename _T>
inline bool chmin(_T &_l, const _T _b) {
    if (_l > _b) {
        _l = _b;
        return true;
    }
    return false;
}

template<typename _T>
void vdeb(const std::vector<_T> &bb) {
    for (unsigned int i = 0;i < bb.size();i++) {
        if (i == bb.size() - 1) std::cout << bb[i];
        else std::cout << bb[i] << ' ';
    }
    std::cout << '\n';
}
template<typename _T>
void vdeb(const std::vector<std::vector<_T>> &bb) {
    for (unsigned int i = 0;i < bb.size();i++) {
        // std::cout << i << ' ';
        vdeb(bb[i]);
    }
    std::cout << '\n';
}

using namespace std;

int conv(vector<int> &cnt) {
    int ret = 0;
    for(int i : cnt) {
        ret <<= 1;
        ret += (i ? 1: 0);
    }
    return ret;
}

int main() {
    int r, c; cin >> r >> c;
    vector<vector<int>> a(r, vector<int>(c-1));
    vector<vector<int>> b(r-1, vector<int>(c));
    rip(i,r,0) rip(j,c-1,0) cin >> a[i][j];
    rip(i,r-1,0) rip(j,c,0) cin >> b[i][j];
    vector<vector<Pii>> da(r*c*2, vector<Pii>(0));
    rip(i,r,0) rip(j,c,0) {
        int now = i*c+j;
        if(j+1 < c) da[now].push_back({now+1 ,a[i][j]});
        if(0 <= j-1) da[now].push_back({now-1 ,a[i][j-1]});
        if(i+1 < r) da[now].push_back({now+c, b[i][j]});
        da[now].push_back({now+r*c, 1});
        da[now+r*c].push_back({now, 0});
        if(0 <= i-1) da[now+r*c].push_back({now+r*c-c, 1});
    }
    MinHeap<Pii> pq;
    pq.push({0, 0});
    vector<int> used(r*c*2, -1);
    while(!pq.empty()) {
        Pii now = pq.top(); pq.pop();
        if(used[now.second] != -1) continue;
        used[now.second] = now.first;
        for(auto &&i : da[now.second]) {
            pq.push({now.first + i.second, i.first});
        }
    }
    cout << used[r*c-1] << endl;
}


#pragma GCC optimize("Ofast", "unroll-loops")
#pragma GCC target("avx2")

#include <bits/stdc++.h>

using namespace std;

#define ll long long

constexpr ll mod = 1000000007LL;

int N;
char caa, cab, cba, cbb;

void input(void){
    cin >> N;
    cin >> caa >> cab >> cba >> cbb;
}

ll modpow(ll a, ll b){
    if (b == 0) return 1LL;
    ll tmp = modpow(a, b / 2);
    tmp = tmp * tmp % mod;
    if (b % 2) tmp = tmp * a % mod;
    return tmp;
}

ll solve(void){
    if (N <= 3) return 1LL;

    if (
        (cab == 'A' && caa == 'A') ||
        (cab == 'B' && cbb == 'B')
    ) return 1LL;

    if (
        (cab == 'A' && cba == 'A') ||
        (cab == 'B' && cba == 'B')
    ){
        ll tmpa = 1, tmpb = 0;
        for (int i = 2; i <= N; ++i){
            ll new_a = (tmpa + tmpb) % mod;
            ll new_b = tmpa;
            tmpa = new_a, tmpb = new_b;
        }
        return tmpb;
    }

    return modpow(2, N - 3);
}

int main(void){
    input();
    cout << solve() << endl;
    return 0;
}

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

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

    ll a=0, b=0, c=0;
    ll nn = 1;
    ll INF = 1001001001;
    ll an=INF, bn=INF, cn=INF;

    while(1)
    {
        a = N/nn;
        c = N%nn;
        if(an+bn+cn > a+b+c)
        {
            an = a;
            bn = b;
            cn = c;
        }
        if(nn*2 > N) break;
        else
        {
            nn *= 2;
            ++b;
        }
    }

    // cout << an << " " << bn << " " << cn << endl;
    cout << an+bn+cn << endl;

    return 0;
}


#pragma region head
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vi = vector<int>;
using vll = vector<ll>;
using pi = pair<int, int>;
using pll = pair<ll, ll>;
template <class T>
using vv = vector<vector<T>>;
#define _roverload(_a1, _a2, _a3, name, ...) name
#define _rep(i, n) repi(i, 0, n)
#define repi(i, a, b) for (int i = int(a); i < int(b); ++i)
#define rep(...) _roverload(__VA_ARGS__, repi, _rep, )(__VA_ARGS__)
#define _rrep(i, n) rrepi(i, 0, n)
#define rrepi(i, a, b) for (int i = (int)(b)-1; i >= (int)(a); --i)
#define rrep(...) _roverload(__VA_ARGS__, rrepi, _rrep, )(__VA_ARGS__)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define bit(n) (1LL << (n))
template <class T>
inline bool chmax(T &a, const T &b) {
    if (a < b) {
        a = b;
        return 1;
    }
    return 0;
}
template <class T>
inline bool chmin(T &a, const T &b) {
    if (a > b) {
        a = b;
        return 1;
    }
    return 0;
}
void print() { cout << '\n'; }
template <class T>
void print(const vector<T> &v) {
    bool f = false;
    for (const auto &e : v) {
        if (f) cout << ' ';
        cout << e;
        f = true;
    }
    cout << '\n';
}
template <class... T>
void print(const T &...args) {
    bool f = false;
    for (const auto &e : {args...}) {
        if (f) cout << ' ';
        cout << e;
        f = true;
    }
    cout << '\n';
}
const int INF = 1002003004;
const ll LINF = 1002003004005006007ll;
struct preprocess {
    preprocess() {
        cin.tie(nullptr);
        ios::sync_with_stdio(false);
        cout << fixed << setprecision(20);
    }
} ____;
#pragma endregion head

#pragma region library
#pragma endregion library

int main() {
    ll b, c;
    cin >> b >> c;
    ll mn0, mx0;
    mn0 = b - c / 2;
    mx0 = b + (c - 2) / 2;
    ll mn1, mx1;
    mn1 = -b - (c - 1) / 2;
    mx1 = -b + (c - 1) / 2;
    ll mn = max(mn0, mn1), mx = min(mx0, mx1);
    ll ans = (mx0 - mn0 + 1) + (mx1 - mn1 + 1) - max(0ll, mx - mn + 1);
    print(ans);
}

#include <bits/stdc++.h>
#define REP(i, nn ) for(int i = 0 ; i < (int) nn; i++)
#define REPS(i, ss, nn ) for(int i = ss ; i < (int) nn; i++)
#define REV(i, ss, nn ) for(int i = ss ; i >= nn; i--)
#define deb(x) std::cout << #x << " " << x << endl;
#define debl(x) std::cout << #x << " " << x << " ";
#define all(x) x.begin(), x.end()
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
namespace std{
    template<class Fun>
    class y_combinator_result{
        Fun fun_;
        public:
            template<class T>
            explicit y_combinator_result(T &&fun) : fun_(std::forward<T>(fun)){}
            template<class ...Args>
            decltype(auto) operator()(Args&&...args){
                return fun_(std::ref(*this), std::forward<Args>(args)...);
            }
    };
    template<class Fun>
    decltype(auto) y_combinator(Fun && fun){
        return y_combinator_result<std::decay_t<Fun>>(std::forward<Fun>(fun));
    }
};
template<typename T>
bool umax(T& a, T b){
    bool ret = a < b;
    if(ret) a = b;
    return ret;
}
template<typename T>
bool umin(T& a, T b){
    bool ret = a > b;
    if(ret) a = b;
    return ret;
}
struct edge{
    int to; ll cost;
    int from;
    edge(){ edge(0,0);}
    edge(int to_, ll cost_) : to(to_), cost(cost_){}
    edge(int to_, int from_, ll cost_) : to(to_), cost(cost_), from(from_){}
};

template<typename... T>
void read(T& ... a){
    ((cin >> a),...);
}

template<typename... T>
void write(T... a){
    ((cout << a),...);
}

template<typename T>
vector<T> read_array(int sz){
    vector<T> ret(sz);
    for(auto & x : ret) cin >> x;
    return ret;
}

void solve(){
    ll b, c;
    read(b,c);
    ll count = 1;
    if( b == 0){
        if( c > 1){
            count++;
            c -= 2;
            count += c;
        }
    }else if( b < 0){
        count += c;
        if(c > 1){
            c -= 1;
            count += min( 2 * abs(b), c) - 1;
        }
    }else{
        // b > 0
        count += (c - 1);
        if(c >= 2){
            count += min( 2 * b, c ) - 1;
        }else{
            count++;
        }
    }
    write(count, "\n");
}

int main()
{
    //making data IO Fast
    std::ios_base::sync_with_stdio(false);
    std::cin.tie(NULL);
    /****************************/
    int T = 1;
    // cin >> T;
    while(T--)
        solve();
    return 0;
}


#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <string.h>
#include <iostream>
#include <sstream>
#include <algorithm>
#include <stack>
#include <vector>
#include <queue>
#include <map>
#include <set>
#define _USE_MATH_DEFINES
#include <math.h>
using namespace std;

#define REP(i,n) for(int i = 0; i < (int)n; i++)

#define V vector<int>
#define P pair<int,int>
#define INF 1000000007
#define MOD	10000
typedef long long LL;

#define SIZE 1000000
int BIT[SIZE];

void add(int i) {
	if (i >= SIZE) return;
	BIT[i]++;
	add(i + (i & (-i)));
}

int sum(int i) {
	if (i == 0)	return 0;
	return BIT[i] + sum(i - (i & (-i)));
}

int main() {
	int N;
	V A;
	cin >> N;
	REP(i, N) {
		int a;
		cin >> a;
		A.push_back(a + 1);
	}
	LL inversions = 0;
	REP(k, N) {
		int a = A[k];
		inversions += ((LL)k - (LL)sum(a));
		add(a);
	}
	REP(k, N) {
		cout << inversions << endl;
		int cnt = (N - A[k]) - (A[k] - 1);
		inversions += (LL)cnt;
	}
}

#include<bits/stdc++.h>

using namespace std;

#define enviar {ios_base::sync_with_stdio(false);}
#define aiuda {cin.tie(NULL); cout.tie(NULL);}

#define F_OR(i, a, b, s) for (int i=(a); (s)>0?i<(b):i>(b); i+=(s))
#define F_OR1(e) F_OR(i, 0, e, 1)
#define F_OR2(i, e) F_OR(i, 0, e, 1)
#define F_OR3(i, b, e) F_OR(i, b, e, 1)
#define F_OR4(i, b, e, s) F_OR(i, b, e, s)
#define GET5(a, b, c, d, e, ...) e
#define F_ORC(...) GET5(__VA_ARGS__, F_OR4, F_OR3, F_OR2, F_OR1)
#define FOR(...) ;F_ORC(__VA_ARGS__)(__VA_ARGS__)
#define EACH(x, a) for (auto& x: a)
#define exacto(v) cout << setprecision(v) << fixed;

#define ll long long
#define eb emplace_back
#define em emplace
#define ef emplace_front
#define f first
#define s second
#define big greater<ll>()

#define ar(v)  array<int,v>
#define all(v) v.begin(), v.end()
#define sz(x) (int)(x).size()
#define meminf(v) memset(v, 0x7f , sizeof(v))
#define mem(v,x) memset(v , x , sizeof v);
#define ai(a, n) for (int ele = 0; ele < n; ele++) cin >> a[ele];
#define ao(a, n) {for (int ele = 0; ele < (n); ele++) { if (ele) cout << " "; cout << a[ele]; } cout << '\n';}
#define readgraph(list, edges) for (int i = 0; i < edges; i++) {int n1, n2; cin >> n1 >> n2; n1--; n2--; list[n1].eb(n2); list[n2].eb(n1);}

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

string to_string(bool b) {return b?"true":"false"; }

string to_string(char c) { return string(1, c);}

string to_string(const char* s) { return string(s); }

string to_string(string s) { return s; }

template<class T> string to_string(T v) { bool f=1; string res; EACH(x, v) { if(!f) res+=' '; f=0; res+=to_string(x); } return res; }

template<class A> void write(A x) { cout << to_string(x); }

void print() { write("\n"); }

template<class H, class... T> void print(const H& h, const T&... t) {  write(h); if(sizeof...(t)) write(' '); print(t...); }

typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef map<ll, ll> mll;

const ll mod = 1e9 + 7;
const ll maxsize = 3e5 + 10;
// const (size, caracter)

//ll n, m ,k , nc;

ll cnt[maxsize];
//ll a[maxsize], b[maxsize], p[maxsize];

//ll pre[maxsize];
struct FenwickTree {
    vector<int> bit;  // binary indexed tree
    int n;

    FenwickTree(int _n) {
        this->n = _n;
        bit.assign(n, 0);
    }

    FenwickTree(vector<int> a) : FenwickTree(a.size()) {
        for (size_t i = 0; i < a.size(); i++)
            add(i, a[i]);
    }

    int sum(int r) {
        int ret = 0;
        for (; r >= 0; r = (r & (r + 1)) - 1)
            ret += bit[r];
        return ret;
    }

    int sum(int l, int r) {
        return sum(r) - sum(l - 1);
    }

    void add(int idx, int delta) {
        for (; idx < n; idx = idx | (idx + 1))
            bit[idx] += delta;
    }
};

ll n, m ,k , nc;
ll a[maxsize];
void solve()
{
	cin >> n;
	FenwickTree  f(n);

	ll ans = 0;
	FOR(i , n){
		ll u ; cin >> u;
		a[i] = u;
		ll t = f.sum(u, n-1);
		ans += t;
		cnt[i] = t;
		//print(u,  f.sum(u), ans);
		f.add(u, 1);
	}

	print(ans);

	FOR(i ,   n - 1)
	{
		ans -= a[i];
		ans += (n -1 )- a[i];
		print(ans);
	}

}

int main(){

	enviar aiuda

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

    while(t--)  solve();

	return 0;
}


#include <bits/stdc++.h>

using ll=long long;
using namespace std;

#define rep_i(i, n) for (int i = 0; i < (n); ++i)
#define rep_ll(i, n) for (long long i = 0; i < (n); ++i)
#define r_rep_i(i, start, end) for (int i = (start); i < (end); ++i)
#define r_rep_ll(i, start, end) for (long long i = (start); i < (end); ++i)
#define debug_vi(v) copy((v).begin(), (v).end(), ostream_iterator<int>(cout, " "));
#define debug_vll(v) copy((v).begin(), (v).end(), ostream_iterator<long long>(cout, " "));
#define debug_vd(v) copy((v).begin(), (v).end(), ostream_iterator<double>(cout, " "));
#define sort_v(v) sort((v).begin(), (v).end()); //昇順
#define d_sort_vi(v) sort((v).begin(), (v).end(), greater<int>()); //降
#define d_sort_vll(v) sort((v).begin(), (v).end(), greater<long long>()); //降
#define d_sort_vd(v) sort((v).begin(), (v).end(), greater<double>()); //昇順
#define say(t) cout << (t) << endl;
#define sum_vi(v) accumulate((v).begin(), (v).end(), 0);
#define sum_vll(v)accumulate((v).begin(), (v).end(), 0LL);

ll gcd(ll a, ll b) { return b?gcd(b, a%b):a;}
ll lcm(ll a, ll b) { return a/gcd(a, b)*b;}

const int IINF=(1<<30);
const ll LLINF = 1LL<<60;

char BigAlphaToSmall(char a){
    if (a >= 65 && a <= 90){
        return a + 32;
    }
    return a;
}

char SmallAlphaToBig(char a){
    if (a >= 97 && a <= 122){
        return a - 32;
    }
    return a;
}

int main(){
    cin.tie(0);
    ios::sync_with_stdio(0);
    int t;
    cin >> t;
    rep_i(i, t)
    {
        int l, r;
        cin >> l >> r;
        if (2*l > r)
        {
            cout << 0 << endl;
            continue;
        }
        ll hoge = r-(2*l)+2;
        ll hoge2 = r-(2*l)+1;
        ll ans = hoge*hoge2/2;
        cout << ans << endl;
    }
}

// acl1

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

int main(){

    ll t;
    cin>>t;
    while(t--){
        ll l,r;
        cin>>l>>r;

        ll n=r-l-l+1;

        ll ans=((n)*(n+1))/2;
        if(n>0)
        cout<<ans<<endl;
        else{
            cout<<0<<endl;
        }

    }
}


#include <bits/stdc++.h>
using namespace std;
typedef unsigned long long int ll;
typedef pair<ll,ll> P;
typedef vector<ll> VI;
typedef vector<VI> VVI;
#define REP(i,n) for(int i=0;i<n;i++)
#define ALL(v) v.begin(),v.end()
constexpr ll MOD=998244353;
constexpr ll INF=1e18;

ll power(ll x, ll y){
	x%=MOD;
	ll ret=1;
	while(y){
		if(y&1) ret=ret*x%MOD;
		x=x*x%MOD;
		y>>=1;
	}
	return ret;
}
ll divid(ll x, ll y){
	x%=MOD;
	return x*power(y,MOD-2)%MOD;
}

const int MAX=510000;
ll 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;
	}
}
ll 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(){
	COMinit();
	int n, k; cin >> n >> k;
	VI a(n); REP(i,n) cin >> a[i];
	VVI p(k+1,VI(n,1));
	VI sump(k+1,0);
	REP(i,k){
		REP(j,n){
			p[i+1][j]=p[i][j]*a[j]%MOD;
			sump[i+1]=(sump[i+1]+p[i+1][j])%MOD;
		}
	}
	for(int i=1;i<=k;i++){
		ll ans=0;
		for(int j=0;j<=i/2;j++){
			if(j==0){
				ans=ans+sump[i]*(n-1)%MOD;
				ans%=MOD;
			}
			else if(j*2!=i){
				ans=(ans+sump[j]*sump[i-j]%MOD*COM(i,j)%MOD)%MOD;
				if(j>0)
					ans=(ans+MOD-sump[i]*COM(i,j)%MOD)%MOD;
			}
			else{
				ans=(ans+divid((power(sump[j],2)-sump[i]+MOD)*COM(i,j),2))%MOD;
			}
		}
		cout << ans << endl;
	}
	return 0;
}

#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define ALL(v) (v).begin(), (v).end()
using ll = long long;
constexpr int MOD = 1000000007;

int f[400001], g[400001];

/*
    実行時Modint :
    template <int& MOD = 1000000007>
    static int MOD;
    cin >> MOD;
*/
template <int MOD = 1000000007>
struct Mint {
    int x;

    Mint() : x(0) {}
    Mint(long long t) : x(t >= 0 ? (t % MOD) : (MOD - (-t) % MOD) % MOD) {}

    Mint pow(int n) {
        Mint res(1), t(x);
        while (n > 0) {
            if (n & 1) res *= t;
            t *= t;
            n >>= 1;
        }
        return res;
    }

    Mint inv() const {
        int a = x, b = MOD, u = 1, v = 0, t;
        while (b > 0) {
            t = a / b;
            a -= t * b;
            swap(a, b);
            u -= t * v;
            swap(u, v);
        }
        return Mint(u);
    }

    Mint &operator+=(Mint a) {
        x += a.x;
        if (x >= MOD) x -= MOD;
        return *this;
    }

    Mint &operator-=(Mint a) {
        x += MOD - a.x;
        if (x >= MOD) x -= MOD;
        return *this;
    }

    Mint &operator*=(Mint a) {
        x = int(1LL * x * a.x % MOD);
        return *this;
    }

    Mint &operator/=(Mint a) {
        return (*this) *= a.inv();
    }

    Mint operator+(Mint a) const {
        return Mint(x) += a;
    }
    Mint operator-(Mint a) const {
        return Mint(x) -= a;
    }
    Mint operator*(Mint a) const {
        return Mint(x) *= a;
    }
    Mint operator/(Mint a) const {
        return Mint(x) /= a;
    }

    Mint operator-() const {
        return Mint(-x);
    }

    bool operator==(const Mint a) {
        return x == a.x;
    }
    bool operator!=(const Mint a) {
        return x != a.x;
    }
    bool operator<(const Mint a) {
        return x < a.x;
    }

    friend ostream &operator<<(ostream &os, const Mint &a) {
        return os << a.x;
    }

    friend istream &operator>>(istream &is, Mint &a) {
        int t;
        is >> t;
        a = Mint<MOD>(t);
        return (is);
    }

    int mod() {
        return MOD;
    }
};

/*
    MODint依存
    nCk mod p (p < n)
*/
template <typename T>
struct SmallModCombination {
    vector<int> f;
    vector<T> g;

    SmallModCombination(int sz) : f(sz + 1), g(sz + 1) {
        for (int i = 1; i <= sz; i++) {
            int pos = i;
            while (pos % g[0].mod() == 0) {
                pos /= g[0].mod();
                f[i]++;
            }
            g[i] = T(pos);
        }
        g[0] = T(1);
        for (int i = 1; i <= sz; i++) f[i] += f[i - 1];
        for (int i = 1; i <= sz; i++) g[i] *= g[i - 1];
    }

    T C(int n, int k) {
        if (f[n] > f[k] + f[n - k])
            return T(0);
        else
            return g[n] / (g[k] * g[n - k]);
    }
};

signed main() {
    int n;
    cin >> n;
    string c;
    cin >> c;
    map<char, Mint<3>> mp;
    mp['B'] = 0;
    mp['W'] = 1;
    mp['R'] = 2;
    SmallModCombination<Mint<3>> C(400000);
    Mint<3> ans = 0;
    rep(i, n) {
        ans += C.C(n - 1, i) * mp[c[i]];
    }
    if (n % 2 == 0) ans *= Mint<3>(-1);
    if (ans == Mint<3>(0)) {
        cout << "B" << endl;
    } else if (ans == Mint<3>(1)) {
        cout << "W" << endl;
    } else {
        cout << "R" << endl;
    }
    return 0;
}


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

int main(){
	int N,S,D,ff=0;
	vector<int> X,Y;
	//vector<vector<vector<int>>> dp;
	//long long amt=0;
	//string s;
	int ans=0;

	cin >> N >> S >> D;
	X = Y = vector<int>(N);
	//A.at(0) = A.at(0) = 0;

	for(int i=0; i<N; i++){
		cin >> X.at(i) >> Y.at(i);
		if(X.at(i)<S && Y.at(i)>D){
			ff=1;
		}
	}

	if(ff==1){
		cout << "Yes";
	}else{
		cout << "No";
	}

	//cout << ans;
}

#include <bits/stdc++.h>
using namespace std;
#define gc getchar_unlocked
#define ll long long
#define PI 3.1415926535897932384626
#define si(x) scanf("%d", &x)
#define sl(x) scanf("%lld", &x)
#define ss(s) scanf("%s", s)
#define pi(x) printf("%d\n", x)
#define pl(x) printf("%lld\n", x)
#define ps(s) printf("%s\n", s)
#define br printf("\n")
#define fo(i, n) for (i = 0; i < n; i++)
#define Fo(i, k, n) for (i = k; k < n ? i < n : i > n; k < n ? i += 1 : i -= 1)
#define deb(x) cout << #x << " = " << x << endl;
#define deb2(x, y) cout << #x << " = " << x << ", " << #y << " = " << y << endl
#define deba(i, a, n) \
	fo(i, n) { cout << a[i] << " "; }
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define clr(x) memset(x, 0, sizeof(x))
#define sortall(x) sort(all(x))
#define tr(it, x) for (auto it = x.begin(); it != x.end(); it++)
#define trr(it, x) for (auto it = x.rbegin(); it != x.rend(); it +)
typedef pair<int, int> pii;
typedef pair<ll, ll> pl;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<pii> vpii;
typedef vector<pl> vpl;
typedef vector<vi> vvi;
typedef vector<vl> vvl;

const int MOD = 1000000007;
const int INF = 1000000009;
const int N = 300050;

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

ll binomialCoeff(ll n, ll k) {
	ll C[n + 1][k + 1];
	ll i, j;

	for (i = 0; i <= n; i++) {
		for (j = 0; j <= min(i, k); j++) {
			// Base Cases
			if (j == 0 || j == i)
				C[i][j] = 1;

			else
				C[i][j] = (C[i - 1][j - 1] + C[i - 1][j]) % MOD;
		}
	}

	return C[n][k];
}

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

int lcm(int a, int b) {
	return a * (b / gcd(a, b));
}

void create_fac(int n) {
	vector<int> fac(N), inv(N);
	fac[0] = inv[0] = 1;
	for (int i = 1; i <= n; i++) {
		fac[i] = fac[i - 1] * i % MOD;
		inv[i] = fpow(fac[i], MOD - 2);
	}
}

void sieve(int n)  // linear sieve
{
	vector<int> primes;
	bool prime[N];
	for (int i = 2; i < n; ++i) {
		if (prime[i])
			primes.push_back(i);
		for (int j = 0; j < primes.size() && i * primes[j] < n; ++j) {
			prime[i * primes[j]] = false;
			if (i % primes[j] == 0)
				break;
		}
	}
}

/* ========== YOUR CODE HERE ========= */

//void solution() {
string solution() {
	ll n = 0, s = 0, d = 0;
	cin >> n >> s >> d;

	ll a[n], b[n];

	for (ll i = 0; i < n; i++) {
		cin >> a[i] >> b[i];
	}
	for (ll i = 0; i < n; i++) {
		if (a[i] < s && b[i] > d)
			return "Yes";
	}
	return "No";
}

/* ========== YOUR CODE HERE ========= */

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

	int t = 1;
	// cin >> t;
	while (t--) {
		cout << solution() << endl;
		//        solution();
	}

	return 0;
}


#include<bits/stdc++.h>
using namespace std;
int main(){
    int n;
    cin >>n;
    long long a,ans=0,cnt[205]={0};
    for(int i=0;i<n;i++){
        cin >>a;
        cnt[a%200]+=1;
    }
    for(int i=0;i<200;i++){
        if(cnt[i]>1){
            ans+=(cnt[i]-1)*cnt[i]/2;
        }
    }
    cout <<ans <<endl;
    return 0;
}

#include<bits/stdc++.h>
#include <iterator>
#include <iostream>
#include <numeric>
#include <math.h>
#define ll long long
#define ull long
#define mpa make_pair
#define pb push_back
#define ff first
#define pii pair<ll,ll>
#define dd double
#define trace(x) cerr << #x << " : " << x << endl
#define ss second
#define boost ios_base::sync_with_stdio(0)
#define forp(i,a,b) for(ll i=a;i<=b;i++)
#define rep(i,n)    for(ll i=0;i<n;++i)
#define ren(i,n)    for(ll i=n-1;i>=0;i--)
#define forn(i,a,b) for(ll i=a;i>=b;i--)
#define all(c) (c).begin(),(c).end()
#define tr(c,i) for(typeof((c).begin()) i = (c).begin(); i != (c).end();
#define sc(x) scanf("%lld",&x)
#define clr(x,val) memset(x,val,sizeof(x))
#define pr(x) printf("%lld\n",x)
#define pdd pair<dd,dd>
#define read_arr(a,n) for(ll i=1;i<=n;i++)cin>>a[i];
#define init_arr(a,n) for(ll i=1;i<=n;i++)a[i]=n-i+1;
#define prec(x) cout<<fixed<<setprecision(x)
#define fre freopen("input.txt","r",stdin),freopen("C:/Users/HP/OneDrive/Desktop/compi_prog/output.txt","w",stdout)
#define arr array
using namespace std;
void solve(ll tc){
	ll n,e;
	cin>>n;
	vector<ll> cnt(200,0);
	ll ans=0;

	for(ll i=1;i<=n;i++){
		cin>>e;
		e%=200;
		ans=ans+cnt[e];
		cnt[e]++;
	}
	cout<<ans;

}

int main(){

	boost;

	ll t=1;
	t=1;

	ll tc=1;

	while(t--){
		solve(tc);
		tc++;
	}

}


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

#define rapid() ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define endl '\n'

int main(){

	rapid();

	int n;
  	cin>>n;
  	int n2=1<<n;
  	vector<int>a(n2);
  	map<int,int>mp;
  	for(int i=0;i<n2;i++){
  		cin>>a[i];
  	}
  	for(int i=0;i<n2;i++){
  		mp[a[i]]=i+1;
  	}
  	while(a.size()>2){
  		vector<int>na;
  		for(int i=0;i<a.size();i+=2){
  			na.push_back(max(a[i],a[i+1]));
  		}
  		swap(a,na);
  	}
	int ans=min(a[0],a[1]);
	cout<<mp[ans]<<endl;
	return 0;
}

#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;

typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> oset;
#define ll long long
#define boost ios::sync_with_stdio(false), cin.tie(nullptr), cout.tie(nullptr)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define sz(x) (int)((x).size())
#define endl "\n"

////@Deepak404-------------------------------------------------------------------->

const ll mxN = 1e5;
const ll mod = 1e9 + 7;

void solve()
{
    ll n;
    cin >> n;
    deque<int> dq;
    int in;
    n = pow((ll)2, n);
    vector<int> a(n / 2);
    vector<int> b(n / 2);
    for (auto &&i : a)
    {
        cin >> i;
    }
    for (auto &&i : b)
    {
        cin >> i;
    }
    auto mxa = max_element(all(a));
    auto mxb = max_element(all(b));
    int ans;
    if (*mxa < *mxb)
        ans = (mxa - a.begin()) + 1;
    else
        ans = (mxb - b.begin()) + (n / 2) + 1;
    cout << ans << "\n";
}

int main()
{
    boost;
    int tc = 1;
    // cal();
    // sieve();
    // cin >> tc;
    for (int i = 1; i <= tc; i++)
    {
        // cout << "Case #" << i << ": ";
        solve();
    }

#ifndef ONLINE_JUDGE
    cerr << "Time: " << 1000 * ((double)clock()) / (double)CLOCKS_PER_SEC << " ms\n";
#endif
    return 0;
}


//#include "pch.h"
#include <stdio.h>
#include <string.h>
#include <algorithm>
#include <iostream>
#include <string>
#include <vector>
#include <functional>
#include <map>
#include <iomanip>
#include <math.h>
#include <stack>
#include <queue>
#include <bitset>
#include <cstdlib>
#include <tuple>
#include <cctype>
#include <ctype.h>
#include <set>
#include <sstream>
#include <time.h>
#include <numeric>
using namespace std;
//#define int long long
#define rep(i,s,n) for(int i = s;i<n;i++)
#define repe(i,s,n) for(int i = s;i<=n;i++)
#define rrep(i,s,n) for(int i = (n)-1;i>=(s);i--)
#define all(v) (v).begin(),(v).end()
#define pb push_back
#define fi first
#define se second
#define chmin(a,b) a=min((a),(b))
#define chmax(a,b) a=max((a),(b))
#define l1 list[index]
#define l2 list[index - 1]
#define l3 list[index + 1]
#define iif(i,j) ((i<0 && j<0) || (i>0 && j>0)) ? true : false
typedef long long ll;
typedef pair<int, int>pint;
typedef vector<int>vint;
typedef vector<pint>vpint;
typedef pair<pint, int> P1;
typedef pair<int, pint> P2;
typedef pair<pint, pint> PP;
static const ll maxLL = (ll)1 << 62;
const ll MOD = 1000000007;
const ll INF = 1e18;
const double PI = 3.14159265359;
int ca[12] = { 31,28,31,30,31,30,31,31,30,31,30,31 };

signed main() {
	int n, k, m;

	cin >> n >> k >> m;
	int sum = 0;

	for (int i = 0; i < n - 1; i++) {
		int num;
		cin >> num;
		sum += num;

	}

	for (int i = 0; i <= k; i++) {
		if ((sum + i)/n >= m) {
			cout << i << endl;
			return 0;
		}
	}

	cout << -1 << endl;

	return 0;
}

#include <bits/stdc++.h>
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <stdio.h>
#include <cstdlib>
#include <math.h>

using namespace std;
typedef long long ll;

int main(){
  int n, k, m, sum=0, ans=0;
  cin >> n >> k >> m;
  vector<int>a(n);
  for(int i=0; i<n-1; i++){
  	cin >> a.at(i);
    sum += a.at(i);
  }
  ans = n*m-sum;
  if(ans <= 0){
  	cout << "0";
  }
  else if(ans <= k){
  	cout << ans;
  }
  else{
  	cout << "-1";
  }
}


// Problem: C - Keep Graph Connected
// Contest: AtCoder - AtCoder Regular Contest 108
// URL: https://atcoder.jp/contests/arc108/tasks/arc108_c
// Memory Limit: 1024 MB
// Time Limit: 2000 ms
//
// Powered by CP Editor (https://cpeditor.org)

#include<bits/stdc++.h>
using namespace std;
#define int long long
inline int read(){
   int s=0,w=1;
   char ch=getchar();
   while(ch<'0'||ch>'9'){if(ch=='-')w=-1;ch=getchar();}
   while(ch>='0'&&ch<='9') s=s*10+ch-'0',ch=getchar();
   return s*w;
}
const int p=998244353;
int qp(int x,int y)
{
	int res=1;
	for(int t=x; y; y>>=1,t=t*t%p) if(y&1) res=res*t%p;
	return res;
}
vector<pair<int,int> > v[100003];
#define pb push_back
#define mp make_pair
#define fi first
#define se second
int a[1000003];
int n=read(),m=read();
void dfs(int x)
{
	for(auto i:v[x]) if(!a[i.fi])
	{
		if(a[x]==i.se) if(a[x]==n)a[i.fi]=1;
		else a[i.fi]=n;
		else a[i.fi]=i.se;
		dfs(i.fi);
	}
	return ;
}
signed main()
{
    if(n==2)
    {
    	puts("1");
    	puts("2");
    	return 0;
    }
    for(int i=1; i<=m; ++i)
    {
    	int x=read(),y=read(),z=read();
    	v[x].pb(mp(y,z)),v[y].pb(mp(x,z));
    }
    a[1]=1;
    dfs(1);
	for(int i=1; i<=n; ++i) printf("%lld\n",a[i]);
	return 0;
}

#include<iostream>
#include <bits/stdc++.h>
using namespace std;
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
#define ordered_set tree<ll, null_type,less<>, rb_tree_tag,tree_order_statistics_node_update>

#define ll long long
#define FOR(i,a,b)  for(ll i=a;i<=b;i++)
#define FORR(i,a,b)  for(ll i=a;i>=b;i--)
#define vl vector<ll>
#define ld long double
#define vld vector<ld>
#define vvl vector<vector<long long>>
#define vvld vector<vector<ld>>
#define pll pair<long,long>
#define vpll vector<pll>
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define lb(v,x) lower_bound(v.begin(),v.end(),x)
#define ub(v,x) upper_bound(v.begin(),v.end(),x)
#define d1(x) cout<<(x)<<endl
#define d2(x,y) cout<<(x)<<" "<<(y)<<endl
#define d3(x,y,z) cout<<(x)<<" "<<(y)<<" "<<(z)<<endl
#define d4(a,b,c,d) cout<<(a)<<" "<<(b)<<" "<<(c)<<" "<<(d)<<endl
#define PI 3.14159265358979323846264338327950288419716939937510
#define fix(f,n) fixed<<setprecision(n)<<f
#define all(x) x.begin(),x.end()
#define rev(p) reverse(p.begin(),p.end());
#define mset(a,val) memset(a,val,sizeof(a));
#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define popcount(x) __builtin_popcountll(x)
#define sz(x) ((ll)x.size())
const ll M = 1000000007;
const ll MM = 998244353;
#define endl "\n"
ll begtime = clock();
#define end_routine() cout << "\n\nTime elapsed: " << (clock() - begtime)*1000/CLOCKS_PER_SEC << " ms\n\n";
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "

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

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

ll powM(ll a, ll b, ll m) {
  if (b < 0 || a <= 0)return 0;
  a %= m;
  ll ans = 1LL;
  while (b) {
    if (b & 1)ans = ans * a % m;
    a = a * a % m;
    b >>= 1;
  }
  return ans;
}

ll poww(ll a, ll b) {
  if (b < 0 || a <= 0)return 0;
  ll ans = 1LL;
  while (b) {
    if (b & 1)ans = ans * a;
    a = a * a;
    b >>= 1;
  }
  return ans;
}

const ll N = 2e5 + 5;

map<ll, map<ll, ll>>blah;

ll par[N];

ll find(ll x) {
  if (x == par[x])return x;
  return par[x] = find(par[x]);

}
ll ran[N];

void unio(ll a, ll  b) {
  a = find(a), b = find(b);
  if (a == b)return;
  if (ran[a] < ran[b])swap(a, b);
  ran[a] += ran[b];
  par[b] = a;
  ran[b] = 0;
  for (auto val : blah[b]) {
    blah[a][val.ff] += val.ss;
  }
}

int main() {

  IOS;

#ifndef ONLINE_JUDGE

  freopen("input1.txt", "r", stdin);
  freopen("output1.txt", "w", stdout);

#endif

  ll n, q;
  cin >> n >> q;
  vl c(n + 1);
  FOR(i, 1, n) {
    cin >> c[i];
    blah[i][c[i]]++;
    par[i] = i, ran[i] = 1;
  }

// cout << blah[3][1];

  while (q--) {
    ll type;
    cin >> type;
    ll a, b;
    cin >> a >> b;
    if (type == 1) {
      unio(a, b);
    } else {
      ll papa = find(a);
      ll ans = blah[papa][b];
      cout << ans << endl;
    }
  }

  return 0;

}


#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i=0; i<(int)(n); i++)
#define rep1(i, n) for(int i=1; i<=(int)(n); i++)
#define rep2(i, n, m) for(int i=(int)n; i<=(int)m; i++)
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> wi;
typedef vector<ll> vl;
const ll inf=1LL<<60;
const ll mod=1000000007;

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

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

  int c=min(a, b), d=abs(a-b);
  vi ans;
  rep1(i, c-1){
  	ans.push_back(i);
  	ans.push_back(-i);
  }
  if(a<=b){
  	int sumb=0;
  	rep2(i, c, c+d){
  		ans.push_back(-i);
  		sumb+=-i;
  	}
  	if(sumb!=0)ans.push_back(-sumb);
  }
  else{
  	int suma=0;
  	rep2(i, c, c+d){
  		ans.push_back(i);
  		suma+=i;
  	}
  	if(suma!=0)ans.push_back(-suma);
  }

  rep(i, a+b){
  	if(i)cout << " ";
  	cout << ans[i];
  }
  cout << endl;

  int cnta=0, cntb=0, sum=0;
  rep(i, a+b){
  	if(ans[i]<0)cntb++;
  	if(ans[i]>0)cnta++;
  	sum+=ans[i];
  }

  return 0;
}

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

typedef long long ll;

ll n, m;

ll ksm(ll x, ll y, ll mod) {
    x = x % mod;
    ll base = 1;
    while (y) {
        if (y & 1) {
            base = base * x;
            base = base % mod;
        }
        x = x * x % mod;
        y = y / 2;
    }
    return base;
}

int main() {
    cin >> n >> m;
    ll ans = ksm(10, n, m * m);
    ll cnt =ksm(10, n, m);
    cout << (ans - cnt) / m << endl;

}


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

typedef long long int ll;

const ll MOD=((1e9)+7);

bool sortcol( const vector<ll>& v1,const vector<ll>& v2 )
{
	return v1[0] < v2[0];
}

int main()
{
	ll n, su=0;
	cin>>n;
	set<ll> s;
	for (ll i=1; i<=n; i++)
	{
		ll p;
		cin>>p;
		su+=p;
		s.insert(p);
	}
	if (s.size()==n)
	{
		if (su==(n*(n+1))/2)
		{
			cout<<"Yes";
		}
		else cout<<"No";
	}
	else cout<<"No";
	return 0;
}

#include <bits/stdc++.h>
#define x first
#define y second
#define endll '\n'
#define pb push_back
#define mem(x,a) memset(x,a,sizeof(x))
using namespace std;
const int N=1e5+10,mod=19650827;
const int inf=0x3f3f3f3f;
typedef long long ll;
typedef pair<int,int> pii;
typedef unsigned long long ull;
int n,k,m;
inline int read(){
	int x=0,f=1;char ch=getchar();
	while (!isdigit(ch)){if (ch=='-') f=-1;ch=getchar();}
	while (isdigit(ch)){x=x*10+ch-48;ch=getchar();}
	return x*f;
}
int a[111],b[111];
bool check(int x){
    for(int i=1;i<=n;i++){
        if(a[i]>x||b[i]<x)return false;
    }
    return true;
}
void work(){
    n=read();
    for(int i=1;i<=n;i++)a[i]=read();
    for(int i=1;i<=n;i++)b[i]=read();
    int res=0;
    for(int i=1;i<=1000;i++){
        if(check(i))res++;
    }
    cout<<res;
}
int main(){
    //int T=read();
    //while(T--)
        work();
    return 0;
}


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

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

long long extGCD(long long a, long long b, long long &x, long long &y) {
    if (b == 0) {
        x = 1;
        y = 0;
        return a;
    }
    long long d = extGCD(b, a%b, y, x);
    y -= a/b * x;
    return d;
}

int main()
{
	int T;
	cin >> T;
	rep(i,T)
	{
		ll N,S,K;
		cin >> N >> S >> K;
		ll g = my_gcd(N,K);
		if (S % g != 0)
		{
			cout << -1 << endl;
			continue;
		}

		K = K % N;

		ll x,y;
		extGCD(K,N,x,y);
		x *= -1 * (S/g);
		ll l = N*K/g;
		ll t = l/K;
		//cout << x << endl;
		//cout << t << endl;
		if (x > 0 && x <= t)
		{
			cout << x << endl;
		}
		else
		{
			if (x < 0)
			{
				x += t * (-1) * (x/t-1);
			}
			else
			{
				x -= t * (x/t);
			}
			cout << x << endl;
		}
	}
	return 0;
}

#include <bits/stdc++.h>

using namespace std;

int t;

void exgys(long long a, long long b, long long &x, long long &y) {
  if (b == 0) {
    x = 1;
    y = 0;
  } else {
    exgys(b, a % b, y, x);
    y -= a / b * x;
  }
}

long long inv(long long a, long long Mod) {
  long long x, y;
  exgys(a, Mod, x, y);
  return (x % Mod + Mod) % Mod;
}

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

int main() {
  cin >> t;
  while (t--) {
    long long n, s, k;
    cin >> n >> k >> s;
    long long a = s;
    long long b = (-k + n) % n, Mod = n;
    long long gys = gcd(a, gcd(b, Mod));
    a /= gys;
    b /= gys;
    Mod /= gys;
    if (gcd(a, Mod) != 1)
      cout << "-1" << endl;
    else
      cout << inv(a, Mod) * b % Mod << endl;
  }
  return 0;
}


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

int main() {
	long long n,i,ans1,ans2,ans3,ans4,ans5;
	cin >> n;
	vector<pair<long long,long long>> x(n),y(n);
	for(i=0; i<n; i++){
		cin >> x[i].first >> x[i].second;
		y[i].first=x[i].second; y[i].first=x[i].second;
	}
	sort(x.begin(),x.end());
	sort(y.begin(),y.end());
	ans1=x[n-1].first-x[0].first;
	ans2=max(x[n-1].first-x[1].first,x[n-2].first-x[0].first);
	ans3=y[n-1].first-y[0].first;
	ans4=max(y[n-1].first-y[1].first,y[n-2].first-y[0].first);
	ans5=abs(x[n-1].second-x[0].second);
	if(ans5==ans3){
		cout << max(ans2,ans4) << endl;
	}else{
		vector<long long> ans(4);
		ans[0]=ans1; ans[1]=ans2; ans[2]=ans3,ans[3]=ans4;
		sort(ans.begin(),ans.end());
		cout << ans[2] << endl;
	}
	return 0;
}

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

void solve() {
    string s;
    cin >> s;
    reverse(s.begin(), s.end());
    for(auto& e : s) {
        if(e == '6') {
            e = '9';
        } else if(e == '9') {
            e = '6';
        }
    }
    cout << s << endl;
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    solve();
    return 0;
}


#include <bits/stdc++.h>

#define ll long long
#define pi pair<int, int>
#define pf pair<float, int>
#define ps pair<string, int>
#define pii pair<int, pi>
#define mi map<int, int>
#define ml map<long long, int>
#define ms map<string, int>
#define mc map<char, int>
#define mpi map<pi, int>
#define F first
#define S second
#define vt vector
#define vi vector<int>
#define vd vector<double>
#define vf vector<float>
#define vl vector<long long>
#define vpi vector<pi>
#define vpf vector<pf>
#define vpii vector<pii>
#define st set
#define si set<int>
#define sd set<double>
#define sf set<float>
#define sl set<long long>

#define FOR(t, q) for(int q = 0; q < t; q++)
#define FORN(t, q, v) for(int q = v; q < t; q++)
#define sz(v) (int)(v.size())
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
#define LOWER(s) transform(s.begin(), s.end(), s.begin(), ::tolower)
#define UPPER(s) transform(s.begin(), s.end(), s.begin(), ::toupper)
#define pb(s) push_back(s);

#define nl endl
#define TC int _t; cin >> _t; FOR(_t, _q)

using namespace std;

void solve() {
	int a, b; cin >> a >> b;
	int c = 2 * a + 100;
	cout << c - b;
}

int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    // TC
    	solve();

    return 0;
}

#pragma region Macros
#include <bits/stdc++.h>

using namespace std;
using ll = long long;

#define REP2(i, n) for (int i = 0, i##_len = (int)(n); i < i##_len; ++i)
#define REP3(i, l, r) for (int i = (l), i##_len = (int)(r); i < i##_len; ++i)
#define GET_MACRO_REP(_1, _2, _3, NAME, ...) NAME
#define REP(...) GET_MACRO_REP(__VA_ARGS__, REP3, REP2) (__VA_ARGS__)
#define RREP2(i, n) for (int i = (n - 1); i >= 0; --i)
#define RREP3(i, l, r) for (int i = (r - 1), i##_len = (l); i >= i##_len; --i)
#define GET_MACRO_RREP(_1, _2, _3, NAME, ...) NAME
#define RREP(...) GET_MACRO_REP(__VA_ARGS__, RREP3, RREP2) (__VA_ARGS__)
#define IN(type, n) type n; cin >> n
#define INALL(type, v, s) vector<type> v(s); for (auto &e : v) { cin >> e; }
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) ((int)(x).size())

#ifdef _DEBUG
#define DEBUG(x) cout << #x << ": " << x << endl
#else
#define DEBUG(x)
#endif

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; }
void yes() { cout << "Yes" << endl; }
void no() { cout << "No" << endl; }
#pragma endregion

void print(vector<bool> &v) {
  vector<int> ans;
  REP(i, v.size()) {
    if (v.at(i)) ans.emplace_back(i + 1);
  }

  cout << ans.size();
  for (auto const &a : ans) {
    cout << " " << a;
  }
  cout << endl;
}

void print(int idx) {
  cout << "1 " << idx + 1 << endl;
}

int main() {
  IN(int, N);
  vector<vector<bool> > remain_elms(200, vector<bool>(N, false));
  vector<bool> exist(200);

  REP(i, N) {
    IN(ll, A);
    if (exist.at(A % 200)) {
      yes();
      print(ref(remain_elms.at(A % 200)));
      print(i);
      return 0;
    }
    remain_elms.at(A % 200).at(i) = true;
    exist.at(A % 200) = true;

    REP(j, 200) {
      if (!exist.at(j)) continue;
      if (remain_elms.at(j).at(i)) continue;

      vector<bool> tmp = remain_elms.at(j);
      tmp.at(i) = true;
      if (exist.at((j + A) % 200)) {
        bool is_ok = false;
        REP(k, N) {
          if (tmp.at(k) != remain_elms.at((j + A) % 200).at(k)) {
            is_ok = true;
            break;
          }
        }

        if (is_ok) {
          yes();
          print(ref(remain_elms.at((j + A) % 200)));
          print(ref(tmp));
          return 0;
        }
      } else {
        remain_elms.at((j + A) % 200) = tmp;
        exist.at((j + A) % 200) = true;
      }
    }
  }

  no();

  return 0;
}


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

int main() {
  int K;
  string S, T;
  cin >> K >>  S >> T;

  double ans=0;

  for(int i=1; i<=9; i++){
    for(int j=1; j<=9; j++){

      vector<int>TAKA(10);
      vector<int>AO(10);
      vector<int>WA(10);
      for(int k=0; k<4; k++){
        int n=int(S[k]-'0');
        TAKA[n]++;
        WA[n]++;
        n=int(T[k]-'0');
        AO[n]++;
        WA[n]++;
      }

      TAKA[i]++;
      AO[j]++;

      int f=0;
      for(int k=0; k<10; k++){
        if(TAKA[k]+AO[k]>K)f=1;
      }
    //  cout << f << ' ' << i << ' ' << j << endl;
      if(f==1)continue;

      int taka=0;
      int aoki=0;
      for(int k=0; k<10; k++){
        taka+=k*pow(10, TAKA[k]);
        aoki+=k*pow(10, AO[k]);
      }

      if(taka<=aoki)continue;
      //cout << i << ' ' << j << endl;
      double a, b, c, d;
      if(i!=j){
        a=(K-WA[i]);
        b=(K-WA[j]);
      }
      else if(i==j){
        a=(K-WA[i]);b=(K-WA[i]-1);
      }
      c=(9*K-8); d=(9*K-9);
      ans+=a/c*b/d;

    }
  }
  cout << std::fixed << std::setprecision(9);
  cout << ans << endl;
}

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

int main(){
    double N,D,H,d,h;
    double notans = 1000.0, tmp, ans;
    cin >> N >> D >> H;
    for(int i=0; i<N; i++){
        cin >> d >> h;
        tmp = (H-h)/(D-d);
        if(tmp<notans) notans = tmp;
    }
    ans = H-notans*D;
    if(ans<0.0) ans = 0.0;
    cout << ans << endl;
    return 0;
}


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

#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define rep3(i,m,n) for(int (i)=m;(i)<=(n);(i)++)
#define rep3rev(i,m,n) for(int (i)=m;(i)>=(n);(i)--)
#define all(a) (a.begin()),(a.end())
#define rall(a) (a.rbegin()),(a.rend())
#define fi first
#define se second
#define pb push_back
#define eb emplace_back

using ll = long long;
using vll = vector<ll>;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using P = pair<int, int>;

void Main(){
    int n; cin >> n;
  if(n % 2) cout << "Black" << endl;
  else cout << "White" << endl;
    return;
}

int main(){
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    Main();
    return 0;
}

#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define rep2(i, s, n) for (ll i = (s); i < (ll)(n); i++)
#define all(v) v.begin(), v.end()
#define sz(v) v.size()
#define INF 9 * 1000000000000000000 //9*10^18
template <typename T>
bool chmax(T &a, const T& b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}
template <typename T>
bool chmin(T &a, const T& b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}

// 返り値: a と b の最大公約数
// ax + by = gcd(a, b) を満たす (x, y) が格納される
long long extGCD(long long a, long long b, long long &x, long long &y) {
    if (b == 0) {
        x = 1;
        y = 0;
        return a;
    }
    long long d = extGCD(b, a%b, y, x);
    y -= a/b * x;
    return d;
}

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

int main()
{
    ll T;
    cin >> T;
    rep(i, T){
        ll N, S, K;
        cin >> N >> S >> K;
        ll d = gcd(N, K);
        if(S % d != 0){
            cout << -1 << endl;
            continue;
        }
        ll x = 0;
        ll y = 0;
        d = extGCD(N, -K, x, y);
        x *= S / d;
        y *= S / d;
        ll M = (-d * y) / N;
        vector<ll> t = {M-3, M-2, M-1, M, M+1, M+2, M+3};
        ll ans = INF;
        for(auto p : t){
            if(y + N/d * p >= 0){
                chmin(ans, y + N/d * p);
            }
        }
        cout << ans << endl;
    }
}


#pragma GCC optimize(2)
#include <bits/stdc++.h>
#define INF 1000000000
#define LINF 1000000000000000000
#define MOD 1000000007
#define mod 998244353
#define INF63 1061109567
#define INF127 9187201950435737471
#define UINF 18446744073709551615
#define F first
#define S second
#define ll long long
#define N 100010
using namespace std;
ll n,m,req[N],ans[N];
vector<pair<ll,ll> > ed,vt[N];
bool vis[N];
void dfs(ll x)
{
	vis[x]=true;
	ll i;
	for(i=0;i<vt[x].size();i++)
	{
		if(ans[vt[x][i].S]!=-1)
		{
			continue;
		}
		ans[vt[x][i].S]=(ed[vt[x][i].S].F!=x);
		if(!vis[vt[x][i].F])
		{
			dfs(vt[x][i].F);
		}
	}
	return;
}
int main(){
	ll x,y,i;
	scanf("%lld%lld",&n,&m);
	for(i=0;i<m;i++)
	{
		scanf("%lld%lld",&x,&y);
		x--;
		y--;
		ed.push_back(make_pair(x,y));
		vt[x].push_back(make_pair(y,i));
		vt[y].push_back(make_pair(x,i));
	}
	for(i=0;i<n;i++)
	{
		scanf("%lld",&req[i]);
	}
	memset(ans,-1,sizeof(ans));
	for(i=0;i<ed.size();i++)
	{
		if(req[ed[i].F]<req[ed[i].S])
		{
			ans[i]=1;
		}
		else if(req[ed[i].F]>req[ed[i].S])
		{
			ans[i]=0;
		}
	}
	for(i=0;i<n;i++)
	{
		if(!vis[i])
		{
			dfs(i);
		}
	}
	for(i=0;i<ed.size();i++)
	{
		if(ans[i]==0)
		{
			puts("->");
		}
		else
		{
			puts("<-");
		}
	}
	return 0;
}

#include <iostream>
#include <iomanip>
#include <vector>
#include <cmath>
#include <algorithm>
#include <set>
#include <utility>
#include <queue>
#include <map>
#include <assert.h>
#include <stack>
#include <string>
#include <ctime>
#include <chrono>
#include <random>
using namespace std;

//author: Legendary Grandmaster mshiladityam
//a beautiful problem

const int MAX = 1000;
bool arr[MAX + 1][MAX + 1] = { false };
vector<int> adjC[MAX + 1], adjR[MAX + 1];
bool visC[MAX + 1] = { false }, visR[MAX + 1] = { false };

void DFS(int v, bool b)
{
	if (b)
	{
		visC[v] = true;
		for (auto u : adjC[v])
		{
			if (!visC[u]) DFS(u, b);
		}
	}
	else
	{
		visR[v] = true;
		for (auto u : adjR[v])
		{
			if (!visR[u]) DFS(u, b);
		}
	}
}

void solve()
{
	int h, w;
	cin >> h >> w;

	for (int j = 1; j <= h; j++)
	{
		for (int i = 1; i <= w; i++)
		{
			char c;
			cin >> c;
			if (c == '#')	arr[j][i] = true;
			else arr[j][i] = false;
		}
	}

	arr[1][1] = true;
	arr[h][1] = true;
	arr[1][w] = true;
	arr[h][w] = true;

	for (int j = 1; j <= h; j++)
	{
		bool f = false;
		for (int i = 1; (i <= w) && (!f); i++)
		{
			if (arr[j][i])
			{
				f = true;
				for (int q = i + 1; q <= w; q++)
				{
					if (arr[j][q])
					{
						adjC[i].push_back(q);
						adjC[q].push_back(i);
					}
				}
			}
		}
	}

	for (int j = 1; j <= w; j++)
	{
		bool f = false;
		for (int i = 1; i <= h; i++)
		{
			if (f) break;
			if (arr[i][j])
			{
				f = true;
				for (int q = i + 1; q <= h; q++)
				{
					if (arr[q][j])
					{
						adjR[i].push_back(q);
						adjR[q].push_back(i);
					}
				}
			}
		}
	}

	int C = 0, R = 0;

	for (int j = 1; j <= w; j++)
	{
		if (!visC[j])
		{
			DFS(j, true);
			C++;
		}
	}

	for (int j = 1; j <= h; j++)
	{
		if (!visR[j])
		{
			DFS(j, false);
			R++;
		}
	}

	cout << min(R, C) - 1 << "\n";

	return;
}

signed main()
{
	ios::sync_with_stdio(0);
	cin.tie(NULL); cout.tie(NULL);
	int t;
	//cin >> t;
	t = 1;
	while (t--)
	{
		solve();
	}
	return 0;
}


#include <iostream>
#include <map>
#include <vector>
using namespace std;
int main(){
  int N;
  cin>>N;
  int t;
  map<int,int> A;
  for(int i=0;i<N;i++){
    cin>>t;
    A[t]+=1;
  }
  vector<int> B;
  for(int i=0;i<N;i++){
    cin>>t;
    B.push_back(t);
  }
  unsigned long long r=0;
  for(int i=0;i<N;i++){
    cin>>t;
    r+=A[B[t-1]];
  }
  cout<<r<<endl;
}

#include <bits/stdc++.h>

#define vi vector<int>
#define tests int t; cin>>t; while(t--)
#define ll long long
#define vll vector<long long>
#define srt(v) sort(v.begin(), v.end())
#define srtg(v) sort(v.begin(), v.end(), greater<int> ())
#define FOR(k, n) for(int k=0; k<n; k++)
#define pb push_back
#define yes cout<<"YES"<<endl
#define no cout<<"NO"<<endl

using namespace std;

char nums[10] = { '0','1','2','3','4','5','6','7','8','9' };
char alphsl[26] = { 'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z' };
const int MOD = 1000000007;
char alphs[26] = { 'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z' };

void solve() {

    int n;
    cin>>n;
    vi v(n);
    for(auto& x : v) cin>>x;
    int ans=v[0];
    for(int i=1; i<n; i++){
        ans=__gcd(ans, v[i]);
    }

    cout<<ans<<endl;

}

int main() {

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

        solve();

    return 0;
}


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

bool chk(string &s,string t){
    int n=(int)(s.length());
    for(int i=0;i<n;i++){
        if(s[i]!=t[i%3]) return false;
    }
    return true;
}
signed main()
{

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

    int n;
    cin>>n;
    string s;
    cin>>s;
    int tot=1e10;
    int tms=0;
    if(n==1){
        if(s[0]=='0') tms=tot;
        else tms=2*tot;
    }
    else if(n==2){
        if(s=="11"||s=="10") tms=tot;
        else if(s=="01") tms=tot-1;
    }
    else{
        if(s.substr(0,3)=="110"){
            if(chk(s,"110")){
                int toen=(n-1)/3;
                tms=tot-toen;
            }
        }
        else if(s.substr(0,3)=="101"||s.substr(0,3)=="011"){
            if(chk(s,s.substr(0,3))){
                int toadd=0;
                if(s.substr(0,3)=="011") toadd=1;
                int toen=(n+toadd)/3;
                tms=tot-toen;
            }
        }
    }
    cout<<tms;
    return 0;
}

#include <bits/stdc++.h>

#define se second
#define sz(x) (int)(x.size())
#define ll long long
#define rep(i,x,y) for(int i = x; i <= y; ++i)
#define repr(i,x,y) for(int i = x; i >= y; --i)
#define pb push_back
#define mp make_pair
#define fi first
#define ull unsigned ll

#define pi 3.14159265358979

using namespace std;

const int N = (int)(1e6) + 322;
const ll INF = 2e18 + 17;
const int inf = 2e9;
const int mod = 1000000007;
const double eps = 1e-9;

template<typename T>
void pop_front(vector<T>& vec)
{
    assert(!vec.empty());
    vec.erase(vec.begin());
}

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

int nbr_bits(int a){
	return log2(a)+1;
}

int fastpow(int a, int n, int mod) {
    if(n==0)
    	return 1;
    if(n%2==0){
    	int res = fastpow(a,n/2,mod);
    	res*=res;
    	res%=mod;
    	return res;
	}
	int res = (fastpow(a,n-1,mod)*a)%mod;
	return res;

}

// ---------------------------------------------------
int p[N];
stack<string> answers;

int find(int u){
	if(p[u]==u) return u;
	return p[u] = find(p[u]);
}

bool bubleSort(vector<int> v, int n){

  int ans = 0;
  int m = (n * (n -1)) / 2;
  rep(i, 0, n-1){

    rep(j, 0, n-2){

      if(v[j] > v[j + 1]){

		  swap(v[j], v[j + 1]);
		  ans++;

		}

	 }

  }
  if(ans < m) return true;
  else return false;

}

signed main()
{

//	int t;
//	cin >> t;
//
//	while(t--){
//
	  int x, y;
	  cin >> x >> y;
	  int k = max(x,y);
	  int l = min(x,y);
	  int rest = k - l ;
	  if(rest >= 3) cout << "No" << endl;
	  else cout << "Yes" << endl;

//	}

	return 0;
}


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

int main(){

 ll n,m;
 cin>>n>>m;
 vector<string> a(n);

 for(int i=0;i<n;i++){
     cin>>a[i];
 }
//  vector<ll> b(n);
 ll e=0,o=0;
 for(int i=0;i<n;i++){
     int c=0;
     for(int j=0;j<a[i].length();j++){
         c+=a[i][j]-'0';
     }
    //  b[i]=c;
     if(c%2){
         o++;
     }else{
         e++;
     }
 }

//  sort(b.begin(),b.end());

 ll ans=n*(n-1)/2;

//  ll d=1;
//  for(int i=1;i<n;i++){
//      if(b[i]!=b[i-1]){
//          ans-=d*(d-1)/2;
//          d=1;
//      }else{
//          d++;
//      }
//  }

//  ans-=d*(d-1)/2;

 ans-=e*(e-1)/2;
 ans-=o*(o-1)/2;

 cout<<ans;

  return 0;
}

#include <bits/stdc++.h>
using namespace std;
using ll = int64_t;
using ld = long double;
using P = pair<ll, ll>;
using Pld = pair<ld, ld>;
using Vec = vector<ll>;
using VecP = vector<P>;
using VecB = vector<bool>;
using VecC = vector<char>;
using VecD = vector<ld>;
using VecS = vector<string>;
template <class T>
using Vec2 = vector<vector<T>>;
#define REP(i, m, n) for(ll i = (m); i < (n); ++i)
#define REPN(i, m, n) for(ll i = (m); i <= (n); ++i)
#define REPR(i, m, n) for(ll i = (m)-1; i >= (n); --i)
#define REPNR(i, m, n) for(ll i = (m); i >= (n); --i)
#define rep(i, n) REP(i, 0, n)
#define repn(i, n) REPN(i, 1, n)
#define repr(i, n) REPR(i, n, 0)
#define repnr(i, n) REPNR(i, n, 1)
#define all(s) (s).begin(), (s).end()
template <class T1, class T2>
bool chmax(T1 &a, const T2 b) { if (a < b) { a = b; return true; } return false; }
template <class T1, class T2>
bool chmin(T1 &a, const T2 b) { if (a > b) { a = b; return true; } return false; }
template <class T>
istream &operator>>(istream &is, vector<T> &v) { for (T &i : v) is >> i; return is; }
template <class T>
ostream &operator<<(ostream &os, const vector<T> &v) { for (const T &i : v) os << i << ' '; return os; }
void co() { cout << '\n'; }
template <class Head, class... Tail>
void co(Head&& head, Tail&&... tail) { cout << head << ' '; co(forward<Tail>(tail)...); }
void ce() { cerr << '\n'; }
template <class Head, class... Tail>
void ce(Head&& head, Tail&&... tail) { cerr << head << ' '; ce(forward<Tail>(tail)...); }
void sonic() { ios::sync_with_stdio(false); cin.tie(nullptr); }
void setp(const int n) { cout << fixed << setprecision(n); }
constexpr int64_t LINF = 1000000000000000001;
constexpr int64_t MOD = 1000000007;
constexpr int64_t MOD_N = 998244353;
constexpr long double EPS = 1e-11;
const double PI = acos(-1);

template <typename T>
struct BIT {
    int64_t N;
    vector<T> data;

    BIT(int64_t n) {
        init(n);
    }

    const T &operator[](const int64_t i) const {
        return at(i);
    }

    T at(int64_t k) { return sum(k) - sum(k - 1); }

    void init(int64_t n) {
        N = 1;
        while (N <= n) N <<= 1;
        data.assign(N, 0);
    }

    void build(vector<T> v) {
        init(N);
        for (int i = 0; i < v.size(); ++i) {
            add(i, v[i]);
        }
    }

    void add(int64_t k, T x) {
        ++k;
        while (k <= N) {
            data[k] += x;
            k += k & -k;
        }
    }

    void update(int64_t k, T x) {
        add(k, x - at(k));
    }

    T sum(int64_t k) {
        T res = 0;
        while (k) {
            res += data[k];
            k -= k & -k;
        }
        return res;
    }

    T sum(int64_t a, int64_t b) { return sum(b) - sum(a); }

    T lower_bound(T k) {
        int64_t l = 0, r = N;
        while (r - l > 1) {
            int64_t m = (l + r) / 2;
            if (sum(m) >= k) r = m;
            else l = m;
        }
        return r;
    }
};

int main(void) {
    ll h, w;
    cin >> h >> w;
    ll m;
    cin >> m;
    VecP ps(m);
    rep(i, m) cin >> ps[i].first >> ps[i].second;
    sort(all(ps));

    Vec my(h + 1, w + 1);
    rep(i, m) chmin(my[ps[i].first], ps[i].second);
    repn(i, h) {
        if (my[i - 1] == 1) my[i] = 1;
    }

    BIT<ll> bit(w + 10);
    set<ll> st;

    REPN(i, my[1], w) {
        bit.add(i, 1);
        st.insert(i);
    }

    ll ans = 0;
    ll pos = 0;
    repn(i, h) {
        while (pos < m && ps[pos].first == i) {
            if (st.find(ps[pos].second) == st.end()) {
                bit.add(ps[pos].second, 1);
                st.insert(ps[pos].second);
            }
            ++pos;
        }
        ans += bit.sum(my[i], w + 1);
        // ce(i, ans);
    }
    co(h * w - ans);

    return 0;
}


#include <bits/stdc++.h>

using namespace std;
#define ll long long
#define ull unsigned long long
#define ld long double
#define ar array

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	int h, w;
	cin >> h >> w;
	string grid[h];
	for (int i=0; i<h; i++) {
		cin >> grid[i];
	}
	int c=0;
	for (int i=1; i<h; i++) {
		bool ok=0;
		for (int j=0; j<w; j++) {
			if (grid[i-1][j]=='.'&&grid[i][j]=='#') {
				if (!ok) c++, ok=1;
			} else ok=0;
		}
	}
	for (int i=h-2; i>=0; i--) {
		bool ok=0;
		for (int j=0; j<w; j++) {
			if (grid[i+1][j]=='.'&&grid[i][j]=='#') {
				if (!ok) c++, ok=1;
			} else ok=0;
		}
	}
	for (int j=1; j<w; j++) {
		bool ok=0;
		for (int i=0; i<h; i++) {
			if (grid[i][j-1]=='.'&&grid[i][j]=='#') {
				if (!ok) c++, ok=1;
			} else ok=0;
		}
	}
	for (int j=w-2; j>=0; j--) {
		bool ok=0;
		for (int i=0; i<h; i++) {
			if (grid[i][j+1]=='.'&&grid[i][j]=='#') {
				if (!ok) c++, ok=1;
			} else ok=0;
		}
	}
	cout << c;
	return 0;
}

#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <utility>
#include <cmath>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <unordered_set>
#include <map>
#include <tuple>
#include <numeric>
#include <functional>
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef pair<ll, ll> P;
#define rep(i, n) for(ll i = 0; i < n; i++)
#define exrep(i, a, b) for(ll i = a; i <= b; i++)
#define out(x) cout << x << endl
#define exout(x) printf("%.10f\n", x)
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define pb push_back
#define re0 return 0
const ll mod = 998244353;
const ll INF = 1e16;

int main() {
    ll h, w;
    cin >> h >> w;

    vector<string> board(h);
    rep(i, h) {
        cin >> board[i];
    }

    ll ans = 1;
    exrep(x, 0, h + w - 2) {
        vl cnt(3);
        rep(i, h) {
            ll j = x - i;
            if(j < 0 || w <= j) {
                continue;
            }
            if(board[i][j] == 'R') {
                cnt[1]++;
            }
            else if(board[i][j] == 'B') {
                cnt[2]++;
            }
            else if(board[i][j] == '.') {
                cnt[0]++;
            }
        }
        if(cnt[1] > 0 && cnt[2] > 0) {
            ans = 0;
        }
        else if(cnt[1] == 0 && cnt[2] == 0) {
            ans = ans * 2LL % mod;
        }
    }

    out(ans);
    re0;
}


#include<bits/stdc++.h>
#define pb emplace_back
#define pf first
#define ps second
#define all(x) x.begin(),x.end()
#define allr(x) x.rbegin(),x.rend()
#define Endl '\n'
#define codejam cout<<"Case #"<<t<<": ";
#define pl pair<ll,ll>
#define mod 1000000007
#define INF 1000000001
#define forn(i,n) for(ll i=0;i<n;i++)
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);
using namespace std;
typedef long long int ll;
ll gcd(ll a,ll b)
{
    if(b==0) return a;
    return gcd(b,a%b);
}

//////////////////////////////////// JAI SHREE RAM /////////////////////////////////////
const ll N=1e5;
void JAISHREERAM()
{
    ll n,i,j,ans=0;
    ll a,b;
    cin>>a>>b;
    ans=1;
    vector<int> f(200001,0);
    for(i=a;i<=b;i++)
    {
        for(j=1;j*j<=i;j++)
        {
            if(i%j==0)
            {
                f[i/j]++;
                if(f[i/j]>1) ans=max(ans,i/j);
                if(i/j!=j)
                {
                    int x=i/j;
                    f[i/x]++;
                    if(f[i/x]>1) ans=max(ans,i/x);
                }
            }
        }
    }
    cout<<ans;
}
int main()
{
    fast;
    int T=1;
    // cin>>T;
    for(int t=1;t<=T;t++)
    {
        // codejam
        JAISHREERAM();
    }
    return 0;
}

#include<bits/stdc++.h>
#define ll long long
#define pii pair<int,int>
#define pb push_back
#define fastio ios_base::sync_with_stdio(false); cin.tie(0);cout.tie(0);
const int MOD = 1000000007;
#define PI = acos(-1)
using namespace std ;
int main(){
   fastio ;
   int a , b ;
   cin >> a >> b ;
   int num  =  b - a ;
   for(int i = num ; i >= 1 ; i--){
   	    int x = b/i;
   	    if((x-1)*i >= a){
   	    	  cout << i ;
   	    	  break;
		   }
   }
}


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

#define rep(i,n) for(int i = 0; i < n; i++)
#define Rep(i,n) for(int i = 1; i <= n; i++)
#define sz(a) int(a.size())
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define fin(a) { cout << a << endl; return 0; }
#define debug(a) { cerr << #a << ": " << a << endl; }
#define endl '\n'
#define fi first
#define se second
using lint = long long;
using ld = long double;
using P = pair<int,int>;
using Pl = pair<lint,lint>;
template<class T> using V = vector<T>;
template<class T> using priq     = priority_queue<T>;
template<class T> using priq_inv = priority_queue<T, vector<T>, greater<T>>;
const int dx[] = {0,1,0,-1,1,1,-1,-1};
const int dy[] = {1,0,-1,0,1,-1,-1,1};
template<class T> T ceil(const T &a, const T &b) { return ((a)+(b)-1)/b; }
template<class T> bool chmin(T &a, T b) { if(a > b) { a = b; return 1; } return 0; }
template<class T> bool chmax(T &a, T b) { if(a < b) { a = b; return 1; } return 0; }
template<class T> void YesorNo(T x) { printf(x ? "Yes\n" : "No\n"); }
struct INF { template<class T> operator T() { return numeric_limits<T>::max() / 2; } } INF;

template<class T, class U> istream& operator>>(istream &in, pair<T,U> &p) {
    return in >> p.first >> p.second;
}
template<class T, class U> ostream& operator<<(ostream &out, const pair<T,U> &p) {
    return out << '{' << p.first << ',' << p.second << '}';
}
template<class T> istream& operator>>(istream &in, vector<T> &v) {
    for(auto &&e : v) in >> e;
    return in;
}
template<class T> ostream& operator<<(ostream &out, const vector<T> &v) {
    for(const auto &e : v) out << e << ' ';
    return out;
}

/*----------------------------------------------------------------------------------------------------*/

int main(){
    int n;
    cin >> n;
    int idx = 1;
    int now = 1;
    V<int> ans(n); ans[0] = 1;
    for(int i = 2; i <= n; i++) {
        if(i % idx == 0) {
            idx = i;
            now++;
        }
        ans[i-1] = now;
    }
    cout << ans << endl;
}

#include <bits/stdc++.h>
#define ll long long
#define pb push_back
#define task "dfs"
#define pll pair<ll, ll>
#define pii pair<ll, pll>
#define fi first
#define se second
#define ull unsigned long long
using namespace std;
const ll mod = 1e9+7;
const ll N = 1e6+55;
vector<ll> adj[N], dx[N], dy[N];
vector<ll> kq;
string s;
ll n, m, t, k, b[N],  a[N], ans, tong, c[N], d[N], cnt;
pll p[N];
ll pw(ll k, ll n)
{
    ll total = 1;
    for(; n; n >>= 1)
    {
        if(n & 1)total = total * k % mod;
        k = k * k % mod;
    }
    return total;
}
ll cs(ll x)
{
    ll cnt = 0;
    while(x > 0)
    {
        ++cnt;
        x /= 10;
    }
    return cnt;
}
void sol()
{
    cin >> n;
    m = cs(n);
    k = 0;
    t = 1;
    for(int i = 1; i < m; i ++)
    {

        k = k *10 + 9;
        ans += (k - t + 1) * ((i-1) / 3);
        t *= 10;
    }
    cout << ans + ((m-1)/3) * (n - k);

}
int main()
{
    if(fopen(task".inp", "r")){
       freopen(task".inp", "r", stdin);
       freopen(task".out", "w", stdout);
    }
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int ntest = 1;
    //cin >> ntest;

    sol();
}
/*
4
2 3 6 5
1 2 8 8
4 7 4 5
2 5 1 2
https://codeforces.com/problemset/problem/1239/D
*/


#include <bits/stdc++.h>
using namespace std;
int PREP = (cin.tie(nullptr), ios::sync_with_stdio(false), cout << fixed << setprecision(12), 0);
//int SEGV = getenv("D") || (exit(system("D= SEGFAULT_SIGNALS=all catchsegv ./prog.exe") >> 8), 0);
using Int = long long;
int main() {
    int N; cin >> N;
    for (int i = 1; i <= N; i++) {
        cout << (2*i+0) % N + 1 << ' ' << (2*i+1) % N + 1 << '\n';
    }
    return 0;
}

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

using namespace std;

typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef vector<PII> VPII;
typedef long long LL;
typedef vector<LL> VL;
typedef vector<VL> VVL;
typedef pair<LL, LL> PLL;
typedef vector<PLL> VPLL;
typedef priority_queue<LL> PQ_DESC;
typedef priority_queue<LL, VL, greater<LL>> PQ_ASC;
typedef priority_queue<PII> PQ_DESC_PII;
typedef priority_queue<PII, vector<PII>, greater<PII>> PQ_ASC_PII;
typedef priority_queue<VL> PQ_DESC_VL;
typedef priority_queue<VL, vector<VL>, greater<VL>> PQ_ASC_VL;
typedef priority_queue<PLL> PQ_DESC_PLL;
typedef priority_queue<PLL, vector<PLL>, greater<PLL>> PQ_ASC_PLL;

#define ALL(c) (c).begin(),(c).end()
#define PB push_back
#define MP make_pair
#define SORT_ASC(c) sort(ALL(c))
//#define SORT_DESC(c) sort(ALL(c), greater<typeof(*((c).begin()))>())
#define SORT_DESC(c) sort((c).rbegin(),(c).rend())
#define REV(c) reverse((c).begin(), (c).end())
#define SIZE(a) LL((a).size())

#define FOR(i,a,b) for(LL i=(a);i<(b);++i)
#define ROF(i,a,b) for(LL i=(b-1);i>=(a);--i)
#define REP(i,n) FOR(i,0,n)
#define PER(i,n) ROF(i,0,n)

const double EPS = 1e-10;
const double PI  = acos(-1.0);
const LL LARGE_INT = 1e9+100;
const LL INF = 2e9+100;
const LL INF_LL = (LL)INF*(LL)INF;
const LL MOD = 1e9+7;

//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

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

void Main()
{
    string s;cin>>s;
    LL n = SIZE(s);

    map<LL,LL> mp;
    REP(i,n){
        mp[s[i]-'0']++;
    }

    if(n==1){
        if(mp[8] == 0){
            cout<<"No"<<endl;
            return;
        }
        else{
            cout<<"Yes"<<endl;
            return;
        }

    }
    else if(n==2){
        for(LL i=16;i<1000;i+=8){
            map<LL,LL> x;
            LL t = i;
            bool f = true;
            while(t!=0){
                if(t%10 == 0){
                    f = false;
                }
                x[t%10]++;
                t/=10;
            }
            REP(i,10){
                if(mp[i] < x[i]){
                    f = false;
                    break;
                }
            }
            if(f){
                cout<<"Yes"<<endl;
                return;
            }
        }
        cout<<"No"<<endl;
    }
    else {
        for(LL i=104;i<1000;i+=8){
            map<LL,LL> x;
            LL t = i;
            bool f = true;
            while(t!=0){
                if(t%10 == 0){
                    f = false;
                }
                x[t%10]++;
                t/=10;
            }
            REP(i,10){
                if(mp[i] < x[i]){
                    f = false;
                    break;
                }
            }
            if(f){
                cout<<"Yes"<<endl;
                return;
            }
        }
        cout<<"No"<<endl;
    }

	return;
}

int main()
{
	cin.tie(nullptr);
	ios_base::sync_with_stdio(false);
	cout << fixed << setprecision(15);
	Main();
    return 0;
}


// 解き直し.
// https://atcoder.jp/contests/keyence2021/editorial/564
// C++(GCC 9.2.1)
#include <bits/stdc++.h>
using namespace std;
using LL = long long;
#define repex(i, a, b, c) for(int i = a; i < b; i += c)
#define repx(i, a, b) repex(i, a, b, 1)
#define rep(i, n) repx(i, 0, n)
#define repr(i, a, b) for(int i = a; i >= b; i--)
const LL MOD = 998244353;
const LL DIV3 = 332748118;
const int MAX = 5050;
char board[MAX][MAX];
LL dp[MAX][MAX];

// Fermat's little theorem から, 大きな冪乗の計算を行う.
// @param a: べき乗したい正整数.
// @param b: 指数.
// @return:  べき乗した計算結果(mod版).
LL mPow(LL a, LL b){
    LL t = 1;
    while(b){
        if(b & 1) t = (t * a) % MOD;
        a = a * a % MOD;
        b >>= 1;
    }
    return t % MOD;
}

int main(){

    // 1. 入力情報.
    int H, W, K;
    scanf("%d %d %d", &H, &W, &K);
    rep(h, MAX) rep(w, MAX) board[h][w] = '.';
    rep(i, K){
        int h, w;
        char c[11];
        scanf("%d %d %s", &h, &w, c);
        h--, w--;
        board[h][w] = c[0];
    }

    // 2. dp更新.
    dp[0][0] = 1;
    rep(h, H){
        rep(w, W){
            // 2-1. 開始地点は, Skip.
            if(h ==0 && w == 0) continue;

            // 2-2. 行方向更新.
            if(h){
                // マス目(h - 1, w) の 値.
                char op = board[h - 1][w];
                LL cur = dp[h - 1][w];

                // マス目(h - 1, w) が, 空欄 の 場合.
                if(op == '.'){
                    cur *= 2LL;
                    cur %= MOD;
                    cur *= DIV3;
                    cur %= MOD;
                }

                // マス目(h - 1, w) が, 'X', 'D' の 場合(何もしない).
                // if(op == 'X' || op == 'D'){}

                // マス目(h - 1, w) が, 'R' の 場合.
                if(op == 'R') cur = 0;

                // マス目(h, w) を 更新.
                dp[h][w] += cur;
                dp[h][w] %= MOD;
            }

            // 2-3. 列方向更新.
            if(w){
                // マス目(h, w - 1) の 値.
                char op = board[h][w - 1];
                LL cur = dp[h][w - 1];

                // マス目(h, w - 1) が, 空欄 の 場合.
                if(op == '.'){
                    cur *= 2LL;
                    cur %= MOD;
                    cur *= DIV3;
                    cur %= MOD;
                }

                // マス目(h, w - 1) が, 'X', 'R' の 場合(何もしない).
                // if(op == 'X' || op == 'R'){}

                // マス目(h, w - 1) が, 'D' の 場合.
                if(op == 'D') cur = 0;

                // マス目(h, w) を 更新.
                dp[h][w] += cur;
                dp[h][w] %= MOD;
            }
        }
    }

    // 3. 3 の (H * W - K)乗.
    LL ans = dp[H - 1][W - 1];
    ans *= mPow(3LL, (LL)(H * W - K));
    ans %= MOD;

    // 4. 出力.
    printf("%lld\n", ans);
    return 0;

}

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
constexpr int Inf = 1000000030;
constexpr ll INF= 2000000000000000000;
constexpr ll MOD = 998244353;
const double PI = 3.1415926535897;
typedef pair<int,int> P;
typedef pair<int,P> PP;

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

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

ll mod(ll val, ll M) {
    val = val % M;
    if(val < 0) {
        val += M;
    }
    return val;
}

template<typename T>
T RS(T N, T P, T M){
    if(P == 0) {
        return 1;
    }
    if(P < 0) {
        return 0;
    }
    if(P % 2 == 0){
        ll t = RS(N, P/2, M);
        if(M == -1) return t * t;
        return t * t % M;
    }
    if(M == -1) {
        return N * RS(N,P - 1,M);
    }
    return N * RS(N, P-1, M) % M;
}

ll dp[5050][5050];

int main() {
    int H,W,K;
    cin >> H >> W >> K;
    vector<vector<int>> vec(H,vector<int>(W));
    for(int i = 0;i < K;i++) {
        int h,w;
        char c;
        cin >> h >> w >> c;
        h--;
        w--;
        if(c == 'R') {
            vec.at(h).at(w) = 1;
        }
        else if(c == 'D') {
            vec.at(h).at(w) = 2;
        }
        else {
            vec.at(h).at(w) = 3;
        }
    }
    ll inv = RS((ll)3,MOD - 2,MOD);
    for(int i = 0;i < 5050;i++) {
        for(int j = 0;j < 5050;j++) {
            dp[i][j] = 0;
        }
    }
    dp[0][0] = RS((ll)3,(ll)H * W - K,MOD);
    for(int i = 0;i < H;i++) {
        for(int j = 0;j < W;j++) {
            if(vec.at(i).at(j) == 1) {
                dp[i][j + 1] += dp[i][j];
            }
            else if(vec.at(i).at(j) == 2) {
                dp[i + 1][j] += dp[i][j];
            }
            else if(vec.at(i).at(j) == 3) {
                dp[i][j + 1] += dp[i][j];
                dp[i + 1][j] += dp[i][j];
            }
            else {
                dp[i][j + 1] += dp[i][j] * 2 * inv % MOD;
                dp[i + 1][j] += dp[i][j] * 2 * inv % MOD;
            }
            dp[i][j + 1] %= MOD;
            dp[i + 1][j] %= MOD;
        }
    }
    cout << dp[H - 1][W - 1] << endl;

}


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

#define pra(i,k,n) for(i=k;i<n;i++)
#define all(a) a.begin(), b.begin()

int main() {
    string s; cin >> s;
    int i, n = s.size();
    string t = "";
    pra(i,0,n) {
        if (s[i]=='.') break;
        t += s[i];
    }
    cout << t << '\n';
    return 0;
}

#include<iostream>
#include<vector>
#include<math.h>
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
using namespace std;
long long int mod = 1e9+7;

int main(){
	long long int n;
	cin>>n;
	vector<long long int>a(1000000,0);
	for (long long int i = 0;(i+1)*(i+1)<=n;i++){
		if(n%(i+1)==0){
			printf("%lld\n",i+1);
			if((i+1)*(i+1)!=n){
				a[i] = n/(i+1);
			}
		}
	}
	rep(i,1000000){
		if(a[1000000-i-1]!=0){
			printf("%lld\n",a[1000000-i-1]);
		}
	}

	return 0;
}


#include<algorithm>
#include<iostream>
#include<cstring>
#include<bitset>
#include<cstdio>
#include<string>
#include<cmath>
#include<queue>
#include<stack>
#include<map>
#include<set>
using namespace std;
#define neinf 0xc0c0c0c0c0c0c0c0ll
#define inf 0x3f3f3f3f3f3f3f3fll
#define uint unsigned int
#define ull unsigned ll
#define ll long long
#define reg register
#define db double
#define il inline
#define gc getchar
#define pc putchar
#define HgS 1000000007
il ll rd()
{
	reg ll res=0,lab=1;
	reg char ch=gc();
	while((ch<'0'||ch>'9')&&ch!=EOF)
	{if(ch=='-')lab=-lab;ch=gc();}
	while(ch>='0'&&ch<='9')
		res=(res<<3)+(res<<1)+(ch&15),ch=gc();
	return res*lab;
}
il void prt(ll x,char t='\n')
{
	static char ch[70];int tp=0;
	if(!x){fputs("0",stdout);if(t)pc(t);return;}
	if(x<0)pc('-'),x=-x;
	while(x)ch[++tp]=(x%10)^48,x/=10;
	while(tp)pc(ch[tp--]);
	if(t)pc(t);
}
il ll umax(ll a,ll b){return a>b?a:b;}
il ll umin(ll a,ll b){return a<b?a:b;}
ll n,k,f[4][3000005],s,s2;
int main()
{
	n=rd();k=rd();f[2][2]=f[3][3]=1;
	for(int i=1;i<=n;++i)f[1][i]=1;
	for(int i=3;i<=2*n;++i)f[2][i]=i>n?2*n-i+1:i-1;
	ll tmp=f[2][2];
	for(int i=4;i<=3*n;++i)
	{
		if(i<=2*n+1)tmp+=f[2][i-1];
		if(i>=n+2)tmp-=f[2][i-n-1];
		f[3][i]=tmp;
	}
	for(int i=3;i<=3*n;++i)
	{
		if(k<=f[3][i]){s=i;break;}
		k-=f[3][i];
	}
	for(int i=1;i<=n;++i)
	{
		if(s-i>2*n||s<=i)continue;
		if(k<=f[2][s-i]){s2=i;break;}
		k-=f[2][s-i];
	}
	//cerr<<s<<' '<<s2<<' '<<k<<endl;
	prt(s2,' ');tmp=umax(0,s-s2-n-1)+k;
	prt(tmp,' ');prt(s-s2-tmp);
	return 0;
}