#include <iostream>
#include <iomanip>
#include <vector>
#include <set>
#include <string>
#include <queue>
#include <algorithm>
#include <map>
#include <cmath>
#include <numeric>
#include <list>
#include <stack>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <tuple>
#include <deque>
#include <complex>
#include <bitset>

using namespace std;

typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int, int> pii;
typedef vector<pii> vpii;

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

typedef long double ld;
typedef vector<ld> vld;

typedef vector<bool> vb;

#define rep(i, n) for (ll i = 0; i < (n); i++)
#define reps(i, n) for (ll i = 1; i <= (n); i++)
#define rrep(i, n) for (ll i = (n) - 1; i >= 0; i--)
#define rreps(i, n) for (ll i = (n); i >= 1; i--)
#define all(v) (v).begin(), (v).end()

template <class T> void chmin(T& a, T b) { a = min(a, b);}
template <class T> void chmax(T& a, T b) { a = max(a, b);}

constexpr int INF = 1 << 30;
constexpr ll INFL = 1LL << 60;
constexpr ll MOD = 1000000007;
constexpr ld EPS = 1e-12;
ld PI = acos(-1.0);

void solve() {
    ll n, a, b;
    cin >> n >> a >> b;
    cout << n - a + b << endl;
    return;
}

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

#include <iostream>
#include <vector>
#include <algorithm>
#include <stack>
#include <map>
#include <tuple>
#include <cstdio>
#include <cmath>
#include <cassert>
#include <functional>
#define _LIBCPP_DEBUG 0
using namespace std;
using ll = long long;

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


/*                                بِسْمِ اللَّـهِ الرَّحْمَـٰنِ الرَّحِيمِ

                                    ( إِنِ الْحُكْمُ إِلَّا لِلَّهِ )

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

using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef vector<pair<int,int> > vpii;
typedef unsigned long long ull;
typedef long double ld;
const long double pi=acos(-1);
#define x           first
#define y           second
#define read(n,a)   for(int i=0;i<n;i++)cin>>a[i];
#define rep(i,z,n)  for(ll i=z;i<n;i++)
#define rrep(i,z,n) for(ll i=z-1;i>=n;i--)
#define all(v)      v.begin(),v.end()
#define clr(v,d)    memset(v,d,sizeof(v));

ll  a[200004];
ll  b[200004];

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

string s, ss;

ll n,m,k,w;
ll  ans ,ans1;
ll mod = 1e9 +7;

int main()
{
    cin.tie(0);
    cin.sync_with_stdio(0);
    //freopen("input.txt","r",stdin);
    //freopen("output.txt","w",stdout);
    int t=1;
    //cin>>t;
    while(t--)
    {
        cin>>n;
        s=to_string(n);
        m=s.size();
        ans=1e9;
        rep(i,0,(1<<m)-1)
        {
            k=0;
            w=0;
            rep(j,0,m)
            {
                if(i& 1<<j)continue;
                k*=10;
                k+=s[j]-'0';
                k%=3;
                w++;
            }
            if(k%3==0)ans=min(ans,m-w);
        }
        if(ans==1e9)ans=-1;
        cout<<ans;
    }
    return 0;
}

/* HARE KRSNA HARE KRSNA KRSNA KRSNA HARE HARE
    HARE RAMA HARE RAMA RAMA RAMA HARE HARE  */

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

#define nl "\n"
#define ff first
#define ss second
#define pp pop_back
#define pf pop_front
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define all(x) x.begin(),x.end()
#define test ll t; cin>>t; while(t--)
#define loop(i,s,n) for(ll i=s;i<n;i++)
#define rloop(i,s,n) for(ll i=s;i>=n;i--)
#define fill(a,value) memset(a,value,sizeof(a))

#define debug1(a,n)  loop(i,0,n)  cout<<a[i]<<" ";  cout<<nl;
#define debug2(a)  for(auto x : a)  cout<<x<<" ";  cout<<nl;
#define debug4(a)  for(auto x : a)  cout<<x.ff<<" "<<x.ss<<nl;
#define debug3(a,n,m)  loop(i,0,n){ loop(j,0,m)	cout<<a[i][j]<<" ";	cout<<nl; }

typedef long long ll;
typedef long double ld;

typedef stack<ll> sll;
typedef queue<ll> qll;
typedef deque<ll> dll;
typedef vector<ll> vll;
typedef vector<char> vc;
typedef vector<string> vs;
typedef pair<ll, ll> pll;
typedef vector<pll> vpll;
typedef pair<ll, pll> ppll;
typedef vector<vector<ll>> vvll;
typedef priority_queue<ll> pqll;

const ll mod = 1000000007;
const ll mod2 = 998244353;
const ld pi =  3.1415926535; //acos((ld) - 1);

set<string> S;

void rec(string s, ll len)
{
	if (!len)
	{
		S.insert(s);
		return;
	}
	rec(s + '1', len - 1);
	rec(s + '0', len - 1);
}

void solve()
{
	string n;	cin >> n;
	rec("", n.size());
	// debug2(S);

	ll ans = 9e18;

	for (auto x : S)
	{
		if ((ll)count(all(x), '0') == x.size())	continue;
		ll sum = 0;
		// cout << x << nl;
		loop(i, 0, x.size())
		{
			if (x[i] == '1')	sum += (n[i] - 48);
		}
		if (sum && sum % 3 == 0)
		{
			ans = min(ans, (ll)count(all(x), '0'));
			// cout << sum << " " << x << nl;
		}
	}

	if (ans == 9e18)		ans = -1;

	cout << ans << nl;
}

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

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

	// test
	solve();

	return 0;
}


//Show them your PROGRESS
#include <bits/stdc++.h>
using namespace std;
#define int long long int
#define pb push_back
const int M = 1e9 + 7;
const int MAX = 2e6 + 5;
#define selena ios_base::sync_with_stdio(false);cin.tie(NULL);
#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")

int findMaxGCD(vector<int> arr, int n)
{
    // Calculating MAX in array
    int high = 0;
    for (int i = 0; i < n; i++)
        high = max(high, arr[i]);

    int count[high + 1] = {0};
    for (int i = 0; i < n; i++)
        count[arr[i]]++;
    int counter = 0;
    for (int i = high; i >= 1; i--)
    {
        int j = i;
       counter = 0;
        while (j <= high)
        {

            if(count[j] >=2)
               return j;

           else if (count[j] == 1)
                counter++;
            j += i;
            if (counter == 2)
                return i;
        }
    }
}

void solve(){

    int n, m;
    cin >> n >> m;

    vector<int> v;
    for(int i = n; i <= m; i++)
    v.pb(i);

    cout << findMaxGCD(v, v.size()) << "\n";

}

int32_t main() {

	selena
	int tc = 1;
	//cin >> tc;
	while(tc--){
	    solve();
	}
	return 0;
}

#include <bits/stdc++.h>
using namespace std;
// TYPEDEF ------------------------------
typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> Pair;
typedef vector<ll> vll;
typedef vector<ld> vld;
typedef vector<vector<ll>> Graph;
typedef vector<string> vs;
typedef vector<pair<ll, ll>> Pll;
typedef queue<ll> qll;
typedef map<ll, ll> mll;
// REPEAT ------------------------------
#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=a;i<=(ll)(b);i++)
#define FORD(i,a,b) for(ll i=a;i>=(ll)(b);i--)
// UTIL ------------------------------
#define pb push_back
#define paired make_pair
#define ALL(a) (a).begin(),(a).end() // 注意；https://kimiyuki.net/blog/2015/09/25/competitive-programming-coding/
#define SORT(a) sort((a).begin(),(a).end())
#define RSORT(a) sort((a).rbegin(), (a).rend())
#define REVERSE(x) reverse(ALL(x))
#define MAX(x) *max_element(ALL(x))
#define MIN(x) *min_element(ALL(x))
#define SUM(x) accumulate(ALL(x), (ll)0)
#define COUNT(x, y) count(ALL(x), y);
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; }
// PRINT ------------------------------
#define COUT(a) cout << (a) << endl;
#define YES cout << "YES" << endl;
#define NO cout << "NO" << endl;
#define Yes cout << "Yes" << endl;
#define No cout << "No" << endl;
// DEBUG ------------------------------
#define LINE cerr << "[debug] line: " << __LINE__ << "\n";
#define debug(...) {debug_all(#__VA_ARGS__, __VA_ARGS__);}
template < typename T >
void _debug_print(T const& a) {cerr << a << ", ";}
template < typename... Args >
void debug_all(string s, Args... args) {
  cerr << "[debug] " << s << " = ";
  using swallow = std::initializer_list<int>;
  (void)swallow{ (void( _debug_print(args) ), 0)... };
  cerr << endl;
}
#define debugV(v) cerr << "[debugV] " << #v << ":"; REP(z, v.size()) cerr << " " << v[z]; cerr << "\n";
// CONST ------------------------------
constexpr ll INF = 0x3f3f3f3f3f3f3f3f;
constexpr ld PI = 3.141592653589793238462643383279; // or M_PI

//######################################################################
//#                         ここから下に書いていく                         #
//######################################################################

void Main() {
  ll n;
  cin >> n;

  vll a(n), b(n), c(n);
  REP(i, n) cin >> a[i];
  REP(i, n) cin >> b[i];
  REP(i, n) cin >> c[i];

  vll countb(n+1, 0);
  vll countc(n+1, 0);

  // REP(i, n) {
  //   countb[b[i]]++;
  // }
  REP(i, n) {
    countc[c[i]]++;
  }

  REP(i, n) {
    ll t = b[i];
    countb[t] += countc[i+1];
  }

  ll ans = 0;
  REP(i, n) {
    ll t = a[i];
    ans += countb[t];
  }

  COUT(ans);
}

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

/*

3 2
*/


#include <iostream>
using namespace std;

int main(void) {
	int N, A, B;

	cin >> N >> A >> B;
	N -= A;
	if (N < 0) {
		N = 0;
	}
	N += B;

	cout << N << endl;

	return 0;
}

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

#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
#define int long long

const int N = 2e5 + 5;

int32_t main()
{
	IOS;
	int a, b, n;
	cin >> n >> a >> b;
	cout << n - a + b;
	return 0;
}


#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <string>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <iomanip>
#include <utility>
#include <tuple>
#include <functional>
#include <bitset>
#include <cassert>
#include <complex>
#include <stdio.h>
#include <time.h>
#include <numeric>
#include <random>
#include <unordered_map>
#include <unordered_set>
#define all(a) a.begin(),a.end()
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define pb push_back
#define debug(x) cerr << __LINE__ << ' ' << #x << ':' << (x) << '\n'
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
using namespace std;
typedef long long ll;
typedef unsigned int uint;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<ll, ll> P;
typedef complex<ld> com;
template<class T> using prique = priority_queue<T, vector<T>, greater<T>>;
constexpr int inf = 1000000010;
constexpr ll INF = 1000000000000000010;
constexpr int mod1e9 = 1000000007;
constexpr int mod998 = 998244353;
constexpr ld eps = 1e-12;
constexpr ld pi = 3.141592653589793238;
constexpr ll ten(int n) { return n ? 10 * ten(n - 1) : 1; };
int dx[] = { 1,0,-1,0,1,1,-1,-1 }; int dy[] = { 0,1,0,-1,1,-1,1,-1 };
void fail() { cout << "-1\n"; exit(0); } void no() { cout << "No\n"; exit(0); }
template<class T, class U> inline bool chmax(T &a, const U &b) { if (a < b) { a = b; return true; } return false; }
template<class T, class U> inline bool chmin(T &a, const U &b) { if (a > b) { a = b; return true; } return false; }
template<class T> istream &operator >> (istream &s, vector<T> &v) { for (auto &e : v) s >> e; return s; }
template<class T> ostream &operator << (ostream &s, const vector<T> &v) { for (auto &e : v) s << e << ' '; return s; }

struct fastio {
	fastio() {
		cin.tie(0); cout.tie(0);
		ios::sync_with_stdio(false);
		cout << fixed << setprecision(20);
		cerr << fixed << setprecision(20);
	}
}fastio_;

int main() {
	vector<int> a(4);
	cin >> a;
	int s = accumulate(all(a), 0);
	rep(i, 16) {
		int k = 0;
		rep(j, 4) {
			if (i >> j & 1) k += a[j];
		}
		if (k * 2 == s) {
			cout << "Yes\n";
			return 0;
		}
	}
	cout << "No\n";
}

// Author:  param3435
#include <bits/stdc++.h>
#pragma GCC optimize ("-O2")
using namespace std;

#define LL                       long long
#define LD                       long double
#define divisor                  1000000007
#define INFP                     LLONG_MAX
#define INFN                     LLONG_MIN
#define pb                       push_back
#define pf                       push_front
#define pob                      pop_back
#define pof                      pop_front
#define mp                       make_pair
#define pLL                      pair<LL, LL>
#define loop(i,a,b)              for(LL i = a; i < b; i++)
#define loopd(i,a,b)             for(LL i = a; i > b; i--)
#define numberOfOnes(n)          __builtin_popcountll(n)
#define parity(n)                __builtin_parityll(n)                                  // = 1  when numberOfOnes(n) is odd
#define leadingZeros(n)          __builtin_clzll(n)
#define trailingZeros(n)         __builtin_ctzll(n)
#define gcd(first, second)       __gcd(first, second)
#define debug(x)                 cout << #x << " = " << x << '\n'
#define all(x)                   (x).begin(), (x).end()
#define sz(x)                    (LL)(x).size()
#define sum(x)                   (accumulate((x).begin(), (x).end(), 0LL))
#define minE(x)                  (*min_element((x).begin(), (x).end()))
#define maxE(x)                  (*max_element((x).begin(), (x).end()))
#define minI(x)                  ( min_element((x).begin(), (x).end()) - (x).begin())
#define maxI(x)                  ( max_element((x).begin(), (x).end()) - (x).begin())
#define lB(x, y)                 ( lower_bound((x).begin(), (x).end(), (y)) - (x).begin())
#define uB(x, y)                 ( upper_bound((x).begin(), (x).end(), (y)) - (x).begin())
#define FastIO                   ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)

template<typename T>             istream& operator>>(istream& is,  vector<T> &v) {for (auto& i : v) is >> i;        return is;}
template<typename T>             ostream& operator<<(ostream& os,  vector<T>  v) {for (auto& i : v) os << i << ' '; return os;}
template<typename T, typename U> istream& operator>>(istream& is, pair<T, U> &p) {is >> p.first >> p.second;        return is;}
template<typename T, typename U> ostream& operator<<(ostream& os, pair<T, U>  p) {os << p.first << ' ' << p.second; return os;}

bool sortbysec(const tuple<int, int, int>& a, const tuple<int, int, int>& b) {
	return (get<1>(a) < get<1>(b));
}

void solve() {
	LL N, Q, num = 1;
	cin >> N >> Q;
	vector<LL>A(N);
	vector<tuple<LL, LL, LL>> K;
	cin >> A;
	loop(i, 0, Q) {
		cin >> num;
		K.pb({num, i, 0});
	}
	sort(all(A));
	sort(all(K));
	/*loop(i, 0, Q) {
		cout << get<0>(K[i]) << ' ' << get<1>(K[i]) << ' ' << get<2>(K[i]) << '\n';
	}*/
	LL j = 0, c = get<0>(K[0]), r = 0;
	loop(i, 0, N) {
beg:
		if (c < A[i]) {
			get<2>(K[j]) = c;
			j++;
			if (j == Q) {
				break;
			}
			c = i  + get<0>(K[j]);
			goto beg;
		}
		else if (i == N - 1) {
			for (; j < Q; j++) {
				get<2>(K[j]) = N + get<0>(K[j]);
			}
			break;
		}
		else
			c++;

	}
	sort(K.begin(), K.end(), sortbysec);
	/*loop(i, 0, Q) {
		cout << get<0>(K[i]) << ' ' << get<1>(K[i]) << ' ' << get<2>(K[i]) << '\n';
	}*/
	loop(i, 0, Q) {
		cout << get<2>(K[i]) << '\n';
	}
	return;
}

int main() {

	FastIO;
	LL T = 1;
	// cin >> T;
	loop(i, 0, T - 1) {
		solve();
		cout << '\n';
	}
	solve();
	return 0;
}


#include<ctime>
#include<cstdio>
#include<cctype>
using namespace std;
const int N=2e5+10;
int read() {
	char c;
	int x=0,f=1;
	while(!isdigit(c=getchar()))
		f-=2*(c=='-');
	while (isdigit(c)){
		x=x*10+(c-48)*f;
		c=getchar();
	}
	return x;
}
char str[N],stack[N];
int n,f,o,res,top;
int main() {
	#ifndef ONLINE_JUDGE
	freopen("B.in","r",stdin);
	freopen("B.out","w",stdout);
	#endif
	clock_t t1=clock();
	//--------
	n=read();
	res=n;
	scanf("%s",str+1);
	for(int i=1;i<=n;++i){
		switch(str[i]){
			case 'f':
				++top;
				stack[top]='f';
				break;
			case 'o':
				++top;
				stack[top]='o';
				break;
			case 'x':
				if(top&&stack[top]=='o'&&stack[top-1]=='f'){
					stack[top]=0;
					--top;
					stack[top]=0;
					--top;
					res-=3;
				}
				else{
					while(top){
						stack[top]=0;
						--top;
					}
				}
				break;
			default:
				while(top){
					stack[top]=0;
					--top;
				}
				break;
		}
	}
	printf("%d",res);
	//--------
	clock_t t2=clock();
	fprintf(stderr,"time:%0.3lfs",1.0*(t2-t1)/CLOCKS_PER_SEC);
	return 0;
}

// https://atcoder.jp/contests/abc203/tasks/abc203_c
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) for (int i = (0); i < (n); ++i)
#define ALL(obj) (obj).begin(), (obj).end()
#define chmin(a, b) a = min(a, b)
#define chmax(a, b) a = max(a, b)
#define vi vector<int>
#define vvi vector<vi>
#define P pair<int, int>
#define DEBUG(val) cout << #val << " : " << val << endl
#define MOD 1000000007

int main() {
  ll n, k;
  cin >> n >> k;
  map<ll, ll> mp;
  REP(i, n) {
    ll a, b;
    cin >> a >> b;
    mp[a] += b;
  }
  ll ans = 0;
  for (auto [a, b] : mp) {
    if (a - ans > k) {
      ans += k;
      k = 0;
      break;
    } else {
      k -= (a - ans);
      ans = a;
      k += b;
    }
  }
  ans += k;
  cout << ans << endl;
}


#include <iostream>
#include <iomanip>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <vector>
#include <list>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <tuple>
#include <cstring>
#include <functional>
using namespace std;
typedef long long ll;
typedef pair<long long, long long> P;
#define rep(i, n) for(long long i=0; i<n; i++)
#define reps(i, s, e) for(long long i=s; i<e; i++)
#define repr(i, n) for(long long i=n-1; i>=0; i--)
#define reprs(i, s, e) for(long long i=e-1; i>=s; i--)

int main(){

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

    ll a, b; cin >> a >> b;

    ll aa, bb;

    aa = (a % 10) + ((a / 10) % 10) + a / 100;
    bb = (b % 10) + ((b / 10) % 10) + b / 100;

    if(aa >= bb){
        cout << aa << endl;
    }
    else{
        cout << bb << endl;
    }

    return 0;
}

#include<bits/stdc++.h>
using namespace std;
#define int long long
int a,b,k;
int gcd(int x,int y)
{
    if(y==0) return x;
    else return gcd(y,x%y);
}
void dfs(int n,int m,int x)
{
	if(n==0)
	{
		while(m--) cout<<'b';
		return ;
	}
	if(m==0)
	{
		while(n--) cout<<'a';
		return ;
	}
	int q=1,w,ci=n+m-1,hh=1,yue=max(n-1,m),shao=min(m,n-1);
	for(int i=yue+1,j=1;i<=ci;i++,j++)
	{
		if(j<=shao) hh*=j;
		q*=i;
		w=gcd(q,hh);
		q/=w;hh/=w;
	}
	if(q<x)
	{
		cout<<'b';
		dfs(n,m-1,x-q);
	}
	else
	{
		cout<<'a';
		dfs(n-1,m,x);
	}
}
signed main()
{
	scanf("%lld%lld%lld",&a,&b,&k);
	dfs(a,b,k);
	return 0;
}


#include <bits/stdc++.h>
#include <math.h>
using namespace std;
//マクロ
#define all(v) v.begin(), v.end()
#define rep(i, n) for (double i = 0; i < (int)(n); i++)
#define BIT(i, n) for (int i = 0; i < (1 << n); i++)

typedef long long ll;
//const ll INF = 10000000010;

int main() {
  int N;
  vector<double> x(100), y(100);
  cin >> N;
  rep(i, N) {
    cin >> x.at(i) >> y.at(i);
  }

  //cout << N << endl;
  //rep(i, N) cout << x.at(i) << y.at(i) << endl;

  rep(i, N - 2) {
    for(int j = i + 1; j < N - 1; j++) {
      for(int k = j + 1; k < N; k++) {
      	if(x.at(i) == x.at(j)) {
          //cout << "a" << endl;
          if(x.at(i) == x.at(k)) {
            goto yes;
            //cout << "A" << endl;
          }
          //else goto next;
        }
        else if(y.at(i) == y.at(j)) {
          //cout << "b" << endl;
          if(y.at(i) == y.at(k)) {
            goto yes;
            //cout << "B" << endl;
          }
          //else goto next;
        }
        else {
          if(y.at(k) == (y.at(i) - y.at(j)) / (x.at(i) - x.at(j)) * (x.at(k) - x.at(i)) + y.at(i)){
            //cout << "c" << endl;
            //cout<<x.at(i)<<" "<<y.at(i)<<" "<<x.at(j)<<" "<<y.at(j)<<" "<<x.at(k)<<" "<<y.at(k)<<endl;
            goto yes;
          }
        }
       // next:
        //int q = 0;
      }
    }
  }

  cout << "No" << endl;
  return 0;

  yes:
  cout << "Yes" << endl;
  return 0;
}

#include<bits/stdc++.h>
#define ll              long long int
#define ld              long double
#define ff              first
#define ss              second
#define mod             1000000007
#define ull             unsigned long long
#define vll             vector<ll>
#define uom             unordered_map
#define uos             unordered_set
#define pll             pair<ll, ll>
#define INF             9223372036854775807
#define w(t)            ll tests;    cin>>tests;        while(tests--)
#define endl            "\n"
#define pb(x)           push_back(x)
#define ppb()            pop_back()
#define all(x)          x.begin(), x.end()
#define mp(a, b)        make_pair(a, b)
#define setp(x, y)      fixed << setprecision(x) << y
#define f(i, a, b)      for(ll i = a ; i < b ; i++)
#define fo(j, a, b)     for(ll j = a ; j >= b ; j--)
#define fill(a, n, x)   f(i, 0, n)     a[i]=x;
using namespace std;

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

int main() {

    init();
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);

    ll n;
    cin >> n;

    ll k = 2;
    f(i, 3, n + 1)
    {
        k = k * i / __gcd(k, i);
    }

    cout << k + 1;

    return 0;
}


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

int main()
{
    ll n,i,x;
    ll c=0,d=0,p=0,q=0;
     cin>>n;
        n=(ll)pow(2,n);
        ll a[n];
        for(i=0;i<n;i++){
            cin>>x;
            a[i]=x;
            if(i<(n/2)){
                if(x>c){
                  p=i+1;
                  c=x;
                }
            }
            else{
                if(x>d){
                    d=x;
                    q=i+1;
                }
            }
        }

        if(a[p-1]>a[q-1]){
            cout<<q<<endl;
        }
        else{
            cout<<p<<endl;
        }

    return 0;
}

#include <iostream>
#include <algorithm>
#include <string>
#include <complex>
#include <vector>
#include <set>
#include <cmath>
#include <queue>
#include <map>
#include <stack>
#include <bitset>
#include <numeric> //lcm
#include <iomanip> //double精度 setprecision

#include <chrono>
#include <random>
#include <cassert>

//#include <atcoder/all>

using namespace std;
//using namespace atcoder;

#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = (n)-1; i >= 0; --i)
#define rep1(i,n) for(int i = 1; i <= (n); ++i)
#define rrep1(i,n) for(int i = (n); i >= 1; --i)
#define REP(i,n,m) for(int i = (n); i < (m); ++i)
#define all(vec) (vec).begin(),(vec).end()

#define debug(a) { cerr << #a << " = " << a << endl;}
#define debugV(vec) { cerr << #vec << " : "; for(auto v : vec) cerr << v << " "; cerr << endl; }
#define debug2D(vec2D, w) { cerr << #vec2D << endl;  for(auto vec : vec2D) { for (auto v : vec) cerr << setw(w) << v << " "; cerr << endl; } }
#define debugVP(vec) { cerr << #vec << " : ";  for(auto v : vec) cerr << "(" << v.first << "," << v.second << ") "; cerr << endl;}
#define debug2DP(vec2D) { cerr << #vec2D << endl;  for(auto vec : vec2D) { for (auto v : vec) cerr << "(" << v.first << "," << v.second << ") "; cerr << endl; } }

typedef long long ll;

constexpr ll INF = 1e14; //32 ~2*10^10 //64 ~9*10^19
//constexpr ll MOD = 998244353;
constexpr ll MOD = 1000000007;
const double EPS = round(1e-6);
const char en = '\n';

/*
struct Edge {
	Edge(int _s, int _t, ll _cost = 1) : from(_s), to(_t), cost(_cost) {};
	int from, to;
	ll cost;
	//ll fee;
};
*/
//typedef ll Edge;7
struct Edge {
	int id ;
	int from, to;

	Edge() {id = from = to = -1;};
	Edge(int a, int b , int c) : id(a), from(b), to(c) {};
};
typedef vector<vector<Edge>> Graph;
/*
void add_edge(Graph& g, int from, int to, ll cost = 1) {
	g[from].push_back(Edge(from, to, cost));
}
*/
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } else return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } else return false; }

void solve() {
  ll n; cin >> n;
	ll m = round(pow(2, n));
	vector<pair<int,ll>> a(m);

	rep(i, m) {
		int ai; cin >> ai;
		a[i] = {i, ai};
	}

	rep1(i,n) {

		if (i == n) {
			if (a[0].second < a[1].second) {
				cout << a[0].first+1 << endl;
			}
			else {
				cout << a[1].first + 1 << endl;
			}
		}
		m /= 2;
	  rep(j, m) {
			if (a[2 * j].second < a[2 * j + 1].second) {
				a[j] = a[2 * j + 1];
			}
			else {
				a[j] = a[2 * j];
			}
	  }
	}
}

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

	//rep(i,3)
	solve();

}


#define DEBUG 0

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

#if DEBUG
// basic debugging macros
int __i__,__j__;
#define printLine(l) for(__i__=0;__i__<l;__i__++){cout<<"-";}cout<<endl
#define printLine2(l,c) for(__i__=0;__i__<l;__i__++){cout<<c;}cout<<endl
#define printVar(n) cout<<#n<<": "<<n<<endl
#define printArr(a,l) cout<<#a<<": ";for(__i__=0;__i__<l;__i__++){cout<<a[__i__]<<" ";}cout<<endl
#define print2dArr(a,r,c) cout<<#a<<":\n";for(__i__=0;__i__<r;__i__++){for(__j__=0;__j__<c;__j__++){cout<<a[__i__][__j__]<<" ";}cout<<endl;}
#define print2dArr2(a,r,c,l) cout<<#a<<":\n";for(__i__=0;__i__<r;__i__++){for(__j__=0;__j__<c;__j__++){cout<<setw(l)<<setfill(' ')<<a[__i__][__j__]<<" ";}cout<<endl;}

// advanced debugging class
// debug 1,2,'A',"test";
class _Debug {
    public:
        template<typename T>
        _Debug& operator,(T val) {
            cout << val << endl;
            return *this;
        }
};
#define debug _Debug(),
#else
#define printLine(l)
#define printLine2(l,c)
#define printVar(n)
#define printArr(a,l)
#define print2dArr(a,r,c)
#define print2dArr2(a,r,c,l)
#define debug
#endif

// define
#define MAX_VAL 999999999
#define MAX_VAL_2 999999999999999999LL
#define EPS 1e-6
#define mp make_pair
#define pb push_back

// typedef
typedef unsigned int UI;
typedef long long int LLI;
typedef unsigned long long int ULLI;
typedef unsigned short int US;
typedef pair<int,int> pii;
typedef pair<LLI,LLI> plli;
typedef vector<int> vi;
typedef vector<LLI> vlli;
typedef vector<pii> vpii;
typedef vector<plli> vplli;

// ---------- END OF TEMPLATE ----------
#define MOD 1000000007

int dp[1001];
int main() {
    int N;
    char aa,ab,ba,bb;
    cin >> N >> aa >> ab >> ba >> bb;
    if (N == 2) {
        cout << 1 << endl;
        return 0;
    }

    if (ab == 'B') {
        if (bb == 'B') {
            cout << 1 << endl;
            return 0;
        }
        else if (ba == 'A') {
            int i,p = 1;
            for (i = 0; i < N-3; i++) p *= 2,p %= MOD;
            cout << p << endl;
        }
        else {
            int i;
            dp[0] = dp[1] = 1;
            for (i = 2; i <= N; i++) {
                dp[i] = dp[i-2]+dp[i-1];
                dp[i] %= MOD;
            }
            cout << dp[N-2] << endl;
        }
    }
    else {
        if (aa == 'A') {
            cout << 1 << endl;
            return 0;
        }
        else if (ba == 'B') {
            int i,p = 1;
            for (i = 0; i < N-3; i++) p *= 2,p %= MOD;
            cout << p << endl;
        }
        else {
            int i;
            dp[0] = dp[1] = 1;
            for (i = 2; i <= N; i++) {
                dp[i] = dp[i-2]+dp[i-1];
                dp[i] %= MOD;
            }
            cout << dp[N-2] << endl;
        }
    }

    return 0;
}

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int mod=1e9+7;
int n;
char aa,ab,ba,bb;

int main() {
	scanf("%d",&n);
	scanf(" %c",&aa);
	scanf(" %c",&ab);
	scanf(" %c",&ba);
	scanf(" %c",&bb);
	if(n==1 || n==2 || (aa=='A' && bb=='B') || (aa=='A' && ab=='A') || (ab=='B' && bb=='B')) {
		printf("1");
		return 0;
	}
	ll ans=1;
	if(ab!=ba) {
		for(int i=3;i<n;i++) {
			ans=(ans*2)%mod;
		}
	}else {
		ll prev=1;
		for(int i=3;i<n;i++) {
			ll tmp=(ans+prev)%mod;
			prev=ans;
			ans=tmp;
		}
	}
	printf("%lld",ans);
	return 0;
}


#include "bits/stdc++.h"

using namespace std;

using ll = long long;
using pii = pair <int, int>;
using pll = pair <ll, ll>;

#define FIO() ios_base::sync_with_stdio(0);cin.tie(NULL);

const ll inf = 9e18;

int main() {
    FIO();

    string atc = "atcoder";

    int tc; cin >> tc;
    while (tc--) {
        string s; cin >> s;
        ll ans = inf;
        ll temp = 0;

        int m = min(atc.size(), s.size());
        int n = s.size();

        bool ok = true;
        for (int i = 0; i < m; i++) {
            if (s[i] > atc[i]) {
                ans = min(ans, temp);
                break;
            }

            for (int j = i + 1; j < n; j++) {
                if (s[j] > atc[i]) {
                    ans = min(ans, temp + j - i);
                    break;
                }
            }

            bool fnd = false;
            for (int j = i; j < n; j++) {
                if (s[j] != atc[i]) continue;

                fnd = true;
                while (s[i] != atc[i]) {
                    swap(s[j], s[j - 1]);
                    j--;
                    temp++;
                }

                break;
            }

            if (!fnd) {
                ok = false;
                break;
            }
        }

        if (ok and m < s.size()) ans = min(ans, temp);

        if (ans == inf) ans = -1;
        cout << ans << '\n';
    }
}

#include <bits/stdc++.h>
using namespace std;
#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
  enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef DEBBY
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
  ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
  *this << "[";
  for (auto it = d.b; it != d.e; ++it)
      *this << ", " + 2 * (it == d.b) << *it;
  ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "

#define ll long long
#define print_mat(i,j,a,b,v) for(int i=0;i<a;i++){for(int j=0;j<b;j++)cerr<<v[i][j] << " "; cerr<<endl;}
#define sz(v)  (int)(v).size()
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define pi pair<int,int>
#define vi vector<int>
#define vll vector<ll>
#define vvi vector<vi>
#define vpi vector<pi>
#define pq priority_queue<int>
#define pqg priority_queue<int, vi, greater<int> >
#define fs first
#define sd second
#define pb push_back
#define eb emplace_back

#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)
///////////////////////////////////////
// READING
template<class A> void read(vector<A>& v);
template<class A, size_t S> void read(array<A, S>& a);
template<class T> void read(T& x) {
	cin >> x;
}
void read(double& d) {
	string t;
	read(t);
	d=stod(t);
}
void read(long double& d) {
	string t;
	read(t);
	d=stold(t);
}
template<class H, class... T> void read(H& h, T&... t) {
	read(h);
	read(t...);
}
template<class A> void read(vector<A>& x) {
	EACH(a, x)
		read(a);
}
template<class A, size_t S> void read(array<A, S>& x) {
	EACH(a, x)
		read(a);
}
////////////////////////////////
// PRINTING
string to_string(char c) {
	return string(1, c);
}
string to_string(bool b) {
	return b?"true":"false";
}
string to_string(const char* s) {
	return string(s);
}
string to_string(string s) {
	return s;
}
string to_string(vector<bool> v) {
	string res;
	FOR(sz(v))
		res+=char('0'+v[i]);
	return res;
}

template<size_t S> string to_string(bitset<S> b) {
	string res;
	FOR(S)
		res+=char('0'+b[i]);
	return res;
}
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);
}
template<class H, class... T> void write(const H& h, const T&... t) {
	write(h);
	write(t...);
}
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...);
}
////////////////////////////////
// START PROGRAM
///////////////////////////////

void solve(){
    int n;
    read(n);

    if(n & 1)
      print("Black");
    else
      print("White");

}

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

    solve();

    return 0;
}


#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define repp(i, st, en) for (ll i = (ll)st; i < (ll)(en); i++)
#define repm(i, st, en) for (ll i = (ll)st; i >= (ll)(en); i--)
#define all(v) v.begin(), v.end()
void chmax(ll &x, ll y) {x = max(x,y);}
void chmin(ll &x, ll y) {x = min(x,y);}
void Yes() {cout << "Yes" << endl; exit(0);}
void No() {cout << "No" << endl; exit(0);}
template<class in_Cout> void Cout(in_Cout x) {cout << x << endl; exit(0);}
template<class in_vec_cout>
void vec_cout(vector<in_vec_cout> vec) {
    for (in_vec_cout res : vec) {cout << res << " ";}
    cout << endl;
}

const ll inf = 1e18;
const ll mod = 1e9 + 7;

int main() {
    ll N, M; cin >> N >> M;
    ll L = 1 << N;
    vector<vector<ll>> vec(N,vector<ll>(N,inf));
    rep(i,M) {
        ll x, y, z; cin >> x >> y >> z;
        x--; y--;
        chmin(vec[x][y],z);
    }

    vector<ll> bitcnt(L);
    rep(bit,L) {
        ll cnt = 0;
        rep(i,N) if ((bit>>i)&1) cnt++;
        bitcnt[bit] = cnt;
    }

    vector<vector<ll>> dp(N+1,vector<ll>(L));
    dp[0][0] = 1;
    rep(i,N) {
        rep(bit,L) {
            ll cnt = bitcnt[bit];
            if (cnt!=i) continue;
            rep(j,N) {
                if ((bit>>j)&1) continue;
                ll nbit = bit | (1<<j);
                ll ncnt = 0;
                bool OK = true;
                rep(k,N) {
                    if ((nbit>>k)&1) ncnt++;
                    if (ncnt>vec[i][k]) {
                        OK = false;
                        break;
                    }
                }
                if (OK) dp[i+1][nbit] += dp[i][bit];
            }
        }
    }

    ll ans = dp[N][L-1];

    cout << ans << endl;
}

#include <bits/stdc++.h>
using namespace std;
int main(){
  int N, M;
  cin >> N >> M;
  vector<int> X(M), Y(M), Z(M);
  for (int i = 0; i < M; i++){
    cin >> X[i] >> Y[i] >> Z[i];
  }
  vector<long long> dp(1 << N, 0);
  dp[0] = 1;
  for (int i = 0; i < (1 << N); i++){
    int c = __builtin_popcount(i);
    for (int j = 0; j < M; j++){
      if (X[j] == c){
        int t  = i & ((1 << Y[j]) - 1);
        if (__builtin_popcount(t) > Z[j]){
          dp[i] = 0;
          break;
        }
      }
    }
    for (int j = 0; j < N; j++){
      if ((i >> j & 1) == 0){
        dp[i | (1 << j)] += dp[i];
      }
    }
  }
  cout << dp[(1 << N) - 1] << endl;
}


//#define _GLIBCXX_DEBUG
//#include "atcoder/all"
//using namespace atcoder;
#include <bits/stdc++.h>
#define int long long
#define ll long long
using ull = unsigned long long;
using namespace std;
#define Dump(x)                             \
    if (dbg) {                              \
        cerr << #x << " = " << (x) << endl; \
    }
#define overload4(_1, _2, _3, _4, name, ...) name
#define FOR1(n) for (ll i = 0; i < (n); ++i)
#define FOR2(i, n) for (ll i = 0; i < (n); ++i)
#define FOR3(i, a, b) for (ll i = (a); i < (b); ++i)
#define FOR4(i, a, b, c) for (ll i = (a); i < (b); i += (c))
#define FOR(...) overload4(__VA_ARGS__, FOR4, FOR3, FOR2, FOR1)(__VA_ARGS__)
#define FORR(i, a, b) for (int i = (a); i <= (b); ++i)
#define bit(n, k) (((n) >> (k)) & 1) /*nのk bit目*/
namespace mydef {
const int INF = 1ll << 60;
const int MOD = 1e9 + 7;
template <class T>
bool chmin(T& a, const T& b) {
    if (a > b) {
        a = b;
        return 1;
    } else
        return 0;
}
template <class T>
bool chmax(T& a, const T& b) {
    if (a < b) {
        a = b;
        return 1;
    } else
        return 0;
}
void Yes(bool flag = true) {
    if (flag)
        cout << "Yes" << endl;
    else
        cout << "No" << endl;
}
void No(bool flag = true) {
    Yes(!flag);
}
void YES(bool flag = true) {
    if (flag)
        cout << "YES" << endl;
    else
        cout << "NO" << endl;
}
void NO(bool flag = true) {
    YES(!flag);
}
template <typename A, size_t N, typename T>
void Fill(A (&array)[N], const T& val) {
    std::fill((T*)array, (T*)(array + N), val);
}
bool dbg = true;
}  // namespace mydef
using namespace mydef;
#define pb push_back
//#define mp make_pair
#define eb emplace_back
#define lb lower_bound
#define ub upper_bound
#define all(v) (v).begin(), (v).end()
#define SZ(x) ((int)(x).size())
#define vi vector<int>
#define vvi vector<vector<int>>
#define vp vector<pair<int, int>>
#define vvp vector<vector<pair<int, int>>>
#define pi pair<int, int>
//#define P pair<int, int>
//#define V vector<int>
//#define S set<int>
#define asn ans

int N, M;
string S[101010];
int cnt[10];
vi A;

void solve() {
}

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

    cin >> N >> M;
    A.resize(N);
    for (int i = 0; i < N; i++) {
        cin >> S[i];
        int tmp = 0;
        for (int j = 0; j < M; j++) {
            if (S[i][j] == '1')
                tmp++;
        }
        cnt[tmp % 2]++;
    }
    cout << cnt[0] * cnt[1] << endl;

    solve();
    return 0;
}

#include<bits/stdc++.h>
#define rep(i,a,b) for(ll i=(a);i<=(b);i++)
#define per(i,a,b) for(ll i=(a);i>=(b);i--)
#define lc(x) (x<<1)
#define rc(x) (lc(x)|1)
#define lowbit(x) (x&-x)
#define Max(a,b) (a>b?a:b)
#define Min(a,b) (a<b?a:b)
#define next Cry_For_theMoon
#define il inline
#define pb(x) push_back(x)
#define mapit map<int,int>::iterator
#define vit vector<int>::iterator
#define mp(x,y) make_pair(x,y)
typedef long long ll;
typedef unsigned long long ull;
typedef unsigned int uint;
typedef double db;
using namespace std;
const int MAXN=1e5+10,MAXM=2e6+10,LIM=1<<20;
ll n,m,t[MAXM],tot1,tot2,ans;
char ch;
int main(){
	cin>>n>>m;
	rep(i,1,n){
		int sum=0;
		rep(j,1,m){
			cin>>ch;
			sum<<=1;
			sum+=(ch=='1');
		}
		t[sum]++;
	}
	ans=n*(n-1)/2;
	rep(i,0,(1<<m)-1){
		int cnt=0,tmp=i;
		while(tmp){
			cnt+=tmp&1;
			tmp>>=1;
		}
		if(cnt&1)tot1+=t[i];
		else tot2+=t[i];
	}
	ans-=tot1*(tot1-1)/2;
	ans-=tot2*(tot2-1)/2;

	cout<<ans;
	return 0;
}


#include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <cfloat>
#include <climits>
#include <cmath>
#include <cstdio>
#include <deque>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <unordered_set>
#include <vector>
using namespace std;
typedef long double ld;
typedef long long int ll;
typedef unsigned long long int ull;
typedef vector<int> vi;
typedef vector<char> vc;
typedef vector<bool> vb;
typedef vector<double> vd;
typedef vector<string> vs;
typedef vector<ll> vll;
typedef vector<pair<int, int>> vpii;
typedef vector<pair<ll, ll>> vpll;
typedef vector<vi> vvi;
typedef vector<vvi> vvvi;
typedef vector<vc> vvc;
typedef vector<vs> vvs;
typedef vector<vll> vvll;
typedef map<int, int> mii;
typedef set<int> si;
#define rep(i, n) for (ll i = 0; i < (n); ++i)
#define rrep(i, n) for (int i = 1; i <= (n); ++i)
#define irep(it, stl) for (auto it = stl.begin(); it != stl.end(); it++)
#define drep(i, n) for (int i = (n)-1; i >= 0; --i)
#define fin(ans) cout << (ans) << '\n'
#define STLL(s) strtoll(s.c_str(), NULL, 10)
#define mp(p, q) make_pair(p, q)
#define pb(n) push_back(n)
#define all(a) a.begin(), a.end()
#define Sort(a) sort(a.begin(), a.end())
#define Rort(a) sort(a.rbegin(), a.rend())
#define fi first
#define se second
// #include <atcoder/all>
// using namespace atcoder;
constexpr int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
constexpr int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
template <class T, class U>
inline bool chmax(T& a, U b) {
    if (a < b) {
        a = b;
        return 1;
    }
    return 0;
}
template <class T, class U>
inline bool chmin(T& a, U b) {
    if (a > b) {
        a = b;
        return 1;
    }
    return 0;
}
template <class T>
inline void dump(T& v) {
    irep(i, v) { cout << (*i) << ((i == --v.end()) ? '\n' : ' '); }
}
template <class T, class U>
inline void dump(map<T, U>& v) {
    irep(i, v) { cout << i->first << " " << i->second << '\n'; }
}
template <class T, class U>
inline void dump(pair<T, U>& p) {
    cout << p.first << " " << p.second << '\n';
}
string getline() {
    string s;
    fflush(stdin);
    getline(cin, s);
    return s;
}
inline void yn(const bool b) { b ? fin("yes") : fin("no"); }
inline void Yn(const bool b) { b ? fin("Yes") : fin("No"); }
inline void YN(const bool b) { b ? fin("YES") : fin("NO"); }
template <typename Head, typename Value>
auto vectors(const Head& head, const Value& v) {
    return vector<Value>(head, v);
}
template <typename Head, typename... Tail>
auto vectors(Head x, Tail... tail) {
    auto inner = vectors(tail...);
    return vector<decltype(inner)>(x, inner);
}
const int INF = INT_MAX;
constexpr ll LLINF = 1LL << 61;
constexpr ll MOD = 1000000007;  // 998244353;
constexpr ld EPS = 1e-11;

/* --------------------   ここまでテンプレ   -------------------- */

int main() {
    string s,t;
    cin>>s>>t;
    fin(max((s[0]-'0')+(s[1]-'0')+(s[2]-'0'),(t[0]-'0')+(t[1]-'0')+(t[2]-'0')));
}

#include<iostream>
#include<iomanip>
#include<string>
#include<vector>
#include<algorithm>
#include<utility>
#include<tuple>
#include<map>
#include<queue>
#include<deque>
#include<set>
#include<stack>
#include<numeric>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>

using namespace std;

struct Edge {
  int to;
  long long weight;
  Edge() : to(0), weight(0) {}
  Edge(int to, long long weight) : to(to), weight(weight) {}
  Edge(const Edge& e) {
    to = e.to;
    weight = e.weight;
  }
  bool operator>(const Edge &e) const { return weight > e.weight; }
  bool operator<(const Edge &e) const { return weight < e.weight; }
  bool operator==(const Edge &e) const { return weight == e.weight; }
  bool operator<=(const Edge &e) const { return weight <= e.weight; }
  bool operator>=(const Edge &e) const { return weight >= e.weight; }
};

using ll = long long;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using Graph = vector<vector<int>>;
using weightedGraph = vector<vector<Edge>>;
using heap = priority_queue<int, vector<int>, greater<int>>;

const ll BIL = 1e9;
const ll MOD = 1e9 + 7;
const ll INF = 1LL << 60;
const int inf = 1 << 29;
const ld PI = 3.141592653589793238462643383;

struct SegmentTree {
  int sz;
  vector<int> t;
  SegmentTree(int n) {
    sz = 1;
    while(sz < n) sz *= 2;
    t.assign(2 * sz - 1, 0);
  }
  void init(int idx, ll val) {
    idx += sz-1;
    t[idx] = val;
    return;
  }
  // update the maximum value of the interval
  void update(int idx, int val) {
    idx += sz - 1;
    t[idx] = val;
    while(idx > 0) {
      idx = (idx - 1) / 2;
      if(t[idx] > val) break;
      t[idx] = val;
    }
    return;
  }
  // update the sum of the interval
  void update(int l, int r, ll val, int now=0, int a=0, int b=-1) {
    if(now >= t.size()) return;
    if(b < 0) b = sz;
    if(l < 0) l = 0;
    if(r > sz) r = sz;
    if(r < a || l > b) return;
    if(a <= l && r <= b) {
      t[now] += val;
      update(l, r, val, now*2+1, a, (a+b)/2);
      update(l, r, val, now*2+2, (a+b)/2, b);
    }
    return;
  }
  // get the sum of interval
  int getSum(int l, int r, int now=0, int a=0, int b=-1) {
    if(now >= t.size()) return 0;
    if(b < 0) b = sz;
    if(l < 0) l = 0;
    if(r > sz) r = sz;
    if(l > b || r < a) return 0;
    if(l <= a && r >= b) return t[now];
    int res = 0;
    res += getSum(l, r, 2*now+1, a, (a+b)/2);
    res += getSum(l, r, 2*now+2, (a+b)/2, b);
    return res;
  }
  // get the maximum value of the interval
  int getMax(int l, int r, int now=0, int a=0, int b=-1) {
    if(now >= t.size()) return 0;
    if(b < 0) b = sz;
    if(l < 0) l = 0;
    if(r > sz) r = sz;
    if(l > b || r < a) return 0;
    if(l <= a && r >= b) return t[now];
    int res = 0;
    res = max(res, getMax(l, r, 2*now+1, a, (a+b)/2));
    res = max(res, getMax(l, r, 2*now+2, (a+b)/2, b));
    return res;
  }
  ll getElement(int idx) {
    if(idx == 0) return t[0];
    ll res = t[idx];
    return res += getElement((idx-1)/2);
  }
  ll operator[](int idx) {
    idx += sz-1;
    return getElement(idx);
  }
};

int main(int argc,char* argv[]){
  cin.tie(0);
  ios::sync_with_stdio(0);
  cout << fixed << setprecision(20);
  int h, w;
  cin >> h >> w;
  vector<string> s(h);
  for(int i=0;i<h;i++) {
    cin >> s[i];
  }
  int ans = 0;
  for(int i=0;i<h-1;i++) {
    for(int j=0;j<w-1;j++) {
      int t = 0;
      for(int k=0;k<2;k++) {
        for(int l=0;l<2;l++) {
          if(s[i+k][j+l] == '#') t++;
        }
      }
      if(t == 1 || t == 3) ans++;
    }
  }
  cout << ans << endl;
  return 0;
}


#include <bits/stdc++.h>

#define E (edges[i])

using namespace std;

const int MAXN = 1e5 + 10;

struct Edge{ int to, next; } edges[MAXN << 1]; int head[MAXN], ecnt = 0;
void add_edge(int x, int y) { ecnt++; edges[ecnt].to = y, edges[ecnt].next = head[x]; head[x] = ecnt; }

int n, col[MAXN]; bool m[MAXN];
priority_queue<int> res;

void dfs(int x, int fa)
{
	for (int i = head[x]; i; i = E.next)
	{
		if (E.to == fa) continue;
		bool f = m[col[E.to]]; if (!f) res.push(-E.to);
		m[col[E.to]] = true; dfs(E.to, x); m[col[E.to]] = f;
	}
}

int main()
{
	scanf("%d", &n);
	for (int i = 1; i <= n; i++) scanf("%d", col + i);
	for (int i = 1, x, y; i < n; i++) scanf("%d%d", &x, &y), add_edge(x, y), add_edge(y, x);
	res.push(-1), m[col[1]] = 1;
	dfs(1, 0);
	while (res.size()) printf("%d\n", -res.top()), res.pop();
}

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

vector<int>c;
vector<vector<int>>to;
vector<int>cnt;
vector<int>ans;

void dfs(int v, int p = -1) {//デフォルト引数-1
	if (cnt[c[v]] == 0) ans.push_back(v+1);
	cnt[c[v]]++;
	for (int u : to[v]) {
		if (u == p) continue;//親を探索対象にしないようにする
		dfs(u, v);
	}
	cnt[c[v]]--;
}

int main() {
	int n;
	cin >> n;
	c = vector<int>(n);
	rep(i, n) cin >> c[i];
	to.resize(n);
	rep(i, n - 1) {
		int a, b;
		cin >> a >> b;
		a--;
		b--;
		to[a].push_back(b);
		to[b].push_back(a);
	}
	cnt = vector<int>(100010);
	dfs(0);
	sort(ans.begin(), ans.end());
	for (int v : ans) cout << v << endl;
}


#include <iostream>
#include <string>
using namespace std;
#include <algorithm>
#include <vector>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>
#include <iomanip>
#include <set>
#include <map>
#include <cassert>
#define MOD1 1000000007
#define MOD2 998244353
#define LIMIT1 200010
#define LIMIT2 500010
#define LIMIT3 1000010
#define INF ((1<<30)-1)
#define LLINF (1LL<<60)
#define EPS (1e-10)
typedef long long ll;
typedef long double ld;
typedef const void cv;
typedef pair<ll,ll> P;
#define rep(i,n) for((i)=0;(i)<(n);(i)++)
#define per(i,n) for((i)=(n)-1;(i)>=0;(i)--)
#define ALL(a) (a).begin(),(a).end()
#define ALL2(a, n) (a),(a)+(n)
template<class T,class C> T max(T a,C b){ return std::max(a, (T)b); }
template<class T,class C> T min(T a,C b){ return std::min(a, (T)b); }
#define zt(a,b) (max((a),(b))-min((a),(b)))
#define setpre(n) fixed << setprecision(n)
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;}
int dx[8]={1,0,-1,0,1,-1,-1,1},dy[8]={0,1,0,-1,1,1,-1,-1};
ll modpow(ll a, ll n, ll mod) {
  ll res = 1;
  while (n > 0) {
    if (n & 1){
      res *= a; if(mod>=1) res %= mod;
    }
    a *= a; if(mod>=1) a %= mod;
    n >>= 1;
  }
  return res;
}
void initialize(){

}
struct FenwickTree{
  vector<ll> bit;
  int n;
  //1-indexed BIT
  FenwickTree(int size = 200010){
    init(size);
  }
  void init(int size){
    n = size;
    bit.resize(size);
    for(int i=0;i<size;i++) bit[i]=0;
  }
  ll sum(int i){
    ll s=0;
    while(i>0){
      s += bit[i];
      i -= i&(-i);
    }
    return s;
  }
  void add(int i,ll x){
    while(i<=n){
      bit[i] += x;
      i += i&(-i);
    }
  }
  void set(int i,ll x){
    ll y = rangesum(i,i);
    x -= y;
    add(i,x);
  }
  ll rangesum(int l,int r){
    return sum(r)-sum(l-1);
  }
  int lower_bound(ll w) { // a_1 + a_2 + ... + a_x >= w となるような最小の x を求める(ただし a_i >= 0)
    if (w <= 0) {
      return 0;
    } else {
      int x = 0, r = 1;
      while (r < n) r = r << 1;
      for (int len = r; len > 0; len = len >> 1) { // 長さlenは1段下るごとに半分に
        if (x + len < n && bit[x + len] < w) { // 採用するとき
          w -= bit[x + len];
          x += len;
        }
      }
      return x + 1;
    }
  }

  int getSize(){
    return n;
  }
  ll &operator[](int k){
    static ll res;
    res = rangesum(k,k);
    return res;
  }
};

int main(void){
  initialize();
  ll n,m,i,j,k,result=0;
  int a[LIMIT2]={0};
  string s;

  cin >> n;
  FenwickTree bit(n+1);
  rep(i,n){
    cin >> a[i];
  }
  per(i,n){
    result += bit.sum(a[i]+1);
    bit.add(a[i]+1,1);
  }
  rep(i,n){
    cout << result << '\n';

    bit.add(a[i]+1,-1);
    result -= bit.rangesum(1,a[i]+1);
    result += bit.rangesum(a[i]+1,n);
    bit.add(a[i]+1,1);
  }

  return 0;
}

#include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>
#define IO(i, o) freopen(i, "r", stdin), freopen(o, "w", stdout)
using namespace __gnu_pbds;
using namespace std;
using ld = long double;
using ll = long long;
using indexed_set = tree<int, null_type, greater<int>, rb_tree_tag, tree_order_statistics_node_update>;

int n;

int main(){
    //IO("input.txt", "output.txt");
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cin >> n;
    deque<int> a;
    indexed_set pre;
    ll ans = 0;
    for(int i = 0; i < n; i++){
        int val;
        cin >> val;
        a.push_back(val);
        ans += pre.order_of_key(val);
        pre.insert(val);
    }
    int beg = a[0];
    cout << ans << '\n';
    do{
        int val = a.front();
        ans -= val, ans += (n - 1 - val);
        a.pop_front(), a.push_back(val);
        if(a.front() != beg) cout << ans << '\n';
    }while(a.front() != beg);
    return 0;
}


#include <bits/stdc++.h>

#define INF 1000000007
#define F first
#define S second
#define PB push_back
#define MP make_pair
#define REP(i,a,b) for (int i = a; i < b; i++)

using namespace std;

typedef long long ll;
typedef long long int  lli;
typedef long double ld;
typedef vector<int> vi;
typedef unordered_map<int,int> umi ;
typedef unordered_set<int> usi ;
typedef pair<int,int> pi;

struct custom_hash {
    static uint64_t splitmix64(uint64_t x) {
        // http://xorshift.di.unimi.it/splitmix64.c
        x += 0x9e3779b97f4a7c15;
        x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
        x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
        return x ^ (x >> 31);
    }

    size_t operator()(uint64_t x) const {
        static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
        return splitmix64(x + FIXED_RANDOM);
    }
};

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

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

//declare here -------------------------------------------------------------------------------
const int N =3e3+1 ;
ll dp[N][N] ;
ll md =998244353 ;
ll ways(int  k, int n){
    if(k==0 && n==0) return 1;
    if(k<=0 || n<=0) return 0;
    if(k>n) return 0 ;
    if(k==n) return 1;
    if(dp[k][n]!=-1) return dp[k][n] ;
    int res=0 ;
    res+=ways(k-1,n-1)%md ;
    res+=ways(2*k ,n)%md ;
    dp[k][n]=res%md;
    return res%md ;
}

// solve here ---------------------------------------------------------------------------------
void solve(){
    int n ,k ;
    memset(dp,-1 ,sizeof(dp)) ;
    cin>>n>>k ;
    cout<<ways(k,n) ;
}

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

int main(){
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif
    ios::sync_with_stdio(0);
    cin.tie(0);
    long long test =1 ;
    //cin>>test ;
    REP(i,1,test+1){
        debug(i) ;
        //cout<<"Case #"<<i<<": " ;
        solve() ;
        cout<<"\n" ;
    }
    return 0 ;
}

#include<bits/stdc++.h>
using namespace std;
const int maxn=6010,mod=998244353;
int dp[maxn][maxn];
int n,K;
int main(){
	cin>>n>>K;
	dp[0][0]=1;
	for(int i=1;i<=n;++i)
		for(int j=i;j>0;--j){
			dp[i][j]=(dp[i-1][j-1]+dp[i][2*j])%mod;
		}
	printf("%d\n",dp[n][K]);
}


#include <math.h>
#include <iostream>
#include <string>
#include <iomanip>
#include <algorithm>
#include <tuple>
#include <vector>
#include <cmath>
#include<set>
#include <sstream>
#include <bitset>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define ALL(a)  (a).begin(),(a).end()//配列を全部参照

using namespace std;
using ll = long long int;
using Graph = vector<vector<int>>; // グラフ型
//cin.tie(nullptr); /*高速で入力可能*/
//vector<vector<int>> hako(n, vector<int>(2));
//sort(hako.begin(), hako.end(), [](const vector<int>& alpha, const vector<int>& beta) {return alpha[0] < beta[0]; });

int main() {
	cin.tie(nullptr);
	ll n;
	string s,t;
	ll ans = 0;
	cin >> n;
	vector<int> hako(n);
	vector<int> a(n);
	vector<int> b(n);
	vector<int> c(n);
	rep(i, n) cin >> a[i];
	rep(i, n) cin >> b[i];
	rep(i, n) cin >> c[i];
	sort(ALL(a));
	rep(i, n) hako[i] = b[c[i] - 1];
	sort(ALL(hako));

	int now = 0;
	rep(i, n) {
		if (i > 0) {
			if (a[i - 1] == a[i]) ans += now;
			else {
				now = 0;
				rep(j, n) {
					if (a[i] == hako[j]) ans++, now++;
					else if (a[i] < hako[j])break;
				}
			}
		}
		else {
			now = 0;
			rep(j, n) {
				if (a[i] == hako[j]) ans++, now++;
				else if(a[i] < hako[j])break;
			}
		}

	}

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

#include<bits/stdc++.h>
#define int long long
#define vll vector<long long>
#define forn(i,n) for(int i=0;i<n;i++)
#define rforn(i,n) for(int i=n-1;i>=0;i--)
#define rep(i,s,n) for(int i=s;i<n;i++)
#define sa(v) sort(v.begin(), v.end())
#define sd(v) sort(v.begin(),v.end(), greater<int>())
#define ff first
#define ss second
#define cl(a,b) (a+b-1)/b
#define gcd(a,b) __gcd(a,b)
#define lcm(a,b) a*b/__gcd(a,b)
#define endl "\n"

using namespace std;

int32_t main(){

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

    int n;
    cin>>n;
    vll a(n), b(n),c(n),b1(n+1,0),b2(n+1,0);
    forn(i,n){
        cin>>a[i];
        b1[a[i]]++;
    }
    forn(i,n) cin>>b[i];
    forn(i,n){
        cin>>c[i];
        b2[c[i]]++;
    }
    int ans=0;
    forn(i,n)
        ans+=b1[b[i]]*b2[i+1];
    cout<<ans;
    return 0;
}


#include <iostream>
typedef long long ll;
using namespace std;

int main()
{
    int n,s,d,i;
    cin>>n>>s>>d;
    int f=0;
    for(i=1;i<=n;i++)
    {
        int x,y;
        cin>>x>>y;
        if(!(x>=s||y<=d))
            f=1;
    }
    if(f)
        cout<<"Yes";
    else
        cout<<"No";
    return 0;
}

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

int tasty[4];

int main(){
    for(int i=0; i<4; i++) cin >> tasty[i];

    for(int bit = 1; bit < (1<<4); bit++){
        int x=0, y=0;
        for(int i=0; i<4; i++){
            if(bit & (1<<i)){
                x += tasty[i];
            } else {
                y += tasty[i];
            }
        }
        if(x == y) {
            cout << "Yes" << endl;
            return 0;
        }
    }
    cout << "No" << endl;
}


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

#define rep(dsa,kajo) for (int dsa = 0; dsa < (kajo); ++dsa)
using ll = long long;
using P = pair<int,int>;
void chmin(int& w, int z){w = min(w,z);}
void chmax(int& w, int z){w = max(w,z);}

int main() {
  int kajo;
  cin >> kajo;
  vector<ll> a(410,0);
  rep(dsa,kajo) {
    ll w;
    cin >> w;
    w += 202;
    a[w] += 1;
  }
  ll qsa = 0;
  rep(dsa, 410) rep(pop,dsa){
    if(dsa==pop) continue;
    qsa += (ll)(dsa-pop) * (ll)(dsa-pop) * a[dsa] * a[pop];
  }
  cout << qsa << endl;
  return 0;
}

#include <iostream>
#include <algorithm>
#include <cmath>
#include <string>
#include <map> //http://vivi.dyndns.org/tech/cpp/map.html
#include <set> //http://vivi.dyndns.org/tech/cpp/set.html
#include <vector>
#include <deque>
#include <queue>
#include <numeric> //gcd,lcm c++17
#include <tuple>
#include <iomanip> //setprecision
#include <unordered_map>
#include <chrono>
using namespace std;
template <typename T>
using vc = vector<T>;
template <typename T>
using vv = vc<vc<T>>;
template <typename T>
using PQ = priority_queue<T, vc<T>, greater<T>>;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pi;
typedef pair<ll, ll> pl;
typedef pair<ld, ld> pd;
//typedef __uint128_t Int;
using vi = vc<int>;
using vl = vc<ll>;
using vd = vc<double>;
#define FOR(i, a, b) for (int i = a; i < (b); i++)
#define F0R(i, a) for (int i = 0; i < (a); i++)
#define ALL(a) (a).begin(), (a).end()
#define sz(x) (int)(x).size()
template <class T1, class T2, class Pred = std::less<T2>>
struct sort_pair_second
{
    //sort_pair_second<ll,ll,greater<ll>>()
    bool operator()(const std::pair<T1, T2> &left, const std::pair<T1, T2> &right)
    {
        Pred p;
        return p(left.second, right.second);
    }
};
template <class T>
bool chmax(T &a, const T &b)
{
    if (a < b)
    {
        a = b;
        return 1;
    }
    return 0;
}
template <class T>
bool chmin(T &a, const T &b)
{
    if (a > b)
    {
        a = b;
        return 1;
    }
    return 0;
}
int MOD = 1e9 + 7;
double EPS = 1e-9;
int INF = 2000000005;
long long INFF = 1000000000000000005LL;
double PI = acos(-1);
int dirx[8] = {-1, 0, 0, 1, -1, -1, 1, 1};
int diry[8] = {0, 1, -1, 0, -1, 1, -1, 1};
int rdx[8] = {1, 1, 0, -1, -1, -1, 0, 1};
int rdy[8] = {0, 1, 1, 1, 0, -1, -1, -1};

int main()
{
    ll N;
    cin >> N;
    ll ans = (1LL << (N + 1));
    string S[N];
    FOR(i, 0, N) { cin >> S[i]; };
    ll r = 0;
    vv<ll> dp(61, vc<ll>(2, 0));
    dp[0][0] = 1;
    dp[0][1] = 1;
    FOR(i, 1, N + 1)
    {
        FOR(j, 0, 2)
        {
            if (j == 0)
            {
                if (S[i - 1] == "AND")
                {
                    dp[i][j] += dp[i - 1][0];
                    dp[i][1] += dp[i - 1][1];
                }
                else
                {
                    dp[i][j] += dp[i - 1][1] + dp[i - 1][0];
                }
            }
            else
            {
                if (S[i - 1] == "AND")
                {
                    dp[i][j] += dp[i - 1][j - 1] + dp[i - 1][j];
                }
                else
                {
                    dp[i][0] += dp[i - 1][0];
                    dp[i][1] += dp[i - 1][1];
                }
            }
        }
    }
    cout << dp[N][0] << endl;
}


#line 1 "main.cpp"

/**
 * @title Template
 */

#include <iostream>
#include <algorithm>
#include <utility>
#include <numeric>
#include <vector>
#include <array>
#include <cassert>

#line 2 "/Users/kodamankod/Desktop/cpp_programming/Library/other/range.cpp"

#line 4 "/Users/kodamankod/Desktop/cpp_programming/Library/other/range.cpp"

class range {
  struct iter {
    std::size_t itr;
    constexpr iter(std::size_t pos) noexcept: itr(pos) { }
    constexpr void operator ++ () noexcept { ++itr; }
    constexpr bool operator != (iter other) const noexcept { return itr != other.itr; }
    constexpr std::size_t operator * () const noexcept { return itr; }
  };

  struct reviter {
    std::size_t itr;
    constexpr reviter(std::size_t pos) noexcept: itr(pos) { }
    constexpr void operator ++ () noexcept { --itr; }
    constexpr bool operator != (reviter other) const noexcept { return itr != other.itr; }
    constexpr std::size_t operator * () const noexcept { return itr; }
  };

  const iter first, last;

public:
  constexpr range(std::size_t first, std::size_t last) noexcept: first(first), last(std::max(first, last)) { }
  constexpr iter begin() const noexcept { return first; }
  constexpr iter end() const noexcept { return last; }
  constexpr reviter rbegin() const noexcept { return reviter(*last - 1); }
  constexpr reviter rend() const noexcept { return reviter(*first - 1); }
};

/**
 * @title Range
 */
#line 15 "main.cpp"

using i32 = std::int32_t;
using i64 = std::int64_t;
using u32 = std::uint32_t;
using u64 = std::uint64_t;
using isize = std::ptrdiff_t;
using usize = std::size_t;

constexpr i32 inf32 = (u32) ~0 >> 2;
constexpr i64 inf64 = (u64) ~0 >> 2;

template <class T>
using Vec = std::vector<T>;

int main() {
  usize A, B, C;
  std::cin >> A >> B >> C;
  std::cout << (A + C > B ? "Takahashi" : "Aoki") << '\n';
  return 0;
}

#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define ld long double
#define ff(i,n) for(i=0;i<n;i++)
#define pb push_back
#define mp make_pair
int main() {
    ll t;
    t = 1;
    while(t--){
  	    ll i,j,n,m,t;
  	    cin>>n>>m>>t;
  	    ll charge = n;
  	    ll prev = 0;
  	    string ans = "Yes";
  	    for(i=0;i<m;i++){
  	    	ll a,b;
			cin>>a>>b;
			if((a-prev)>=charge){
				ans = "No";
			}
			charge = min(n,charge + prev - a + (b-a));
			prev = b;
		}
  	    if((t-prev)>=charge){
  	    	ans = "No";
		}
		cout<<ans;
	}
   	return 0;
}


#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define vi vector<int>
#define vvi vector<vector<int>>
#define pb push_back
#define pii pair<ll,ll>
#define tii tuple<ll,ll,ll>
#define all(v) (v).begin(),(v).end()
#define ll long long
#define ull unsigned long long
#define fastio ios_base::sync_with_stdio(false);cin.tie(nullptr);
#define ld long double
#define mod 1000000007
#define PI 3.141592653589793238
#define phi 1.638
#define eps 1e-9
#define endl "\n"
using namespace std;
using namespace __gnu_pbds;
typedef tree<int, null_type, less_equal<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;

void solve() {
    int n;
    cin>>n;

    vector<pii> vec(n);
    for(auto& it : vec) cin>>it.first>>it.second;

    int m;
    cin>>m;

    vector<vector<ll>> add(m+1, vector<ll>(6));
    ll flip[m+1] = {0};
    add[0][0] = 1;
    add[0][1] = 0;
    add[0][2] = 0;
    add[0][3] = 0;
    add[0][4] = 1;
    add[0][5] = 0;
    for(int j = 1; j <= m; ++j) {
        int type;
        cin>>type;
        ll prevc1 = add[j-1][0];
        ll prevd1 = add[j-1][1];
        ll prevz1 = add[j-1][2];
        ll prevc2 = add[j-1][3];
        ll prevd2 = add[j-1][4];
        ll prevz2 = add[j-1][5];

        ll nprevc1 = 0;
        ll nprevd1 = 0;
        ll nprevz1 = 0;
        ll nprevc2 = 0;
        ll nprevd2 = 0;
        ll nprevz2 = 0;
        if(type == 1) {
            nprevc1 = prevc2;
            nprevd1 = prevd2;
            nprevz1 = prevz2;
            nprevc2 = -prevc1;
            nprevd2 = -prevd1;
            nprevz2 = -prevz1;
        }
        else if(type == 2) {
            nprevc1 = -prevc2;
            nprevd1 = -prevd2;
            nprevz1 = -prevz2;
            nprevc2 = prevc1;
            nprevd2 = prevd1;
            nprevz2 = prevz1;
        }
        else if(type == 3) {
            ll p;
            cin>>p;
            nprevc1 = -prevc1;
            nprevd1 = -prevd1;
            nprevz1 = 2*p - prevz1;
            nprevc2 = prevc2;
            nprevd2 = prevd2;
            nprevz2 = prevz2;
        }
        else {
            ll p;
            cin>>p;
            nprevc1 = prevc1;
            nprevd1 = prevd1;
            nprevz1 = prevz1;
            nprevc2 = -prevc2;
            nprevd2 = -prevd2;
            nprevz2 = 2*p - prevz2;
        }

        add[j][0] = nprevc1;
        add[j][1] = nprevd1;
        add[j][2] = nprevz1;
        add[j][3] = nprevc2;
        add[j][4] = nprevd2;
        add[j][5] = nprevz2;
    }

    int q;
    cin>>q;
    while(q--) {
        int a, b;
        cin>>a>>b;
        ll ax = vec[b-1].first;
        ll ay = vec[b-1].second;
        cout<<ax*add[a][0]+ay*add[a][1]+add[a][2]<<" "<<ax*add[a][3]+ay*add[a][4]+add[a][5]<<endl;
    }
}

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

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

#define M1 1000000007
#define M3 1000000009
#define M2 998244353
#define ll long long
#define ld long double
#define pll pair<ll,ll>
#define rep(i,a,b) for(ll i=a;i<b;i++)
#define repr(i,a,b) for(ll i=b-1;i>=a;i--)
#define forr(i,n) for(ll i=0;i<n;i++)
#define F first
#define S second
#define pb push_back
#define DB pop_back
#define mp make_pair
#define MT make_tuple
#define V(a) vector<a>
#define vi vector<ll>
#define endl '\n'
#define ce(ele) cout<<ele<<' '
#define cs(ele) cout<<ele<<'\n'
#define csv(v) for(int i=0;i<v.size();i++)cout<<v[i]<<' '
#define yep cout<<"YES"<<'\n'
#define nope cout<<"NO"<<'\n'
#define CASE(te) ll te; cin>>te; while(te--)
#define sor(v) sort(v.begin(),v.end())
#define rev(v) reverse(v.begin(),v.end())

void FAST() {
	ios::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
}

int main()
{
  FAST();
  int n;
  cin>>n;
  int mn=100000,mx=0;
    for(int i=0;i<n;i++)
  {
      int a;
      cin>>a;
      mx=max(a,mx);
  }
  for(int i=0;i<n;i++)
  {
      int a;
      cin>>a;
      mn=min(a,mn);
  }
  if(mn>=mx)
  cs(mn-mx+1);
  else
  cs(0);
}


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

int main() {
  string S;
  int A = 0, B = 0, result = 0;
  int C1, C2, C3, C4;

  cin >> S;

  for (int i = 0; i < 10; i++) {
    if (S[i] == 'o') {
      A++;
    } else if (S[i] == '?') {
      B++;
    }
  }

  C1 = 1;
  C2 = 14;
  C3 = 36;
  C4 = 24;

  if (A == 0) {
    result = B*B*B*B;
  } else if (A == 1) {
    result = C1 + B*C2 + B*(B-1)*C3/2 + B*(B-1)*(B-2)*C4/6;
  } else if (A == 2) {
    result = C2 + B*C3 + B*(B-1)*C4/2;
  } else if (A == 3) {
    result = C3 + B*C4;
  } else if (A == 4) {
    result = C4;
  }

  cout << result << endl;
}

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

const int M = 1e9 + 7;
ll mod(ll x) { return (x % M + M) % M; }

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

ll add(ll a, ll b) { return mod(mod(a) + mod(b)); }

void solve() {
  string s;
  cin >> s;
  int ok = 0;
  int maybe = 0;
  for (auto i : s) {
    if (i == 'o')
      ok++;
    else if (i == '?')
      maybe++;
  }
  int total = 0;
  for (int i = 0; i <= 9; i++) {
    for (int j = 0; j <= 9; j++) {
      for (int k = 0; k <= 9; k++) {
        for (int l = 0; l <= 9; l++) {
          set<int> ss;
          if (s[i] == 'x' || s[j] == 'x' || s[k] == 'x' || s[l] == 'x')
            continue;
          if (s[i] == 'o')
            ss.insert(i);
          if (s[j] == 'o')
            ss.insert(j);
          if (s[k] == 'o')
            ss.insert(k);
          if (s[l] == 'o')
            ss.insert(l);
          if ((int)ss.size() == ok)
            total++;
        }
      }
    }
  }
  cout << total;
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cout << fixed;
  cout << setprecision(10);
  //        freopen("timber_input.txt", "r", stdin);
  //        freopen("timber_output.txt", "w", stdout);
  int t = 1;
  // cin>>t;
  for (int i = 1; i <= t; i++) {
    //    cout<<"Case #"<<i<<": ";
    solve();
  }
  return 0;
}


// #define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
//#include <atcoder/all>
using namespace std;
//using namespace atcoder;

#define int long long
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define rep(i, n) for (int i = 0; i < n; ++i)
#define REP(i, n) for (int i = 0; i < n; ++i)
#define range(i,a,b) ((a)<=(i) && (i)<(b))
#define debug(x) cout << #x << " = " << (x) << endl;
#define fs first
#define sc second
#define pb push_back
#define eb emplace_back
#define SP << " " <<

typedef long long ll;
typedef pair<int, int> P;
typedef tuple<int, int, int> T;
typedef vector<int> vec;
typedef vector<P> pvec;
typedef vector<vector<int>> vvec;
typedef vector<vector<P>> pvvec;
typedef priority_queue<int> PQI;
typedef priority_queue<P> PQP;
typedef priority_queue<int,vector<int>,greater<int>> PQIG;
typedef priority_queue<P,vector<P>,greater<P>> PQPG;

const vector<int> DX = {0, -1, 0, 1, 1, 1, -1, -1};
const vector<int> DY = {1, 0, -1, 0, 1, -1, 1, -1};
constexpr int MOD = (1000000007);
// const int MOD = (998244353);
// const int INF = (1 << 30); // 1073741824
const ll INF = (1LL << 60); // 1152921504606846976
const double PI = (3.141592653589794);
const double EPS = (0.0000000001); // 10^(-10)

template<class T> inline bool chmin(T& a, T b) {if (a > b) {a = b; return 1;} return 0;}
template<class T> inline bool chmax(T& a, T b) {if (a < b) {a = b; return 1;} return 0;}
template<class T> inline T ceil(T a, T b) {return T((a + b - 1) / b);}
template<class T> inline T round(T a, T b) {return T(a / b);}
template< typename T1, typename T2 > istream &operator>>(istream &is, pair< T1, T2 > &p) { is >> p.first >> p.second; return is; }
template <class T> inline void out(T &a) { bool flag=true; for(auto&x:a){if(flag) {flag=false;} else{ cout << ' '; } cout<<x; } cout << endl; }

//----------------------------------------------------------------
int nmax=200000; // 2*(10^5)
vvec G(nmax);

void solve4ts()
{

  char x,y;
  cin>>x>>y;
  if(x=='Y'){
    if(y=='a')cout<<"A";
    else if(y=='b') cout<<"B";
    else cout<<"C";
  }
  else{
    cout<<y<<endl;
  }

}
//-----------------------------------------------------------------

signed main(){ ios::sync_with_stdio(false); cin.tie(0); cout << fixed << setprecision(15);
  int repeat = 1;
  // cin >> repeat;
  while(repeat--) solve4ts();
}

/*

g++ -std=c++1z code.cpp

./a.out

python3 expander.py code.cpp

*/

#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define sz(a) int(a.size())
template <typename A, typename B>
ostream& operator <<(ostream& out, const pair<A, B>& a) { out << "(" << a.first << "," << a.second << ")"; return out; }
template <typename T, size_t N> ostream& operator <<(ostream& out, const array<T, N>& a) { out << "["; bool first = true; for (auto& v : a) { out << (first ? "" : ", "); out << v; first = 0;} out << "]"; return out; }
template <typename T> ostream& operator <<(ostream& out, const vector<T>& a) { out << "["; bool first = true; for (auto& v : a) { out << (first ? "" : ", "); out << v; first = 0;} out << "]"; return out; }
template <typename T, class Cmp> ostream& operator <<(ostream& out, const set<T, Cmp>& a) { out << "{"; bool first = true; for (auto& v : a) { out << (first ? "" : ", "); out << v; first = 0;} out << "}"; return out; }
template <typename U, typename T, class Cmp> ostream& operator <<(ostream& out, const map<U, T, Cmp>& a) { out << "{"; bool first = true; for (auto& p : a) { out << (first ? "" : ", "); out << p.first << ":" << p.second; first = 0;} out << "}"; return out; }
template <typename Arg1> void __f(const char* name, Arg1&& arg1){ cerr << name << ": " << arg1 << endl; }
template <typename Arg1, typename... Args> void __f(const char* names, Arg1&& arg1, Args&&... args){ const char* comma = strchr(names + 1, ','); cerr.write(names, comma - names) << ": " << arg1 << " |"; __f(comma + 1, args...); }

#ifdef LOCAL
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
#else
#define trace(...) 42
#endif

int dp[2000][2000];
int dfs(int x, int y, int h, int w, vector<string>& v) {
	if(x == h - 1 and y == w - 1) {
		return dp[x][y] = 0;
	}
	if(dp[x][y] != INT_MIN) {
		return dp[x][y];
	}
	int ret = INT_MIN;
	if(x+1<h) {
		if(v[x+1][y] == '-') {
			ret = max(ret, -1 - dfs(x+1, y, h, w, v));
		} else {
			ret = max(ret, 1 - dfs(x+1, y, h, w, v));
		}
	}
	if(y+1<w) {
		ret = max(ret, (v[x][y+1] == '-'?-1:1) - dfs(x, y+1, h, w, v));
	}
	return dp[x][y] = ret;
}
void solve() {
	int h, w; cin >> h >> w;
	for(int i=0; i<h; i++) {
		for(int j=0; j<w; j++) {
			dp[i][j] = INT_MIN;
		}
	}
	vector<string> v(h);
	for(int i=0; i<h; i++) {
		cin >> v[i];
	}
	dfs(0, 0, h, w, v);
	if(dp[0][0] > 0) {
		cout << "Takahashi" << endl;
	} else if(dp[0][0] == 0) {
		cout << "Draw" << endl;
	} else {
		cout << "Aoki" << endl;
	}
}

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


#include <bits/stdc++.h>

typedef long double ld;
#define int long long

#define gcd            __gcd
#define endl           "\n"
#define setbits(x)     __builtin_popcountll(x)
#define zrobits(x)     __builtin_ctzll(x)
#define mod            1000000007
#define mod2           998244353
#define maxe           *max_element
#define mine           *min_element
#define inf            1e18
#define pb             push_back
#define all(x)         x.begin(), x.end()
#define f              first
#define s              second
#define lb             lower_bound
#define ub             upper_bound
#define ins            insert
#define sz(x)          (int)(x).size()
#define mk             make_pair
#define deci(x, y)     fixed<<setprecision(y)<<x
#define w(t)           int t; cin>>t; while(t--)
#define nitin          ios_base::sync_with_stdio(false); cin.tie(nullptr)
#define PI             3.141592653589793238
#define mem0(x)        memset(x,0,sizeof x)
#define mem1(x)        memset(x,-1,sizeof x)
using namespace std;
template<typename A, typename B> ostream& operator<<(ostream &os, const pair<A, B> &p) { return os << '(' << p.f << ", " << p.second << ')'; }
template<typename T_container, typename T = typename enable_if<!is_same<T_container, string>::value, typename T_container::value_type>::type> ostream& operator<<(ostream &os, const T_container &v) { os << '{'; string sep; for (const T &x : v) os << sep << x, sep = ", "; return os << '}'; }

void dbg_out() { cerr << endl; }
template<typename Head, typename... Tail> void dbg_out(Head H, Tail... T) { cerr << ' ' << H; dbg_out(T...); }

#ifdef NITIN
#define dbg(...) cerr << "(" << #__VA_ARGS__ << "):", dbg_out(__VA_ARGS__)
#else
#define dbg(...)
#endif

int a[801][801];
int dp[801][801];
int n,k;
bool good(int val) {
    int req = k*k-((k * k) / 2+1)+1;
    mem0(dp);
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < n; j++) {
            dp[i][j] = (a[i][j] <= val);
            if (i >= 1 || j >= 1) {
                if (i >= 1) dp[i][j] += dp[i - 1][j];
                if (j >= 1) dp[i][j] += dp[i][j - 1];
                if(i>=1 && j>=1) dp[i][j]-=dp[i-1][j-1];
            }
        }
    }
    for (int i = 0; i <= n - k; i++) {
        for (int j = 0; j <= n - k; j++) {
            int tot = dp[i + k - 1][j + k - 1];
            if (i >= 1) {
                tot -= dp[i - 1][j + k - 1];
            }
            if (j >= 1) {
                tot -= dp[i + k - 1][j - 1];
            }
            if (i >= 1 && j >= 1) {
                tot += dp[i - 1][j - 1];
            }
            if (tot>=req) {
                return true;
            }
        }
    }
    return false;
}
void solve() {
    cin>>n>>k;
    for(int i=0;i<n;i++){
        for(int j=0;j<n;j++){
            cin>>a[i][j];
        }
    }
    int l=-1,r=1e9+1;
    while(l+1<r) {
        int mid = (l + r) / 2;
        if (good(mid)) {
            r = mid;
        } else {
            l = mid;
        }
    }
    cout<<r<<endl;
}

int32_t main() {
    nitin;

    solve();
}

#include<bits/stdc++.h>
#define LL long long
#define DB double
#define pb push_back
#define mkp make_pair
#define LB lower_bound
#define UB upper_bound
#define rint register int
#define MS(x,y) memset(x,y,sizeof(x))
#define rep(i,a,b) for(rint i=a,i##end=b;i<=i##end;++i)
#define drep(i,a,b) for(rint i=a,i##end=b;i>=i##end;--i)
#define cms printf("%.2lf\n",(&o2-&o1)/1024.0/1024)
using namespace std;bool o1;
char IO;
inline int Rd(){
	int _s_=0;
	bool _f_=0;
	while(!isdigit(IO=getchar()))
		IO=='-'&&(_f_=1);
	do _s_=(_s_<<1)+(_s_<<3)+(IO^48);
	while(isdigit(IO=getchar()));
	return _f_?-_s_:_s_;
}
const int M=803;
int n,k,t,a[M][M],b[M*M],tt,ans,l,r,c[M][M],d[M][M];
int ask(int x,int y){
	return d[x][y]-d[x-k][y]-d[x][y-k]+d[x-k][y-k];
}
bool chk(int x){
	rep(i,1,n)
		rep(j,1,n)
			if(a[i][j]<=x)
				c[i][j]=1;
			else c[i][j]=0;
	rep(i,1,n)
		rep(j,1,n)
			d[i][j]=d[i-1][j]+d[i][j-1]+c[i][j]-d[i-1][j-1];
	rep(i,k,n){
		rep(j,k,n){
			if(ask(i,j)>=tt)
				return 1;
		}
	}
	return 0;
}
bool o2;int main(){
	n=Rd(),k=Rd(),tt=k*k-((k*k)/2+1)+1;
	rep(i,1,n)
		rep(j,1,n)
			b[++t]=a[i][j]=Rd();
	sort(b+1,b+1+t);
	t=unique(b+1,b+1+t)-b-1;
	rep(i,1,n){
		rep(j,1,n){
			a[i][j]=LB(b+1,b+1+t,a[i][j])-b;
		}
	}
	chk(4);
	ans=t;
	l=1,r=t;
	while(l<=r){
		int mid=l+r>>1;
		if(chk(mid)){
			ans=mid;
			r=mid-1;
		}
		else l=mid+1;
	}
	cout<<b[ans];
	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 INF = 1e9;
constexpr long long LINF = 1e18;
constexpr long long MOD = 1e9 + 7;

string a = "atcoder";

signed main() {
    int number_of_testcases;
    cin >> number_of_testcases;
    while (number_of_testcases--) {
        string s;
        cin >> s;
        int n = s.size();
        int cnt = 0;
        int ans = INF;
        rep(i, n) {
            if (i > 6) {
                ans = min(ans, cnt);
                break;
            }
            if (s[i] > a[i]) {
                ans = min(ans, cnt);
                break;
            }
            for (int j = i + 1; j < n; j++) {
                if (s[j] > a[i]) {
                    ans = min(ans, cnt + j - i);
                    break;
                }
            }
            if (s[i] < a[i]) {
                int pos = -1;
                for (int j = i + 1; j < n; j++) {
                    if (s[j] == a[i]) {
                        pos = j;
                        break;
                    }
                }
                if (pos == -1) break;
                for (int j = pos - 1; j >= i; j--) {
                    swap(s[j], s[j + 1]);
                    cnt++;
                }
            }
        }
        cout << (ans != INF ? ans : -1) << endl;
    }
    return 0;
}

#include<bits/stdc++.h>
#define endl '\n'
using namespace std;
string s;
int solve(){
    if(s>"atcoder")return 0;
    int id = -1;
    for(int i=0;i<s.size();++i){
        if(s[i]!='a'){
            id = i;
            break;
        }
    }
    if(id==-1)return id;
    if(s[id]>'t')return id - 1;
    return id;
}
int main(){
    int tt;
    cin>>tt;
    while(tt--){
        cin>>s;
        cout<<solve()<<endl;
    }
}


#include <bits/stdc++.h>
#define pii pair<int,int>
#define fi first
#define pb push_back
#define si second
#define int long long
#define mod  998244353 //1000000007
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define double long double
#define all(o) o.begin(),o.end()
using namespace std;

int power(int x, int y)
{
    int res = 1LL;
    x = x % mod;
    while (y > 0)
    {
        if (y & 1)
            res = (res*x) % mod;
        y = y>>1; // y = y/2
        x = (x*x) % mod;
    }
    return res%mod;
}
int inv(int  n)
{
    return power(n,mod-2)%mod;
}

int n,q;

int a[200005],t[200005],b[200005];
int calc(int k){

    int i;

    for(i=1;i<=n;i++){
        if(t[i]==1)
            k+=a[i];
        else if(t[i]==2)
            k=max(k,a[i]);
        else
            k=min(k,a[i]);
    }
    return k;
}
void solve()
{

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

    int l=-1e18,r=1e18;
    int sum=0,ll=0,lr=0;

    for(i=1;i<=n;i++){
        if(t[i]==1)
            sum+=a[i];
        else if(t[i]==2){
            l=max(l,a[i]-sum);
            ll=i;
        }
        else
        {   r=min(r,a[i]-sum);
            lr=i;
        }
    }
    cin>>q;
    for(i=1;i<=q;i++)
        cin>>b[i];

    int lans=calc(l),rans=calc(r);

    for(i=1;i<=q;i++)
        if(b[i]<=l)
            cout<<lans<<"\n";
        else if(b[i]>=r)
            cout<<rans<<"\n";
        else cout<<b[i]+sum<<"\n";

}

int32_t main(){
    fast
    int t=1;

    // cin>>t;
    while(t--)

    {
        solve();
    }
}

#include <bits/stdc++.h>
using namespace std;
#define rep(i, a) for (int i = 0; i < (int)(a); i++)
#define sz(x) (int)(x).size()
#define pcnt __builtin_popcountll
typedef long long ll;
template<typename T>istream& operator>>(istream&i,vector<T>&v){rep(j,sz(v))i>>v[j];return i;}
template<typename T>string join(const vector<T>&v){stringstream s;rep(i,sz(v))s<<' '<<v[i];return s.str().substr(1);}
template<typename T>ostream& operator<<(ostream&o,const vector<T>&v){if(sz(v))o<<join(v);return o;}
template<typename T1,typename T2>istream& operator>>(istream&i,pair<T1,T2>&v){return i>>v.first>>v.second;}
template<typename T1,typename T2>ostream& operator<<(ostream&o,const pair<T1,T2>&v){return o<<v.first<<","<<v.second;}
template<typename T>bool mins(T& x,const T&y){if(x>y){x=y;return true;}else return false;}
template<typename T>bool maxs(T& x,const T&y){if(x<y){x=y;return true;}else return false;}
template<typename T>T dup(T x, T y){return (x+y-1)/y;}
template<typename T>ll suma(const vector<T>&a){ll res(0);for(auto&&x:a)res+=x;return res;}
int keta(ll n) { int ret = 0; while (n>0) { n/=10; ret++; } return ret; }

#ifdef _DEBUG
inline void dump() { cerr << endl; }
template <typename Head> void dump(Head &&head) { cerr << head; dump(); }
template <typename Head, typename... Tail> void dump(Head &&head, Tail &&... tail) { cerr << head << ", "; dump(forward<Tail>(tail)...); }
#define debug(...) do { cerr << __LINE__ << ":\t" << #__VA_ARGS__ << " = "; dump(__VA_ARGS__); } while (false)
#else
#define dump(...)
#define debug(...)
#endif

template <typename T> struct edge {
  int src, to;
  T cost;
  edge(int to, T cost) : src(-1), to(to), cost(cost) {}
  edge(int src, int to, T cost) : src(src), to(to), cost(cost) {}
  edge &operator=(const int &x) {
    to = x;
    return *this;
  }
  operator int() const { return to; }
};
template <typename T> using Edges = vector<edge<T>>;
template <typename T> using WeightedGraph = vector<Edges<T>>;
using UnWeightedGraph = vector<vector<int>>;

const ll LINF = 1LL << 60;
const int INF = 1001001001;

/////////////////////////////////////////////////////////////////////

void solve()
{
  int n; cin>>n;
  ll mi = -LINF;
  ll ma = LINF;
  ll fl = 0;
  rep(i, n) {
    ll a,t; cin>>a>>t;
    if (t == 1) {
      mi += a;
      ma += a;
      fl += a;
    }
    if (t == 2) {
      maxs(mi, a);
      maxs(ma, mi);
    }
    if (t == 3) {
      mins(ma, a);
      mins(mi, ma);
    }
  }
  int q; cin>>q;
  vector<ll> x(q); cin>>x;
  rep(i, q) {
    ll v = x[i] + fl;
    mins(v, ma);
    maxs(v, mi);
    cout << v << "\n";
  }

}

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

  return 0;
}


#include<bits/stdc++.h>
using namespace std ;
#define int long long int
signed main(){
    ios_base::sync_with_stdio(false); cin.tie(NULL);
    int n; cin >> n;
    int x, cnt = 0;
    for(int i = 1; i < 1e7; i++){
        x = i * pow(10, to_string(i).size()) + i;
        if(x > n) break;
        cnt++;
    }
    cout << cnt << "\n";
    return 0;
}

#include <iostream>
#include <string>

long long kaijou_ten(int sisuu) {
    long long ret = 1;
    for ( int i = 0; i < sisuu; ++i ) {
        ret *= 10;
    }
    return ret;
}

int main() {

    std::string str;
    std::cin >> str;

    long long n = str.size();
    //std::cout << n << std::endl;
    long long ans = 0;
    if ( n % 2  == 1 ) {
        for ( int i = 1; i <= (n / 2); ++i ) {
            ans += 9 * kaijou_ten(i-1);
        }
    }
    else {
        for ( int i = 1; i < (n / 2); ++i ) {
            ans += 9 * kaijou_ten(i-1);
        }
        std::string strL;
        std::string strR;
        /*for ( int i = 1; i <= (n / 2); ++i ) {
            strL[i-1] = str[i-1];
            strR[n/2 + i-1] = str[n/2 + i-1];
        }
        */
        strL = str.substr(0,n/2);
        strR = str.substr(n/2,n/2);
        long long lval = std::stoll(strL);
        long long rval = std::stoll(strR);
        //std::cout << strL << " " << strR << std::endl;
        //std::cout << lval << " " << rval << std::endl;

        if ( lval > rval ) {
            ans += lval - kaijou_ten(n/2 - 1);
        }
        else {
            ans += lval - kaijou_ten(n/2 - 1) + 1;
        }

    }

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


#include<bits/stdc++.h>

#define all(k) k.begin(),k.end()
#define INF 1e9
#define repk(i,a, n) for(int i=a;i<=n;i++)
#define rep(i,a, n) for(int i=a;i<n;i++)
#define per(i,a,n) for(int i=n-1;i>=a;i--)
#define pb push_back
#define ppb pop_back
#define eb emplace_back
#define ll  long long
#define ull unsigned long long
#define pci pair<int,int>
#define vc vector<char>
#define vs vector<set<pi>>
#define vi vector<int>
#define vl vector<ll>
#define vvi vector<vi>
#define vb vector<bool>
#define vpc vector<pci>
#define vvc vector<vc>
#define mi map<int,int>
#define mset map<string,set<char>>
#define umap unordered_map
#define int int64_t
using namespace std;
#define fi first
#define se second
#define mod 1000000007

void sol()
{

int n,x;cin>>n>>x;
vi a(n);
rep(i,0,n)cin>>a[i];
rep(i,0,n){
  if(a[i]==x)
    continue;
  else
    cout<<a[i]<<" ";
}
}

int32_t main() {

int t=1;
// for(cin>>t;t;t--)
sol();
  return 0;
}

#include <bits/stdc++.h>
using namespace std;
int main()
{
	int n,x,a;
	cin>>n>>x;
	for(int i=0;i<n;i++)
	{
		cin>>a;
		if(a!=x)
		{
			cout<<a<<" ";
		}
	}
	return 0;
}


#include <bits/stdc++.h>

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

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

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

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

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

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

void Main() {
    LCIN(H, W, X, Y);
    vvl m(H, vl(W, 0));
    for(int i = 0; i < H; i++) {
        SCIN(S);
        for(int j = 0; j < W; j++) {
            m.at(i).at(j) = S.at(j) == '#';
        }
    }
    --X;
    --Y;
    ll ans = -3;
    for(int i = X; i < H; i++) {
        if(m.at(i).at(Y))break;
        ++ans;
    }
    for(int i = X; i >= 0; i--) {
        if(m.at(i).at(Y))break;
        ++ans;
    }
    for(int i = Y; i < W; i++) {
        if(m.at(X).at(i))break;
        ++ans;
    }
    for(int i = Y; i >= 0; i--) {
        if(m.at(X).at(i))break;
        ++ans;
    }
    cout << ans << endl;
}

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

/*
 * Author - Abhas Jain
 * Code is inside the solve function
 */

#include <bits/stdc++.h>

#define F first
#define S second
#define all(c) c.begin(), c.end()
#define endl '\n'
#define pb push_back

typedef long long ll;
typedef long double ld;

using namespace std;
mt19937 rang(chrono::high_resolution_clock::now().time_since_epoch().count());

const ld PI = 3.141592653589793;
const ll INF = 9223372036854775807ll;
const ll mod = 1e9 + 7;

struct Matrix {
    vector<vector<ll>> data;
    // for small n,m array should be used.
    int n, m;

    Matrix(int n, int m) : data(n, vector<ll>(m)), n(n), m(m) {}
    Matrix(vector<vector<ll>> g) : data(g) {
        n = g.size();
        m = g[0].size();
    }

    Matrix mult(const Matrix&rhs) const {
        int n = (*this).n;
        int m = rhs.m;
        int tmp = rhs.n;
        Matrix ans(n, m);
        for (int i = 0; i < n; ++i) {
            for (int j = 0; j < tmp; ++j) {
                for (int k = 0; k < m; ++k) {
                    ans.data[i][k] = (ans.data[i][k] + data[i][j] * rhs.data[j][k]) % mod;
                }
            }
        }
        return ans;
    }

    Matrix pow(ll pw) const {
        int sz = (*this).n;
        Matrix ans(sz, sz);
        Matrix exp = *this;
        for (int i = 0; i < sz; ++i) { ans.data[i][i] = 1; }
        while (pw) {
          if (pw & 1) { ans = ans.mult(exp); }
          pw >>= 1;
          exp = exp.mult(exp);
        }
        return ans;
    }
};

ll modinv(ll x) {
    ll ans = 1, ex = mod - 2;
    while (ex > 0) {
        if (ex & 1ll) {
            ans = (ans * x) % mod;
        }
        ex >>= 1ll;
        x = (x * x) % mod;
    }
    return ans;
}

void solve()
{
    int n, m, k;
    cin >> n >> m >> k;
    vector<ll> a(n);
    for (int i = 0; i < n; ++i) cin >> a[i];
    Matrix tr(n, n);
    vector<int> deg(n);
    for (int i = 0; i < m; ++i) {
        int a, b;
        cin >> a >> b;
        a--; b--;
        deg[a]++;
        deg[b]++;
        tr.data[a][b] = 1;
        tr.data[b][a] = 1;
    }
    ll div = modinv(2 * m);
    for (int i = 0; i < n; ++i) {
        tr.data[i][i] = 2 * m - deg[i];
        tr.data[i][i] %= mod;
    }
    for (int i = 0; i < n; ++i) {
        for (int j = 0; j < n; ++j) {
            tr.data[i][j] *= div;
            tr.data[i][j] %= mod;
        }
    }
    //debug(tr.data);
    tr = tr.pow(k);
    //debug(tr.data);
    for (int i = 0; i < n; ++i) {
        ll cur = 0;
        for (int j = 0; j < n; ++j) {
            cur += a[j] * tr.data[j][i];
            cur %= mod;
        }
        cout << cur << endl;
    }
}

int main( )
{
    ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
    srand(chrono::high_resolution_clock::now().time_since_epoch().count());
    solve();
    return 0;
}


#include <stdio.h>
#include <iostream>
#include <cmath>
#include <iomanip>
#include <sstream>
#include <string>
#include <vector>
#include <stack>
#include <algorithm>
#include <map>
#include <string>
#include <queue>
#include <list>
#include <set>
#include <ctime>
#include <queue>
#include <cstring>
#include <bitset>
#include <unordered_map>
#include <unordered_set>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
const ll INF = 0x3f3f3f3f3f3f;
int main()
{
    bool flag = true;
    string s;
    cin >> s;
    for (ll i = 0; i < s.size(); i++)
    {
        if (i % 2 == 0 && s[i] >= 'A' && s[i] <= 'Z')
        {
            flag = false;
        }
        if (i % 2 == 1 && s[i] >= 'a' && s[i] <= 'z')
        {
            flag = false;
        }
    }
    if (flag)
    {
        cout << "Yes" << endl;
    }
    else
    {
        cout << "No" << endl;
    }
    return 0;
}

#include <bits/stdc++.h>
using namespace std;
template <class T> inline bool chmax(T &a, T b) {
    if(a < b) {
        a = b;
        return 1;
    }
    return 0;
}
template <class T> inline bool chmin(T &a, T b) {
    if(a > b) {
        a = b;
        return 1;
    }
    return 0;
}
#define DEBUG
#ifdef DEBUG
template <class T, class U>
ostream &operator<<(ostream &os, const pair<T, U> &p) {
    os << '(' << p.first << ',' << p.second << ')';
    return os;
}
template <class T> ostream &operator<<(ostream &os, const vector<T> &v) {
    os << '{';
    for(int i = 0; i < (int)v.size(); i++) {
        if(i) { os << ','; }
        os << v[i];
    }
    os << '}';
    return os;
}
void debugg() { cerr << endl; }
template <class T, class... Args>
void debugg(const T &x, const Args &... args) {
    cerr << " " << x;
    debugg(args...);
}
#define debug(...)                                                             \
    cerr << __LINE__ << " [" << #__VA_ARGS__ << "]: ", debugg(__VA_ARGS__)
#define dump(x) cerr << __LINE__ << " " << #x << " = " << (x) << endl
#else
#define debug(...) (void(0))
#define dump(x) (void(0))
#endif

struct Setup {
    Setup() {
        cin.tie(0);
        ios::sync_with_stdio(false);
        cout << fixed << setprecision(15);
    }
} __Setup;

using ll = long long;
#define ALL(v) (v).begin(), (v).end()
#define RALL(v) (v).rbegin(), (v).rend()
#define FOR(i, a, b) for(int i = (a); i < int(b); i++)
#define REP(i, n) FOR(i, 0, n)
const int INF = 1 << 30;
const ll LLINF = 1LL << 60;
constexpr int MOD = 1000000007;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};

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

int main() {
    string s; cin >> s;

    bool ok = true;
    REP(i, s.size()){
        if(i % 2 == 0 && !('a' <= s[i] && s[i] <= 'z')){
            ok = false;
        }else if(i % 2 && !('A' <= s[i] && s[i] <= 'Z')){
            ok = false;
        }
    }

    cout << (ok ? "Yes" : "No") << endl;
}


#include <iostream>
#include <iomanip>
#include <fstream>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <climits>
#include <algorithm>
#include <numeric>
#include <utility>
#include <random>
#include <chrono>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>

using namespace std;

using LL = long long;
using ULL = unsigned long long;
using PII = pair<int, int>;
using PIL = pair<int, LL>;
using PLL = pair<LL, LL>;
// const int mod = 1e9 + 7;
// const int mod = 998244353;

inline void quickread() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
}

LL a[200010];
int k;

inline void work() {
    cin >> k;
    for (int i = 1; i <= k; ++i) {
        a[i] = a[i - 1];
        for (int j = 1; j * j <= i; ++j) {
            if (i % j == 0) {
                ++a[i];
                if (j * j != i) {
                    ++a[i];
                }
            }
        }
    }
    LL ans = 0;
    for (int i = 1; i <= k; ++i) {
        ans += a[k / i];
    }
    cout << ans << "\n";
}

int main() {
    // freopen("input.txt", "r", stdin);
    quickread();
    work();
    return 0;
}

#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int,int>;
int main(){

   int N;
   cin >> N;

   int ans = N;

   while(true){
      ++ans;
      if(ans % 100 == 0) break;
   }
   cout << ans-N << endl;
}


#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
#include <string.h>
#include <limits.h>
#include <math.h>
#include <time.h>
#include <queue>
#include <stdarg.h>
#include <map>
#include <vector>
#include <algorithm>
#include <stack>
#include <iostream>
#include <numeric>
#include <set>

#define ll long long

using namespace std;

ll dp[1001][1001];

ll get(vector<ll> & a, vector<ll> & b, ll left, ll right) {
  if (left == -1) return right + 1;
  if (right == -1) return left + 1;

  if (dp[left][right] == -1) {
    if (a[left] == b[right])
      dp[left][right] = get(a, b, left-1, right-1);
    else
      dp[left][right] = get(a, b, left-1, right-1) + 1;

    dp[left][right] = min(dp[left][right], get(a, b, left-1, right) + 1);
    dp[left][right] = min(dp[left][right], get(a, b, left, right-1) + 1);
  }

  return dp[left][right];
}

void
solve() {
  ll n, m;
  cin>>n>>m;

  vector<ll> a(n), b(m);
  for (ll i=0; i<n; i++) cin>>a[i];
  for (ll i=0; i<m; i++) cin>>b[i];

  memset(dp, -1, sizeof dp);
  cout<<get(a, b, n-1, m-1)<<endl;
}

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

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

  while (t > 0) {
    t--;
    solve();
  }

  return 0;
}

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

int main(){
    int n,m;
    int ans=0;
    scanf("%d%d",&n,&m);
    for(rei i=1;i<=n;++i){
        char tmp[22];
        int tmpn=0;
        scanf("%s",tmp);
        for(rei j=0;j<m;++j)
            if(tmp[j]-'0') tmpn++;
        if(tmpn%2) ans++;
    }
    printf("%lld\n",1ll*ans*(n-ans));
    getchar();
    getchar();
    return 0;
}