//DUEL
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#define x first
#define y second
#define pii pair<int,int>
#define pb push_back
#define eb emplace_back
#pragma GCC optimize("unroll-loops")
#define shandom_ruffle(a, b) shuffle(a, b, rng)
#define vi vector<int>
#define vl vector<ll>
#define popcnt __builtin_popcount
#define popcntll __builtin_popcountll
#define all(a) begin(a),end(a)

using namespace std;
using namespace __gnu_pbds;

using ll=long long;
using ull=unsigned long long;
using ld=long double;
int MOD=1000000007;
int MOD2=998244353;
vector<int> bases;
const ll LLINF=1ll<<60;
const char en='\n';

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
void yes() {cout<<"YES"<<en; exit(0);}
void no() {cout<<"NO"<<en; exit(0);}
inline int rund() {int x576363482791fuweh=rng();return abs(x576363482791fuweh)%RAND_MAX;}
template<class T>
void prVec(vector<T> w,bool fl=false)
{
	cout<<w.size()<<en;
	for (int i=0;i<int(w.size())-1;++i) cout<<w[i]<<' ';
	if (w.size()) cout<<w[w.size()-1]<<en;
	if (fl) cout<<flush;
}

void M998()
{
	swap(MOD,MOD2);
}

ll raand()
{
	ll a=rund();
	a*=RAND_MAX;
	a+=rund();
    return a;
}

#define rand raand

ll raaand()
{
	return raand()*(MOD-7)+raand();
}

template<class T>
vi compress(vector<T>&v)
{
	set<T> s;
	for (auto a: v) s.insert(a);
	vector<T> o(all(s));
	vi nv;
	for (int i=0;i<(int)v.size();++i) nv.pb(lower_bound(all(o),v[i])-o.begin());
	return nv;
}

string to_upper(string a)
{
	for (int i=0;i<(int)a.size();++i) if (a[i]>='a' && a[i]<='z') a[i]-='a'-'A';
	return a;
}

string to_lower(string a)
{
	for (int i=0;i<(int)a.size();++i) if (a[i]>='A' && a[i]<='Z') a[i]+='a'-'A';
	return a;
}

ll sti(string a,int base=10)
{
	ll k=0;
	for (int i=0;i<(int)a.size();++i)
	{
		k*=base;
		k+=a[i]-'0';
	}
	return k;
}

template<class T>
void eras(vector<T>& a,T b)
{
	a.erase(find(a.begin(),a.end(),b));
}

string its(ll k,int base=10)
{
	if (k==0) return "0";
	string a;
	while (k)
	{
		a.push_back((k%base)+'0');
		k/=base;
	}
	reverse(a.begin(),a.end());
	return a;
}

ll min(ll a,int b)
{
	if (a<b) return a;
	return b;
}

ll min(int a,ll b)
{
	if (a<b) return a;
	return b;
}

ll max(ll a,int b)
{
	if (a>b) return a;
	return b;
}

ll max(int a,ll b)
{
	if (a>b) return a;
	return b;
}

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

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

template<class T,class K>
pair<T,K> mp(T a,K b)
{
	return make_pair(a,b);
}

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

inline int pot(int n,int k)
{
	if (k==0) return 1;
	ll a=pot(n,k/2);
	a=mult(a,a);
	if (k%2) return mult(a,n);
	else return a;
}

int divide(int a,int b)
{
	return mult(a,pot(b,MOD-2));
}

inline int sub(int a,int b)
{
	if (a-b>=0) return a-b;
	return a-b+MOD;
}

inline int add(int a,int b)
{
	if (a+b>=MOD) return a+b-MOD;
	return a+b;
}

void ad(int&a,int b)
{
	a+=b;
	if (a>=MOD) a-=MOD;
}

bool prime(ll a)
{
	if (a==1) return 0;
	for (int i=2;i<=round(sqrt(a));++i)
	{
		if (a%i==0) return 0;
	}
	return 1;
}

int dx[]={0,1,0,-1};
int dy[]={1,0,-1,0};
const int N=300010;
int a,b;

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	for (int i=0;i<10;++i) bases.push_back(rand()%(MOD-13893829*2)+13893829);
	cin>>a>>b;
	int s=0;
	for (int i=0;i<a;++i) cout<<900000+i<<' ',s+=900000+i;
	for (int i=0;i<b-1;++i) cout<<-1-i<<' ',s+=-1-i;
	cout<<-s<<endl;
}

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

#define ll long long
#define mp make_pair
#define pb push_back

#define eprintf(...) fprintf(stderr, __VA_ARGS__)
#define rep(i, n) for (int i = 0; i < (int)(n); ++ i)

int fa[200005];
ll sz[200005];

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

void merge(int x, int y) {
	x = find(x), y = find(y);
	if (x == y) return ;
	fa[y] = x;
	sz[x] += sz[y];
}

int main() {
	int n, m;
	scanf("%d %d", &n, &m);
	vector <int> a(n), b(n);
	rep(i, n) scanf("%d", &a[i]);
	rep(i, n) scanf("%d", &b[i]);
	rep(i, n) fa[i] = i, sz[i] = a[i] - b[i];
	rep(i, m) {
		int u, v;
		scanf("%d %d", &u, &v);
		-- u, -- v;
		merge(u, v);
	}
	rep(i, n) if (i == find(i)) {
		if (sz[i] != 0) {
			puts("No");
			return 0;
		}
	}
	puts("Yes");
	return 0;
}


#include <bits/stdc++.h>
using namespace std;
const int MAXN = 105;
int from[MAXN], to[MAXN];
int dp[2 * MAXN];
int r = 0;
int N;
int valid(int l, int r) {
	if (r % 2 == l % 2) return 123456;
	//cerr << "check " << l << " " << r << endl;
	int len = r - l + 1, m = (l + r) / 2;
	vector<bool> can(len / 2, false);
	for (int i = 1; i <= N; i++) {
		if (from[i] != -1 && to[i] != -1) {
			if (from[i] >= l && from[i] <= m && to[i] > m && to[i] <= r && to[i] - from[i] == len / 2) {
				can[from[i] - l] = true;
			}
		} else if (from[i] != -1) {
			if (from[i] >= l && from[i] <= m) {
				if (can[from[i] - l]) {
					//cerr << "INF" << endl;
					return 123456;
				}
				can[from[i] - l] = true;
			}
		} else {
			if (to[i] > m && to[i] <= r) {
				if (can[to[i] - len / 2 - l]) {
					//cerr << "INF" << endl;
					return 123456;
				}
				can[to[i] - len / 2 - l] = true;
			}
		}
	}
	int ans = 0;
	for (int i = 0; i < len / 2; i++) {
		if (can[i]) ans += 1;
	}
	int need = len / 2 - ans;
	//cerr << need << endl;
	return need;
}
int main() {
	cin >> N;
	int real_n = N;
	set<int> vals;
	for (int i = 1; i <= N; i++) {
		cin >> from[i] >> to[i];
		if (from[i] > -1 && to[i] > -1 && from[i] >= to[i]) return 0 * puts("No");
		if (from[i] != -1) {
			if (vals.count(from[i])) return 0 * puts("No");
			vals.insert(from[i]);
		}
		if (to[i] != -1) {
			if (vals.count(to[i])) return 0 * puts("No");
			vals.insert(to[i]);
		}
		if (from[i] == -1 && to[i] == -1) {
			i -= 1;
			N -= 1;
			r += 1;
		}
	}

	dp[0] = 0;
	for (int i = 1; i <= 2 * real_n; i++) {
		dp[i] = 123456;
		for (int j = 1; j <= i; j++) {
			int cur = dp[j - 1] + valid(j, i);
			//cerr << j << " tries " << cur << endl;
			dp[i] = min(dp[i], cur);
		}
		//cerr << "dp_res: " << i << " " << dp[i] << endl;
	}
	cout << (dp[2 * real_n] <= r ? "Yes" : "No") << endl;
	return 0;
}

#include <bits/stdc++.h>
using namespace std;
//using namespace atcoder;
struct fast_ios { fast_ios(){ cin.tie(0); ios::sync_with_stdio(false); cout << fixed << setprecision(20); }; } fast_ios_;
#define FOR(i, begin, end) for(int i=(begin);i<(end);i++)
#define REP(i, n) FOR(i,0,n)
#define IFOR(i, begin, end) for(int i=(end)-1;i>=(begin);i--)
#define IREP(i, n) IFOR(i,0,n)
#define Sort(v) sort(v.begin(), v.end())
#define Reverse(v) reverse(v.begin(), v.end())
#define all(v) v.begin(),v.end()
#define SZ(v) ((int)v.size())
#define Lower_bound(v, x) distance(v.begin(), lower_bound(v.begin(), v.end(), x))
#define Upper_bound(v, x) distance(v.begin(), upper_bound(v.begin(), v.end(), x))
#define chmax(a, b) a = max(a, b)
#define chmin(a, b) a = min(a, b)
#define bit(n) (1LL<<(n))
#define debug(x) cout << #x << "=" << x << endl;
#define vdebug(v) { cout << #v << "=" << endl; REP(i_debug, v.size()){ cout << v[i_debug] << ","; } cout << endl; }
#define mdebug(m) { cout << #m << "=" << endl; REP(i_debug, m.size()){ REP(j_debug, m[i_debug].size()){ cout << m[i_debug][j_debug] << ","; } cout << endl;} }
#define pb push_back
#define fi first
#define se second
#define int long long
#define INF 1000000000000000000
template<typename T> istream &operator>>(istream &is, vector<T> &v){ for (auto &x : v) is >> x; return is; }
template<typename T> ostream &operator<<(ostream &os, vector<T> &v){ for(int i = 0; i < v.size(); i++) { cout << v[i]; if(i != v.size() - 1) cout << endl; }; return os; }
template<typename T1, typename T2> ostream &operator<<(ostream &os, pair<T1, T2> p){ cout << '(' << p.first << ',' << p.second << ')'; return os; }
template<typename T> void Out(T x) { cout << x << endl; }
template<typename T1, typename T2> void chOut(bool f, T1 y, T2 n) { if(f) Out(y); else Out(n); }

using vec = vector<int>;
using mat = vector<vec>;
using Pii = pair<int, int>;
using v_bool = vector<bool>;
using v_Pii = vector<Pii>;

//int dx[4] = {1,0,-1,0};
//int dy[4] = {0,1,0,-1};
//char d[4] = {'D','R','U','L'};

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

signed main(){

    int N; cin >> N;
    vec A(N), B(N);

    vec flg(2 * N + 1, 0), to(2 * N + 1, -1), from(2 * N + 1, -1);
    REP(i, N){
        cin >> A[i] >> B[i];
        /*if(A[i] > 0 && B[i] > 0 && A[i] > B[i]){
            Out("No");
            return 0;
        }*/
        if(A[i] > 0) flg[A[i]] = 1;
        if(B[i] > 0) flg[B[i]] = -1;
        if(A[i] > 0 && B[i] > 0){
            to[A[i]] = B[i];
            from[B[i]] = A[i];
        }
    }
    REP(i, N) REP(j, N){
        if(A[i] > 0 && B[j] > 0 && A[i] == B[j]){
            Out("No");
            return 0;
        }
        if(A[i] > 0 && A[j] > 0 && A[i] == A[j] && i != j){
            Out("No");
            return 0;
        }
        if(B[i] > 0 && B[j] > 0 && B[i] == B[j] && i != j){
            Out("No");
            return 0;
        }
    }

    v_bool pos(2 * N + 1, false);
    pos[0] = true;
    FOR(i, 1, 2 * N + 1){
        FOR(k, 1, N + 1){
            int j = i - 2 * k;
            if(j < 0 || !pos[j]) continue;

            bool ok = true;
            FOR(x, 1, k + 1){
                if(flg[j + x] == -1 || flg[j + k + x] == 1) ok = false;
                else if(flg[j + x] == 1 && flg[j + k + x] == -1){
                    if(to[j + x] != j + k + x || from[j + k + x] != j + x) ok = false;
                }else if(flg[j + x] == 1){
                    if(to[j + x] > 0 && to[j + x] != j + k + x) ok = false;
                }else if(flg[j + k + x] == -1){
                    if(from[j + k + x] > 0 && from[j + k + x] != j + x) ok = false;
                }
            }
            if(ok) pos[i] = true;
        }
    }
    chOut(pos[2 * N], "Yes", "No");

    return 0;
}


#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N = 55;
int n, a[N];
ll mem[N][1<<17];
vector<int> primes;
bool check(int x) {
	for(int i = 2; i*i <= x; ++i)
		if(!(x % i))
			return 0;
	return 1;
}

void init() {
	memset(mem, -1, sizeof mem);
	for(int i = 2; i <= 50; ++i) {
		if(check(i))
			primes.push_back(i);
	}
	//for(int i = 0; i < primes.size(); ++i)
		//cout<<primes[i]<<endl;
}

ll dp(int i, int msk) {
	if(i == n+1)
		return 1;
	ll &ret = mem[i][msk];
	if(ret != -1)
		return ret;
	ret = 2e18;
	for(int j = 0; j < (int)primes.size(); ++j) {

		ll curr = primes[j];

		if(a[i] % curr == 0) {
			if((msk & (1<<j)) == 0)
				ret = min(ret, dp(i+1, (msk | (1<<j))) * curr);
			else
				ret = min(ret, dp(i+1, msk));
		}
	}
	return ret;
}
int main() {
	init();
	scanf("%d", &n);
	for(int i = 1; i <= n; ++i)
		scanf("%d", a+i);
	printf("%lld", dp(1, 0));
	return 0;
}

#include <bits/stdc++.h>
//#include <chrono>
#pragma GCC optimize("O3")
using namespace std;
#define reps(i,s,n) for(int i = s; i < n; i++)
#define rep(i,n) reps(i,0,n)
#define Rreps(i,n,e) for(int i = n - 1; i >= e; --i)
#define Rrep(i,n) Rreps(i,n,0)
#define ALL(a) a.begin(), a.end()

using ll = long long;
using vec = vector<ll>;
using mat = vector<vec>;

ll N,M,H,W,Q,K,A,B;
string S;
using P = pair<ll, ll>;
const ll INF = (1LL<<60);

template<class T> bool chmin(T &a, const T b){
    if(a > b) {a = b; return true;}
    else return false;
}
template<class T> bool chmax(T &a, const T b){
    if(a < b) {a = b; return true;}
    else return false;
}
template<class T> void my_printv(std::vector<T> v,bool endline = true){
    if(!v.empty()){
        for(std::size_t i{}; i<v.size()-1; ++i) std::cout<<v[i]<<" ";
        std::cout<<v.back();
    }
    if(endline) std::cout<<std::endl;
}

vec prime;

int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    reps(i, 2, 51){
        bool pr = true;
        reps(j, 2, i) if(i%j == 0) pr = false;
        if(pr) prime.push_back(i);
    }
    M = 15;
    ll res = INF;
    cin>>N;
    vec a(N);
    rep(i, N) cin>>a[i];
    rep(s, 1<<M){
        ll cmp = 1;
        rep(i, M) if((s>>i)&1) cmp *= prime[i];
        rep(i, N){
            bool ok = false;
            rep(j, M){
                if(((s>>j)&1) && a[i]%prime[j] == 0){
                    ok = true;
                    break;
                }
            }
            if(!ok){
                cmp = -1;
                break;
            }
        }
        if(cmp != -1) chmin(res, cmp);
    }
    cout<<res<<endl;
}


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

ll solve() {
    ll X, Y;
    cin >> X >> Y;
    ll ans = (6-X-Y)%3;
    return ans;
}

int main() {
    auto ans = solve();
    cout << ans << "\n";
    return 0;
}

// #pragma GCC optimize("Ofast,unroll-loops")
// #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2,tune=native")
#include <bits/stdc++.h>
#define ll long long int
#define vi vector<int>
#define vvi vector<vector<int>>
#define vll vector<long long>
#define vs vector<string>
#define vc vector<char>
#define vb vector<bool>
#define forn(i, s, n)  for(ll i=(ll)s; i<(ll)(n); i++)
#define all(c) c.begin(),c.end()
#define pb push_back
#define pll pair<long long int, long long int>
#define pii pair<int, int>
#define pss pair<string, string>
#define ull unsigned long long int
#define lld long double
#define F first
#define S second
#define PI 3.141592653589793238
#define prec(n) fixed<<setprecision(n)
#define ordered_set tree<ll, null_type,less_equal<ll>, rb_tree_tag,tree_order_statistics_node_update>
#define debug(...) fprintf(stderr, __VA_ARGS__), fflush(stderr)
#define itsval(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); itval(_it, args); }
using namespace std;
// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp>
// using namespace __gnu_pbds;

void itval(istream_iterator<string> it) {}
template<typename T, typename... Args>
void itval(istream_iterator<string> it, T a, Args... args) {
    cerr << *it << " = " << a << endl;
    itval(++it, args...);
}
const ll MOD = 1e9 + 7;
template <typename T>
inline void print(T x) {cout << x << "\n";}
template <typename T>
inline void printvec(T x) {for (auto a : x) cout << a << ' '; cout << '\n';}
// -----------------------------------------------------------------------

struct custom {
    bool operator()(const pair<int, pii> &p1, const pair<int, pii> &p2)const {

        return p1.F < p2.F;
    }
};

// Calculate a^b % MOD -------------------------------------------------
ll get_pow(ll a, ll b, ll M = MOD) {
    ll res = 1;
    while (b) {
        if (b & 1) res = (res * a) % M;
        a = (a * a) % M;
        b >>= 1;
    }
    return res;
}
// ---------------------------------------------------------------------
const ll N = 1e3 + 5, inf = 2e18;

void solve()
{
    ll A, B;
    cin >> A >> B;
    A += B;
    if (A >= 15 && B >= 8)
    {
        cout << 1;
    }
    else if (A >= 10 && B >= 3)
    {
        cout << 2;
    }
    else if (A >= 3)
    {
        cout << 3;
    }
    else
        cout << 4;
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output1.txt", "w", stdout);
#endif
    int test = 1;
    //cin >> test;
    clock_t z = clock();

    forn(tes, 0, test)
    {
        // cout << "Case #" << tes + 1 << ": ";
        solve();

    }
    debug("Total Time:%.4f\n", (double)(clock() - z) / CLOCKS_PER_SEC);
    return 0;
}


#include "bits/stdc++.h"
using namespace std;
#define pb push_back
const int maxx = 100005;
int n , c[maxx];
vector<int> edge[maxx];
int asd[maxx];
multiset<int> s;
vector<int> ans;
void dfs(int u)
{
    s.insert(c[u]);
    asd[u] = 1;
    for(int i : edge[u])
    {
        if(!asd[i])
        {
            if(!s.count(c[i])) ans.pb(i);
            dfs(i);
            set<int>:: iterator it = s.lower_bound(c[i]);
            if(it != s.end()) s.erase(it);
        }
    }
}
signed main()
{
    ios_base::sync_with_stdio(false);cin.tie(nullptr);
    cin >> n ;
    for(int i = 1; i <= n; ++i)
    {
        cin >> c[i];
    }
    for(int i = 1 ; i < n ; ++i) {
        int u , v; cin >> u >> v;
        edge[u].pb(v);
        edge[v].pb(u);
    }
    dfs(1);
    ans.pb(1);
    sort(begin(ans),end(ans));
    for(int i : ans ) cout << i << '\n';
    return 0;
}

#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define all(v) v.begin(), v.end()
#define allr(v) v.rbegin(), v.rend()
#define V vector
#define pb push_back
#define eb emplace_back
#define lb lower_bound
#define ub upper_bound
#define mp make_pair
#define sz(x) int(x.size())
#define pcnt __builtin_popcountll
template <typename T> bool chmin(T &a, const T &b) {if(a > b){a = b; return true;} return false;}
template <typename T> bool chmax(T &a, const T &b) {if(a < b){a = b; return true;} return false;}
template <typename T> void print(T a) {cout << a << ' ';}
template <typename T> void printe(T a) {cout << a << endl;}
template <typename T> void printv(T a) {rep(i, sz(a))print(a[i]); cout<<endl;}
template <typename T> void printp(pair<T, T> a) {print(a.first); cout<<a.second<<endl;}
template <typename A, size_t N, typename T> void Fill (A (&array)[N], const T & val) {fill ((T*)array, (T*)(array+N), val);}
template <typename T> using vc = vector<T>;
template <typename T> using vv = vc<vc<T>>;
template <typename T> using vvv = vc<vv<T>>;
using ll = long long;
using P = pair<int, int>;
using Pl = pair<ll, ll>;
using vi = vc<int>;
using vvi = vv<int>;
using vl = vc<ll>;
using vvl = vv<ll>;
vi di = {-1, 1,  0, 0, -1, -1,  1, 1};
vi dj = { 0, 0, -1, 1, -1,  1, -1, 1};

const int MAX_N = 1e5 + 10;
int n;
vi c(MAX_N);
vc<bool> used(MAX_N, false);
vi ans;
vvi to(MAX_N);
void dfs (int now, int p) {
    for (int nxt : to[now]) {
        if (nxt == p) continue;
        if (!used[c[nxt]]) {
            ans.eb(nxt);
            used[c[nxt]] = true;
            dfs(nxt, now);
            used[c[nxt]] = false;
            continue;
        }
        dfs(nxt, now);
    }
}

int main () {
    cin >> n;
    rep(i, n) cin >> c[i];
    rep(i, n-1) {
        int a, b; cin >> a >> b, a--, b--;
        to[a].eb(b);
        to[b].eb(a);
    }
    ans.eb(0);
    used[c[0]] = true;
    dfs(0, -1);
    sort(all(ans));
    rep(i, sz(ans)) cout << ans[i] + 1 << endl;
    return 0;
}


#include<iostream>
#include<vector>
#include<map>
#include<unordered_map>
#include<unordered_set>
#include<string>
#include<cmath>
#include<set>
using namespace std;
int main()
{
    int i ;
    cin >> i ;
    if(i % 2 == 0){
        cout << "White" << endl;
    }
    else{
        cout << "Black" << endl;
    }
}

#include<bits/stdc++.h>
#define ull unsigned long long
#define ll long long
#define F first
#define S second
#define pss pair<string,string>
#define pcc pair<char,char>
#define pll pair<ll,ll>
#define pii pair<int,int>
#define piii pair<int,pii>
#define vi vector<int>
#define vii vector<pii>
#define pb push_back
#define vs vector<string>
#define vl vector<ll>
#define vs vector<string>
#define vll vector<pll>
#define vss vector<pss>
#define vcc vector<pcc>
#define MP make_pair
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,n) for(int i=n-1;i>=0;i--)
#define Very_fast std::ios::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
using namespace std;
const int N = 1e5+5;
const int mod=1e9+7;
const int INF=0x3f3f3f3f;
inline ll gcd(ll a,ll b){if(b==0)return a;else return gcd(b,a%b);}
inline ll lcm(ll a,ll b){return a/gcd(a,b)*b;}
inline ll lowbit(ll x){return (x&-x);}
inline ll kissme(ll x,ll y)
{
	ll res=1;
	if(x==0)return 1;
	if(x==1)return y;
	res=kissme(x/2,y);
	res=res*res%mod;
	if(x%2==1)res=res*y%mod;
	return res;
}
int n;
signed main()
{
	Very_fast;
	cin>>n;
	if(n%2==0)cout<<"White\n";
	else cout<<"Black\n";
	return 0;
}


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

typedef long long ll;

int main(){

    //freopen("D://input.txt", "r", stdin);

    int n, m;
    cin >> n >> m;
    vector<int> v(n);
    vector<int> x(2, 0);
    for(int i = 0; i < n; i++){
        string s;
        cin >> s;
        int total = 0;
        int bit_count = 0;
        for(int j = 0; j < m; j++){
            total *= 2;
            total += s[j]=='1';
            bit_count += s[j]=='1';
        }
        v[i] = total;
        x[bit_count%2]++;
    }

    ll ans = 1LL * x[0] * x[1];
    cout << ans << endl;

}

#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (n); i++)
using namespace std;
using ll = long long;
int main(int argc, char const *argv[])
{
	int n;
	cin >> n;
	vector<int> a(n);
	vector<int> b(n);
	rep(i,n) cin >> a[i];
	rep(i,n) cin >> b[i];
	int cnt = 0;
    for (int i = 0; i <= 1000; ++i)
    {
    	bool ok = true;
    	rep(j,n){
    		if(i < a[j] || i > b[j] ){
               ok = false;
    		}
    	}
    	if(ok) cnt++;
    }
    cout << cnt << endl;
	return 0;

}


#include <iostream>
using namespace std;

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

#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = double;
const int mxn  = 1e6+10;
bool mt[20][20];
int h, w,a , b;
ll ans = 0;

void rec(int i=0, int j=0, int a0=0) {
	//cout << "[" << i << ", " << j << ", " << a0 << "]\n";
	if(a0>a or i>=h or j>=w) return;
	if(i==h-1 and j==w-1) {
		if(a==a0) {
			/*cout << "mat: \n";
			for(int x=0; x<h; x++) {
				for(int y=0; y<w; y++) cout << mt[x][y] <<  " "; cout << '\n';
			}*/
			ans++;
		}
		return;
	}
	if(!mt[i][j]) {
		if(j+1<w) rec(i, j+1, a0);
		else rec(i+1, 0, a0);

		if(j+1<w and !mt[i][j+1]) mt[i][j] = mt[i][j+1] = 1, rec(i, j+1, a0+1), mt[i][j] = mt[i][j+1] = 0;
		if(i+1<h and !mt[i+1][j]) {
			mt[i][j] = mt[i+1][j] = 1;
			if(j+1<w) rec(i, j+1, a0+1);
			else rec(i+1, 0, a0+1);
			mt[i][j] = mt[i+1][j] = 0;
		}
	}
	else {
		if(j+1<w) rec(i, j+1, a0);
		else rec(i+1, 0, a0);
	}
}

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

	cin>>h>>w>>a>>b;
	rec();
	cout << ans << '\n';

	return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define int long long
typedef pair<int,int> pi;
#define f first
#define s second
#define FAST ios_base::sync_with_stdio(0); cin.tie(0);
#define all(x) x.begin(),x.end()
typedef pair<int, pi> pii;

const int maxn = 10000;
const int INF = LLONG_MAX/2;

int n,K,mod;
int dp[110][510000];

int32_t main() {
	FAST
	cin >> n >> K >> mod;

	int maxv = K * n * (n + 1) / 2;

	dp[0][0] = 1;
	for (int i = 1; i <= n; i++) {
		vector <int> temp(i+1,0);
		int s = 0;

		for (int sum = 0; sum <= maxv; sum++) {
			while (s < sum - i * K) {
				int indx = s % i;
				temp[indx] = (temp[indx] - dp[i-1][s] + mod) % mod;
				s++;
			}

			int indx = sum % i;
			temp[indx] = (temp[indx] + dp[i-1][sum]) % mod;
			dp[i][sum] = (dp[i][sum] + temp[indx]) % mod;
		}
	}

	for (int avg = 1; avg <= n; avg++) {
		int ans = 0;
		for (int sum = 0; sum <= maxv; sum++) {
			ans += (dp[avg - 1][sum] * dp[n - avg][sum]) % mod;
			ans %= mod;
		}
		ans = (ans * (K+1)) % mod;
		ans = (ans - 1 + mod) % mod;
		cout << ans << "\n";
	}

}

#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(1)<<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(N);
    vl fib(92, 1);
    for(int i = 2; i < 92; i++) {
        fib.at(i) = fib.at(i - 1) + fib.at(i - 2);
    }
    vl fibs(92, 1);
    ll memo = N;
    for(int i = 0; i < 92; i++) {
        int j = 91 - i;
        fibs.at(j) = N/fib.at(j);
        N %= fib.at(j);
    }
    vl fibsc(30, 1);
    for(int i = 0; i < 30; i++) {
        fibsc.at(i) = i;
    }
//    VECCOUT(fibsc);
//    VECCOUT(fibs);
    queue<int> ans;
    bool c = 0;
    int KKK = 1;
    for(int i = 1; i < 92 - KKK; i++) {
        int j = 91 - i;
        if(fibs.at(j) && c) {
            ans.push(2 - (i)%2);
        }
        if(c) {
            ans.push(4 - (i + 1)%2);
        }
        if(fibs.at(j) && !c) {
            ans.push(1);
            ans.push(2);
            c = 1;
        }
    }
    cout << ans.size() << endl;
    while(ans.size()) {
        ll tmp = ans.front();
        ll res = tmp;
        cout << res << endl;
        ans.pop();
    }

}

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


#include <iostream>
#include <fstream>
#include <cstdio>
#include <cstdlib>
#include <cassert>
#include <climits>
#include <ctime>
#include <numeric>
#include <vector>
#include <algorithm>
#include <bitset>
#include <cmath>
#include <cstring>
#include <iomanip>
#include <complex>
#include <deque>
#include <functional>
#include <list>
#include <map>
#include <string>
#include <sstream>
#include <set>
#include <unordered_set>
#include <unordered_map>
#include <stack>
#include <queue>
#include <forward_list>
#include <thread>
#include <random>
#include <array>
using namespace std;
typedef long long ll;
typedef long double ld;
#define pb push_back
void io()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
}
int main()
{
    io();
    int si,sj; cin>>si>>sj;
    int pos[50][50];
    for(int i=0; i<50; i++){
      for(int j=0; j<50; j++){
        cin>>pos[i][j];
      }
    }
    bool chek[3000];
    memset(chek,false,sizeof(chek));
    int arr[50][50];
    for(int i=0; i<50; i++){
      for(int j=0; j<50; j++){
        cin>>arr[i][j];
      }
    }
    string str="";
    chek[pos[si][sj]]=true;
    while(true){
      int qwe=-1;
      char keeper=' ';
      if(si!=0 && !chek[pos[si-1][sj]]){

        if(arr[si-1][sj]>=qwe){qwe=arr[si-1][sj]; keeper='U';}
      }
      if(si!=49 && !chek[pos[si+1][sj]]){

        if(arr[si+1][sj]>=qwe){qwe=arr[si+1][sj]; keeper='D';}
      }
      if(sj!=0 && !chek[pos[si][sj-1]]){

        if(arr[si][sj-1]>=qwe){qwe=arr[si][sj-1]; keeper='L';}
      }
      if(sj!=49 && !chek[pos[si][sj+1]]){

        if(arr[si][sj+1]>=qwe){qwe=arr[si][sj+1]; keeper='R';}
      }
      if(qwe==-1){
        break;
      }
      if(keeper=='U'){
        chek[pos[si-1][sj]]=true;
        si--;
        str+=keeper;
      }
      else if(keeper=='D'){
        chek[pos[si+1][sj]]=true;
        si++;
        str+=keeper;
      }
      else if(keeper=='L'){
        chek[pos[si][sj-1]]=true;
        sj--;
        str+=keeper;
      }
      else if(keeper=='R'){
        chek[pos[si][sj+1]]=true;
        sj++;
        str+=keeper;
      }
    }
    cout<<str<<endl;
}
//Aneegha Thithiesha Mahabaduge.

/*
 * Author : Andrew J
*/
#include <bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define all(x) x.begin() , x.end()
#define rall(x) x.rbegin() , x.rend()
#define vz(x) x.size()
using ll = long long;
using ii = pair <int , int>;
void in(int &x);
// const int N = ;
const int INF = 1e9 + 50;
const int MOD = 1e9 + 7;

int f(int x) {
  vector <int> dig, desc, asc;

  while (x) {
    dig.pb(x % 10);
    x /= 10;
  }

  desc = dig, asc = dig;
  sort(all(asc));
  sort(rall(desc));

  int desc_int = 0, asc_int = 0;

  {
    int tens = 1;
    for (int x : desc) {
      asc_int += x * tens;
      tens *= 10;
    }
  }

  {
    int tens = 1;
    for (int x : asc) {
      desc_int += x * tens;
      tens *= 10;
    }
  }

  return desc_int - asc_int;
}

int main() {
  int n, k; scanf("%d%d", &n, &k);

  while (k--) {
    n = f(n);
  }

  printf("%d\n", n);
  return 0;
}

void in(int &x){
  bool neg = false;
  register int c;
  x = 0;
  c = getchar();
  if(c == '-'){
    neg = true;
    c = getchar();
  }
  for (; c > 47 && c < 58; c = getchar()) {
    x = (x << 1) + (x << 3) + c - 48;
  }
  if (neg) x *= -1;
}


#include<bits/stdc++.h>
#define ls rt << 1
#define rs rt << 1 | 1
#define lson l , mid , rt << 1
#define rson mid + 1, r, rt << 1 | 1
#define lr2 (l + r) >> 1
using namespace std;
typedef long long ll;
const int maxn = 4e5 + 50;
ll sum[maxn << 2], lazy[maxn << 2];
int L[maxn], R[maxn];
void push_up(int rt){
    sum[rt] = sum[ls] + sum[rs];
}
void push_down(int rt, int m){
    if(lazy[rt])
	{
		lazy[ls] += lazy[rt];
		lazy[rs] += lazy[rt];
		sum[ls] += lazy[rt] * (m - (m >> 1));
		sum[rs] += lazy[rt] * (m >> 1);
		lazy[rt] = 0;
	}
}
void update(int a, int b, ll v, int l, int r, int rt){
    if(a <= l && b >= r){
        sum[rt] += 1LL * (r - l + 1) * v;
        lazy[rt] += v;
        return;
    }
    push_down(rt, r - l + 1);
    int mid = lr2;
    if(a <= mid) update(a, b, v, lson);
    if(b > mid) update(a, b, v, rson);
    push_up(rt);
}
ll query(int a, int b, int l, int r, int rt){
    if(a <= l && b >= r){
        return sum[rt];
    }
    int mid = lr2;
    push_down(rt, r - l + 1);
    ll ans = 0;
    if(a <= mid) ans += query(a, b, lson);
    if(b > mid) ans += query(a, b, rson);
    return ans;
    push_up(rt);
}
int a[maxn], b[maxn];
int cnt, n;
vector<int> G[maxn];
int d[maxn];
void dfs(int v, int fa){
    L[v] = ++cnt;
    d[v] = d[fa] + 1;
    for(auto u : G[v]){
        if(u != fa){
            dfs(u, v);
        }
    }
    R[v] = cnt;
}
int main()
{
    std::ios::sync_with_stdio(false);
    cin >> n;
    for(int i = 1;i < n;i++){
        cin >> a[i] >> b[i];
        G[a[i]].push_back(b[i]);
        G[b[i]].push_back(a[i]);
    }
    dfs(1, 0);
    int q;
    cin >> q;
    ll ans = 0;
    while(q--){
        int t, id;
        ll x;
        cin >> t >> id >> x;
        if(t == 1){
            if(d[a[id]] < d[b[id]]){
                ans += x;
                update(L[b[id]], R[b[id]], -x, 1, n, 1);
            }
            else update(L[a[id]], R[a[id]], x, 1, n, 1);
        }
        else{
            if(d[b[id]] < d[a[id]]){
                ans += x;
                update(L[a[id]], R[a[id]], -x, 1, n, 1);
            }
            else update(L[b[id]], R[b[id]], x, 1, n, 1);
        }
    }
    for(int i = 1;i <= n;i++) cout << query(L[i], L[i], 1, n ,1) + ans << endl;
    return 0;
}

#include<bits/stdc++.h>
using namespace std;
bool _DD = false;
#define _D(a)if(_DD)cout<<#a<<':'<<a<<" | ";
#define DBG(a){_D(a);if(_DD)cout<<'\n';}
#define DBG2(a,b){_D(a);_D(b);if(_DD)cout<<'\n';}
#define DBG3(a,b,c){_D(a);_D(b);_D(c);if(_DD)cout<<'\n';}
#define DBG4(a,b,c,d){_D(a);_D(b);_D(c);_D(d);if(_DD)cout<<'\n';}
#define DBG5(a,b,c,d,e){_D(a);_D(b);_D(c);_D(d);_D(e);if(_DD)cout<<'\n';}
#define DBG6(a,b,c,d,e,f){_D(a);_D(b);_D(c);_D(d);_D(e);_D(f);if(_DD)cout<<'\n';}
#define PB push_back
#define EB emplace_back
#define btoe(v) (v).begin(),(v).end()
#define etob(v) (v).rbegin(),(v).rend()
#define F first
#define S second
#define SZ size()

typedef unsigned long long int ulli;
typedef long long int lli;
typedef long double ldbl;
#define f(i,a,b) for(int i=(a); i<(b); ++i)
#define fr(i,a,b) for(int i=(a); i>(b); --i)
#define fl(i,a,b) for(lli i=(a); i<(b); ++i)
#define flr(i,a,b) for(lli i=(a); i>(b); --i)
#define w(x) lli x; cin>>x; while(x--)
#define inpn(n,v,T) T n; cin>>n; vector<T> v(n); fl(i,0,n) cin>>v[i];
#define inp(n,v,T) vector<T> v(n); fl(i,0,n) cin>>v[i];

typedef pair<int,int> pii;typedef vector<int> vi;typedef vector<vi> vvi;typedef vector<pii> vpii;typedef vector<vector<pii>> vvpii;typedef pair<lli,lli> plli;typedef vector<lli> vlli;typedef vector<vlli> vvlli;typedef vector<plli> vplli;typedef vector<vector<plli>> vvplli;typedef vector<bool> vb;typedef vector<vb> vvb;typedef vector<string> vs;typedef vector<vector<string>> vvs; typedef vector<char> vc; typedef vector<vc> vvc;
#define unmp unordered_map

const lli PRIME = 1000000007ll;
const lli PRIME2 = 998244353ll;

inline void debugORfast(bool a=0,bool b=1){
    if(a) _DD=1;
    if(b){ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);}
}

//Question Link
class mysort{
    public:
	bool operator() (const plli &p1, const plli &p2){
	    if(p1.F+p1.S>p2.F+p2.S) return true;
	    else if(p1.F+p1.S==p2.F+p2.S){
		if(p1.F>p2.F) return true;
	    	else return false;
	    }
	    else return false;
	}
}mysorto;

vi times;
vlli ans;
void dfsh(const vvi &g, int n, int p, int &t, const vlli &c, vb &vis){
    vis[n] = true;
    times[n] = t++;
    ans[n] = ans[p]+c[n];
    for(int ch:g[n]){
	if(ch!=p and !vis[ch]) dfsh(g,ch,n,t,c,vis);
    }
}

void dfs(const vvi &g, const vlli &c){
    times.clear();
    times.resize(g.size(),0);
    ans.clear();
    ans.resize(g.size(),0);
    vb vis(g.size(),false);
    int t = 0;
    dfsh(g,1,0,t,c,vis);
}

int main(int argc,char* argv[])
{
    if(argc>1 and strcmp(argv[1],"1")==0) debugORfast(1,1);
    else debugORfast(0,1);

    /*
       int n; cin>>n;
       lli asum = 0;
       vplli v(n);
       f(i,0,n){
       cin>>v[i].F>>v[i].S;
       asum += v[i].F;
       }
       sort(btoe(v),mysorto);

    //f(i,0,n){
    //    cout<<v[i].F<<'-'<<v[i].S<<endl;
    //}

    lli bsum = 0,asumsmall=0;
    f(i,0,n){
    asumsmall += v[i].F;
    bsum += (v[i].F+v[i].S);
    if(bsum>(asum-asumsmall)){
    cout<<i+1<<endl;
    break;
    }
    }
    */

    int n; cin>>n;
    vvi g(n+1);
    vpii e(n+1);
    f(i,1,n){
	int a,b; cin>>a>>b;
	e[i].F = a; e[i].S = b;
	g[a].PB(b);
	g[b].PB(a);
    }

    vlli c(n+1,0);
    dfs(g,c); //pops times

    //f(i,1,times.SZ) cout<<times[i]<<' '; cout<<endl;

    w(qq){
	lli t,ei,x;
	cin>>t>>ei>>x;

	int a = e[ei].F;
	int b = e[ei].S;

	//cout<<a<<' '<<b<<endl;

	if(t==2) swap(a,b);

	if(times[a]<times[b]){
	    c[1]+=x; c[b]-=x;
	}else{
	    c[a]+=x;
	}
    }

    //f(i,1,c.SZ) cout<<c[i]<<' '; cout<<endl;

    dfs(g,c);

    f(i,1,ans.SZ){
        cout<<ans[i]<<endl;
    }

    return 0;
}


//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i=0; i<n; ++i)
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
using ll = int64_t;
using ull = uint64_t;
using ld = long double;
using P = pair<int, int>;
using vs = vector<string>;
using vi = vector<int>;
using vvi = vector<vi>;
template<class T> using PQ = priority_queue<T>;
template<class T> using PQG = priority_queue<T, vector<T>, greater<T>>;
const int INF = 0xccccccc;
const ll LINF = 0xcccccccccccccccLL;
template<typename T1, typename T2>
inline bool chmax(T1 &a, T2 b) {return a < b && (a = b, true);}
template<typename T1, typename T2>
inline bool chmin(T1 &a, T2 b) {return a > b && (a = b, true);}
template<typename T1, typename T2>
istream &operator>>(istream &is, pair<T1, T2> &p) { return is >> p.first >> p.second;}
template<typename T1, typename T2>
ostream &operator<<(ostream &os, const pair<T1, T2> &p) { return os << p.first << ' ' << p.second;}

//head

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int h, w, a, b;
  cin >> h >> w >> a >> b;
  vector<vector<vvi>> dp(h+1, vector<vvi>(w+1, vvi(1<<w, vi(a+1))));
  dp[0][0][0][0] = 1;
  rep(i, h) {
    rep(j, w) {
      rep(k, 1<<w) {
        rep(l, a+1) {
          dp[i][j+1][k&~(1<<j)][l] += dp[i][j][k][l];
          if(~k>>j&1 and l != a) {
            if(j != w-1 and ~k>>j+1&1) dp[i][j+1][k^(1<<j+1)][l+1] += dp[i][j][k][l];
            dp[i][j+1][k^(1<<j)][l+1] += dp[i][j][k][l];
          }
        }
      }
    }
    rep(k, 1<<w) {
      rep(l, a+1) {
        dp[i+1][0][k][l] = dp[i][w][k][l];
      }
    }
  }
  cout << dp[h][0][0][a] << endl;
}

//================code===================//

//#define TLE

#ifdef TLE
#pragma GCC optimize("O3")
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#endif

#include <bits/stdc++.h>
#include <unordered_map>
#include <unordered_set>
#include <random>
#include <ctime>

#define ci(t) cin>>t
#define co(t) cout<<t
#define LL long long

#define ld double
#define fa(i,a,b) for(LL i=(a);i<(LL)(b);++i)
#define fd(i,a,b) for(LL i=(a);i>(LL)(b);--i)
#define setp tuple<LL,LL,LL>
#define setl pair<LL,LL>
#define micro 0.000001

using namespace std;

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

#ifdef OHSOLUTION
#define ce(t) cerr<<t
#define AT cerr << "\n=================ANS=================\n"
#define AE cerr << "\n=====================================\n"
#define DB(a) cerr << __LINE__ << ": " << #a << " = " << (a) << endl;
#define __builtin_popcount __popcnt
#define __builtin_popcountll __popcnt64
#else
#define AT
#define AE
#define ce(t)
#endif

pair <int, int> vu[9] = { {0,-1},{1,0},{0,1} ,{-1,0},{0,0},{1,1}, {-1,1} , {1,-1},{-1,-1} }; //RDLU EWSN

template<typename T, typename U> void ckmax(T& a, U b) { a = a < b ? b : a; }
template<typename T, typename U> void ckmin(T& a, U b) { a = a > b ? b : a; }
struct gcmp { bool operator()(LL a, LL b) { return a < b; } bool operator()(setl& a, setl& b) { return a.second < b.second; } };
struct lcmp { bool operator()(LL a, LL b) { return a > b; } bool operator()(setl& a, setl& b) { return a.second > b.second; } };

const int max_v = 1e4 + 7;
const int max_k = 1027;
const int INF = 1e9 + 7;
const LL LNF = (LL)5e18 + 7ll;
LL mod = 1e9+7;
template<typename T, typename U> void MOD(T& a, U b) { a += b; if (a >= mod) a -= mod; }

int r, c;
int ans = 0;
bool arr[17][17];

void dfs(int idx, int a, int b)
{
	if (a < 0 || b < 0) return;

	if (idx == r*c)
	{
		++ans;
		return;
	}

	int nr = idx / c;
	int nc = idx % c;

	if (arr[nr][nc]) dfs(idx + 1, a, b);
	else
	{
		if (nr + 1 != r)
		{
			arr[nr + 1][nc] = 1;
			dfs(idx + 1, a - 1, b);
			arr[nr + 1][nc] = 0;
		}

		if (nc + 1 != c && !arr[nr][nc+1])
		{
			arr[nr][nc + 1] = 1;
			dfs(idx + 1, a - 1, b);
			arr[nr][nc + 1] = 0;
		}

		dfs(idx + 1, a, b - 1);
	}
}

int main()
{
#ifdef OHSOLUTION
	freopen("input.txt", "r", stdin);
#endif
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	int a, b; ci(r >> c >> a >> b);

	dfs(0, a, b);
	co(ans);
	return 0;
}


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

using ll= long long;
// #define double long double
#define sz(x) (int)x.size()
#define all(x) (x).begin(),(x).end()
#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define _set(x) __builtin_popcount(x)
#define _setl(x) __builtin_popcountll(x)
#define PI  3.14159265358979323846264338327950L
#define mod 1000000007LL

#ifdef LOCAL
	#define elapsed_time      1.0 * clock() / CLOCKS_PER_SEC
#endif

void debug(){
	cerr<<"]\n";
}
template<class H,class ... T> void debug(H h,T... t){
	cerr<<h;
	if(sizeof... (t)){
		cerr<<", ";
	}
	debug(t...);
}

mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());

#ifdef DEBUG
	#define dbg(...) cerr << "LINE(" << __LINE__ << ") -> [" << #__VA_ARGS__ << "]: [", debug(__VA_ARGS__)
	#define dpv(...) cerr<< "["#__VA_ARGS__ " : ";for(int i: (__VA_ARGS__)){cerr<<i<<" ";}cerr<<"]\n"
#else
	#define dbg(...) 0
	#define dpv(...) 0
#endif

void solve(){
	int v, t,s ,d;
	cin>>v>>t>>s>>d;
	t *= v;
	s *= v;
	if(s< t) swap(s, t);
	if(!(d<= s && d>= t)){
		cout<<"Yes\n";
	}else{
		cout<<"No\n";
	}
}

int32_t main(){
	IOS
	// freopen("input.txt","r",stdin);
	int _;
	// cin>>_;
	_=1;
	for(int i=1;i<=_;i++){
		// cout<<"Case #"<<i<<": ";
		solve();
	}
	#ifdef LOCAL
		cerr<<endl<<"[Time Elapsed : "<<elapsed_time<<"]"<<endl;
	#endif
	return 0;
}

/*
   check for overflows int long long
   correct mize of array
*/

#include<bits/stdc++.h>
#define ll long long
using namespace std;
int main()
{
    double v,t,s,d;
    cin>>v>>t>>s>>d;
    double x = d/v;
    if(x<t||x>s)puts("Yes");
    else puts("No");
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define pb push_back
#define vll vector<ll>
#define pll pair<ll,ll>
#define vpll vector<pll>
#define ub upper_bound
#define lb lower_bound
#define all(v) ((v).begin()),((v).end())
#define allr(v) ((v).rbegin()),((v).rend())
#define ff first
#define ss second
#define mp make_pair
#define pll pair<ll,ll>
#define fo(i,n) for(ll i=0;i<n;i++)
#define foa(i,s,e) for(ll i=(s);i<=e;i++)
#define fod(i,s,e) for(ll i= (s);i>=(e);i--)
#define max3(a,b,c) max(max(a,b),c)
#define min3(a,b,c) min(min(a,b),c)
#define deb(x) cerr<<#x<<' '<<'='<<' '<<x<<'\n'
#define sz(x) (ll)(x.size())
#define ANS cout<<ans<<'\n'
#define YES cout<<"YES\n"
#define NO cout<<"NO\n"
#define Yes cout<<"Yes\n"
#define No cout<<"No\n"
const ld pi = 3.14159265358979323846;
ll MOD = 1e9 + 7;
//ll MOD = 998244353;
const char nl = '\n';
const ll inf = 1e15;
#define fill(a,b) memset(a, b, sizeof(a))
#define setbits(x) __builtin_popcountll(x)
#define print2d(dp,n,m) fo(i, n){fo(j, m)cout<<dp[i][j]<<" ";cout<<"\n";}
ll nxt(){ll x; cin >> x; return x;}
ll mul(ll x,ll y){
    return (1ll* (x%MOD)*(y%MOD));
}
ll modpow(ll x,ll y){ll z=1;while(y>0){if(y%2)z=mul(z,x);x =mul(x,x) ;y/=2;}return z;}
ll power(ll x,ll y){ll z=1;while(y>0){if(y%2)z=z*x;x =x*x ;y/=2;}return z;}
ll gcd(ll a,ll b){if(a<b) return gcd(b,a);if(b==0) return a;return gcd(b,a%b);}
ll min(ll a,ll b){if(a<b)return a;return b;}
ll max(ll a,ll b){if(a>b)return a;return b;}
ll sq(ll a){
    ll ans = (1ll*a*a);
    return ans;
}
void solve(){
    ll n, m;
    cin >> n >> m;
    ll a[m][2];
    fo(i, m){
        cin >> a[i][0] >> a[i][1];
    }
    ll k;
    cin >> k;

    ll c[k][2];
    fo(i, k){
        cin >> c[i][0] >> c[i][1];
    }
    ll ans = 0;
    ll tot = (1LL << k);
    fo(i, tot){
        vll ok(n + 1);
        fo(j, k){
            if((i >> j) & 1){
                ok[c[j][1]] = 1;
            }
            else{
                ok[c[j][0]] = 1;
            }
        }
        ll cnt = 0;
        fo(j, m){
            if(ok[a[j][0]] && ok[a[j][1]]){
                cnt++;
            }
        }
        ans = max(ans, cnt);
    }
    ANS;
}
int main(){
    ios::sync_with_stdio(false);
    cin.tie(0),cout.tie(0);
    #ifndef ONLINE_JUDGE
    freopen("input.txt" , "r" , stdin) ;
    freopen("output.txt" , "w" , stdout) ;
    freopen("error.txt" , "w" , stderr) ;
    #endif
    ll TC = 1;
    //cin>>TC;
    fo(TT, TC){
        // Google,FB cout << "Case #"<< TT + 1 << ": ";
        solve();
    }
    cerr << "Time : " << 1000 * ((double)clock()) / (double)CLOCKS_PER_SEC << "ms\n";
}

#include "bits/stdc++.h"
using namespace std;
#define int               long long
#define pb                push_back
#define pf                push_front
#define ppf               pop_front
#define ppb               pop_back
#define ff                first
#define s(num)            to_string(num)
#define ss                second
#define mp(a,b)           make_pair(a,b)
#define pii               pair<int,int>
#define vi                vector<int>
#define mem1(a)           memset(a,-1,sizeof(a))
#define mem0(a)           memset(a,0,sizeof(a))
#define ssort(v)          sort(v.begin(),v.end())
#define rsort(v)          sort(v.rbegin(),v.rend())
#define start(t)          int x;cin>>x;while(x--)
#define endl              "\n"
#define all(x)            (x).begin(),(x).end()

void rec(vector<pii>& v, vector<pii>& p, int &cnt, int idx, unordered_map<int, int> um) {
    if (idx >= p.size()) {
        int q = 0;
        for (pii x : v) {
            if (um[x.ff] && um[x.ss])
                q += 1;
        }
        cnt = max(cnt, q);
        return;
    }
    um[p[idx].ff] += 1;
    rec(v, p, cnt, idx + 1, um);
    um[p[idx].ff] -= 1;
    um[p[idx].ss] += 1;
    rec(v, p, cnt, idx + 1, um);
    um[p[idx].ss] -= 1;
}
int32_t main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
#ifdef NCR
    init();
#endif
    int n, m; cin >> n >> m;
    vector<pii> v;
    for (int i = 0; i < m; i++) {
        int x, y; cin >> x >> y;
        v.pb(mp(x, y));
    }
    int k; cin >> k;
    vector<pii> p;
    unordered_map<int, int> um;
    for (int i = 0; i < k; i++) {
        int a, b;
        cin >> a >> b;
        p.push_back(mp(a, b));
    }
    int cnt = INT_MIN;
    rec(v, p, cnt, 0, um);
    cout << cnt << endl;
}


#include <bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define R cin>>
#define ll long long
#define ln cout<<'\n'
#define in(a) insert(a)
#define pb(a) push_back(a)
#define pd(a) printf("%.10f\n",a)
#define mem(a) memset(a,0,sizeof(a))
#define all(c) (c).begin(),(c).end()
#define iter(c) __typeof((c).begin())
#define rrep(i,n) for(ll i=(ll)(n)-1;i>=0;i--)
#define REP(i,m,n) for(ll i=(ll)(m);i<(ll)(n);i++)
#define rep(i,n) REP(i,0,n)
#define tr(it,c) for(iter(c) it=(c).begin();it!=(c).end();it++)
ll check(ll n,ll m,ll x,ll y){return x>=0&&x<n&&y>=0&&y<m;}void pr(){ln;}
template<class A,class...B>void pr(const A &a,const B&...b){cout<<a<<(sizeof...(b)?" ":"");pr(b...);}
template<class A>void PR(A a,ll n){rep(i,n)cout<<(i?" ":"")<<a[i];ln;}
const ll MAX=1e9+7,MAXL=1LL<<61,dx[8]={-1,0,1,0,-1,-1,1,1},dy[8]={0,1,0,-1,-1,1,1,-1};
typedef pair<ll,ll> P;

void Main() {
  ll x;
  R x;
  pr(100-x%100);
}

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

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

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

  cout << 100 - X % 100 << endl;
  return 0;
}


// RioTian 21/03/15
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int N = 2e5 + 10;
int dp[N][7];
int main() {
    ios_base::sync_with_stdio(false), cin.tie(0);
    int n;
    string s, t;
    cin >> n >> s >> t, s = " " + s, t = " " + t;
    dp[n][0] = 1;
    for (int i = n; i >= 1; --i) {
        for (int j = 0; j < 7; ++j) {
            int a = dp[i][(j * 10 + s[i] - '0') % 7];
            int b = dp[i][j * 10 % 7];
            if (t[i] == 'A') dp[i - 1][j] = a & b;
            else
                dp[i - 1][j] = a | b;
        }
    }
    cout << (dp[0][0] ? "Takahashi\n" : "Aoki\n");
    return 0;
}

#include<bits/stdc++.h>
using namespace std;
const  int N=2e5+10;
bool f[N][7];
int X[N];
char op[N];
int n;
int qpow(int p,int q){
	int ans=1;
	while(q){
		if(q&1)ans=ans*p%7;
		q>>=1;
		p=p*p%7;
	}
	return ans;
}
int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);cout.tie(0);
	cin>>n;
	char cc;
	for(int i=1;i<=n;++i){
		cin>>cc;
		X[i]=(cc-'0')*qpow(10,n-i)%7;
	}
	cin>>(op+1);
	f[n][0]=1;
	for(int i=n-1;i>=0;i--){
		if(op[i+1]=='A'){
			for(int j=0;j<7;++j){
				if((f[i+1][(j+X[i+1])%7])&&(f[i+1][j]))f[i][j]=1;
			}
		}
		else{
			for(int j=0;j<7;++j){
				if(f[i+1][(j+X[i+1])%7]||f[i+1][j])f[i][j]=1;
			}
		}
	}
	if(f[0][0])cout<<"Takahashi\n";
	else cout<<"Aoki\n";

    return 0;
}


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

int func(int a, int b, int c, int d) {
	if (a >= b) {
		if (a >= c) {
			if (a >= d) {
				return 0;
			}
			else {
				return 3;
			}
		}
		else {
			if (c >= d) {
				return 2;
			}
			else {
				return 3;
			}
		}
	}
	else {
		if (b >= c) {
			if (b >= d) {
				return 1;
			}
			else {
				return 3;
			}
		}
		else {
			if (c >= d) {
				return 2;
			}
			else {
				return 3;
			}
		}
	}
}

int main(void) {
	int si, sj;

	vector<vector<int>> t(50, vector<int>(50));
	vector<vector<int>> p(50, vector<int>(50));

	cin >> si >> sj;

	for (int i = 0; i < 50; ++i) {
		for (int j = 0; j < 50; ++j) {
			cin >> t[i][j];
		}
	}
	for (int i = 0; i < 50; ++i) {
		for (int j = 0; j < 50; ++j) {
			cin >> p[i][j];
		}
	}

	int c;

	for (;;) {

		int up = -1;
		int down = -1;
		int left = -1;
		int right = -1;

		if (si > 0 && t[si][sj] != t[si - 1][sj]) {
			up = p[si - 1][sj];
		}
		if (si < 49 && t[si][sj] != t[si + 1][sj]) {
			down = p[si + 1][sj];
		}
		if (sj > 0 && t[si][sj] != t[si][sj - 1]) {
			left = p[si][sj - 1];
		}
		if (sj < 49 && t[si][sj] != t[si][sj + 1]) {
			right = p[si][sj + 1];
		}

		int m = func(up, down, left, right);

		if (up == -1 && down == -1 && left == -1 && right == -1) {
			return 0;
		}

		c = t[si][sj];

		if (m == 0) {
			cout << "U";
			--si;
		}
		else if (m == 1) {
			cout << "D";
			++si;
		}
		else if (m == 2) {
			cout << "L";
			--sj;
		}
		else if (m == 3) {
			cout << "R";
			++sj;
		}

		int c2 = t[si][sj];

		if (si > 0 && c2 == t[si - 1][sj]) {
			t[si - 1][sj] = c;
		}
		if (si < 49 && c2 == t[si + 1][sj]) {
			t[si + 1][sj] = c;
		}
		if (sj > 0 && c2 == t[si][sj - 1]) {
			t[si][sj - 1] = c;
		}
		if (sj < 49 && c2 == t[si][sj + 1]) {
			t[si][sj + 1] = c;
		}

		t[si][sj] = c;

	}

	return 0;
}

#include <bits/stdc++.h>
#include <iostream>
#include <vector>
#include <cmath>
#include <ctime>
#include <cassert>
#include <cstdio>
#include <queue>
#include <set>
#include <map>
#include <fstream>
#include <cstdlib>
#include <string>
#include <cstring>
#include <algorithm>
#include <numeric>
using namespace std;

#define FIO                           \
    ios_base::sync_with_stdio(false); \
    cin.tie(NULL);                    \
    cout.tie(NULL)
#define mp make_pair
#define fi first
#define se second
#define gcd(a, b) __gcd((a), (b))
#define lcm(a, b) (((a) * (b)) / (__gcd((a), (b))))
#define in_range(x, y, r, c) (x < r && y < c && x >= 0 && y >= 0)
#define setbits(x) __builtin_popcountll(x)
#define unsetend(x) __builtin_ctzll(x)
#define unsetfront(x) __builtin_clzll(x)
#define f first
#define s second
#define pb push_back
#define pf push_front
#define ll long long
#define all(a) a.begin(), a.end()
#define sd(x) scanf("%d", &x) // to use this make sure to remove ios_base....
#define sll(x) scanf("%lld", &x)
#define endl "\n"
#define Endl "\n"
#define INF INT_MAX

long long expo(long long a, long long b, long long m)
{
    ll ret = 1;
    while (b > 0)
    {
        if (b % 2 == 1)
            ret = ((ret % m) * (a % m)) % m;

        a = (a % m) * (a % m);
        b = b / 2;
    }
    return ret;
}

vector<long long> seive()
{
    long long i, j;
    vector<long long> hash(1000001, 1);
    vector<long long> primes;

    for (i = 2; i * i <= 1000000; i++)
    {
        if (hash[i])
        {
            for (j = i * i; j <= 1000000; j += i)
                hash[j] = 0;
        }
    }
    for (i = 2; i < 1000001; i++)
    {
        if (hash[i])
            primes.pb(i);
    }
    return primes;
}

int main()
{
    FIO;
    int n, m;
    cin >> n >> m;
    int mod = 1e9 + 7;
    char arr[n][m];
    int dp[n][m];
    int dpup[n][m];
    int dpleft[n][m];
    int dpdiag[n][m];
    for (int i = 0; i < n; i++)
    {
        for (int j = 0; j < m; j++)
        {
            cin >> arr[i][j];
            dp[i][j] = 0;
            dpup[i][j] = 0;
            dpleft[i][j] = 0;
            dpdiag[i][j] = 0;
        }
    }
    dp[0][0] = 1;
    dpleft[0][0] = 1;
    dpup[0][0] = 1;
    dpdiag[0][0] = 1;

    for (int i = 0; i < n; i++)
    {
        for (int j = 0; j < m; j++)
        {
            if (i == 0 && j == 0)
                continue;
            if (arr[i][j] == '.')
            {
                int a = 0, b = 0, c = 0;
                if (i - 1 >= 0)
                    a = dpup[i - 1][j];
                if (j - 1 >= 0)
                    b = dpleft[i][j - 1];
                if (i - 1 >= 0 && j - 1 >= 0)
                    c = dpdiag[i - 1][j - 1];

                dp[i][j] = (((a + b) % mod) + c) % mod;
                dpup[i][j] = (dp[i][j] + a) % mod;
                dpleft[i][j] = (dp[i][j] + b) % mod;
                dpdiag[i][j] = (dp[i][j] + c) % mod;
            }
        }
    }
    // for (int i = 0; i < n; i++)
    // {
    //     for (int j = 0; j < m; j++)
    //         cout << dp[i][j] << " ";
    //     cout << endl;
    // }
    cout << dp[n - 1][m - 1] << endl;
}


#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> pii;
#define MP make_pair
#define PB push_back
#define inf 1000000007
#define rep(i,n) for(int i = 0; i < (int)(n); ++i)
#define all(x) (x).begin(),(x).end()

template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
    std::fill( (T*)array, (T*)(array+N), val );
}

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

template<class T> inline bool chmin(T &a, T b){
    if(a>b){
        a = b;
        return true;
    }
    return false;
}
int w[51],v[51];
int x[51];
int main(){
    int n,m,q;
    cin >> n >> m >> q;
    rep(i,n)cin >> w[i] >> v[i];
    rep(i,m)cin >> x[i];

    rep(zz,q){
        int L,R;
        cin >> L >> R;
        vector<pair<int,int> > p;
        for(int i=0;i<L-1;i++){
            p.push_back(MP(x[i],inf));
        }
        for(int i=R;i<m;i++){
            p.push_back(MP(x[i],inf));
        }

        for(int i=0;i<n;i++){
            p.push_back(MP(w[i],v[i]));
        }
        sort(p.begin(),p.end());
        int res = 0;
        priority_queue<int> pq;
        for(auto x:p){
            if(x.second==inf){
                if(!pq.empty()){
                    res += pq.top();
                    pq.pop();
                }
            }else{
                pq.push(x.second);
            }
        }
        cout << res << "\n";
    }
    return 0;
}

#include <algorithm>
#include <functional>
#include <iostream>
#include <numeric>
#include <string>
#include <vector>
using ll = long long;
using namespace std;

ll dp[51][51] = {0};

int main(int argc, char *argv[]) {
  ll N, M, Q;
  cin >> N >> M >> Q;
  vector<pair<ll, ll>> wv_org(N);
  vector<pair<ll, ll>> wv(N);
  for (int i = 0; i < N; i++) {
    cin >> wv_org[i].first >> wv_org[i].second;
  }
  vector<pair<ll, int>> box(M, pair<ll, int>(0, 0));
  for (int i = 0; i < M; i++) {
    cin >> box[i].first;
    // 元のindex 覚えておく
    box[i].second = i;
  }
  sort(box.begin(), box.end());
  vector<ll> ans(Q, 0);
  for (int i = 0; i < Q; i++) {
    wv = wv_org;
    ll l, r;
    cin >> l >> r;
    l--, r--;
    for (int j = 0; j < M; j++) {
      if (box[j].second >= l && box[j].second <= r) {
        continue;
      }
      ll v = 0;
      ll used = -1;
      for (int k = 0; k < N; k++) {
        if (box[j].first >= wv[k].first && v < wv[k].second) {
          v = wv[k].second;
          used = k;
        }
      }
      if (used != -1) {
        wv[used].first = 1LL << 60;
        ans[i] += v;
      }
    }
  }
  for (int i = 0; i < Q; i++) {
    cout << ans[i] << endl;
  }
}


///Bismillahir Rahmanir Rahim
#include "bits/stdc++.h"

#define                           ll                          long long
#define                           int                         ll
#define                           fi                          first
#define                           si                          second
#define                           mp                          make_pair
#define                           pb                          push_back
#define                           pi                          pair<int,int>
#define                           nd(a,b,c)                   mp(mp(a,b),c)
#define                           clr(x)                      memset(x,0,sizeof(x));
#define                           f(i,l,r)                    for(int i=l;i<=r;i++)
#define                           rf(i,r,l)                   for(int i=r;i>=l;i--)
#define                           done(i)                     cout<<"done = "<<i<<endl;
#define                           show(x,y)                   cout<<x<<" : ";for(auto z:y)cout<<z<<" ";cout<<endl;
#define                           fast                        ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);

using namespace std;

const ll inf=2e18;
const int mod=1e9+7;
const int M=200005;
char x[M],y[M];
void solve()
{
   int n,flag=0;
   cin>>n;
   string s;
   cin>>s;
   for(int i=1;i<=n;i++)
   {
       x[i]=s[i-1];
       y[i]=s[i-1+n];
   }
   x[n+1]='\0';
   y[n+1]='\0';
   int q;
   cin>>q;
   while(q--)
   {
       int typ,u,v,p,q;
       cin>>typ>>u>>v;
       if(typ==2)
       {
           flag=1-flag;
       }
       else
       {

           if(flag==0)
           {
                if(v<=n)
                {
                    swap(x[u],x[v]);continue;
                }
                if(u>n)
                {
                    swap(y[u-n],y[v-n]);continue;
                }
                p=u;q=v-n;
                swap(x[p],y[q]);
           }
           else
           {
               if(v<=n)
                {
                    swap(y[u],y[v]);continue;
                }
                if(u>n)
                {
                    swap(x[u-n],x[v-n]);continue;
                }
               p=v-n;q=u;
               swap(x[p],y[q]);
           }
       }
   }
   if(flag==0)
   {
       f(i,1,n)cout<<x[i];
       f(i,1,n)cout<<y[i];
       cout<<"\n";
   }
   else
   {
       f(i,1,n)cout<<y[i];
       f(i,1,n)cout<<x[i];
       cout<<"\n";
   }
}
 main()

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

}

//#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;
vector<pi> G[101010];

int ans[101010];

int seen[101010];

void dfs(int now, int bef) {
    if (seen[now])
        return;
    seen[now] = 1;
    for (auto& p : G[now]) {
        int nxt = p.first;
        if (seen[nxt])
            continue;
        if (bef == nxt)
            continue;
        int c = p.second;
        int nxt_c;
        if (ans[now] == c) {
            nxt_c = (c + 1) % N;
        } else
            nxt_c = c;
        ans[nxt] = nxt_c;
        dfs(nxt, now);
    }
}

void solve() {
    dfs(0, -1);
    for (int i = 0; i < N; i++) {
        cout << ans[i] + 1 << endl;
    }
}

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

    cin >> N >> M;
    for (int i = 0; i < M; i++) {
        int u, v, c;
        cin >> u >> v >> c;
        u--;
        v--;
        c--;
        G[u].push_back({v, c});
        G[v].push_back({u, c});
    }

    solve();
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
//common file for PBDS
#include<ext/pb_ds/assoc_container.hpp>
// including tree_order_statistics_node_update
#include<ext/pb_ds/tree_policy.hpp>
//namespace
using namespace __gnu_pbds;
//#define int long long

//macro definition
#define ordered_set tree<pair<int,int>, null_type, less<pair<int,int > >, rb_tree_tag, tree_order_statistics_node_update>
int main()
{
long long int a,b,c;
cin>>a>>b>>c;
if(c%2==0)
{
	if(abs(a)==abs(b))
cout<<"="<<endl;
else if(abs(a)>abs(b))
cout<<">";
else
cout<<"<";
}
else
{
if((a)==(b))
cout<<"="<<endl;
else if((a)>(b))
cout<<">";
else
cout<<"<";
}
	return 0;
}

//----AUTHOR: eeshan_deo_iitkgp----/
#include <bits/stdc++.h>
using namespace std;

#define ff first
#define ss second
#define ll long long
#define ld long double
#define pb push_back
#define ppb pop_back
#define pii pair<int, int>
#define pll pair<ll, ll>
#define vi vector<int>
#define vb vector<bool>
#define vd vector<double>
#define vll vector<ll>
#define vpii vector<pii>
#define vpll vector<pll>
#define vs vector<string>
#define vc vector<char>
#define vvi vector<vi>
#define vvb vector<vb>
#define vvd vector<vd>
#define vvll vector<vll>
#define vvc vector<vc>
#define setbits(x) __builtin_popcountll(x)
#define zrobits(x) __builtin_ctzll(x)
#define mod 1000000007
#define w(x)  \
    int x;    \
    cin >> x; \
    for (ll tc = 1; tc <= x; tc++)
#define in(i, x, y) for (ll i = x; i < y; i++)
#define rin(i, x, y) for (ll i = x; i >= y; i--)
#define all(a) begin(a), end(a)
#define rall(a) rbegin(a), rend(a)
#define lb lower_bound
#define ub upper_bound

ll fxp(ll a, ll b) {
    assert(b >= 0);
    a %= mod;
    ll res = 1;
    while (b > 0) {
        if (b % 2 == 1)
            res = (res * a) % mod;
        a = (a * a) % mod;
        b /= 2;
    }
    return res % mod;
}

inline ll minv(ll x) { return fxp(x, mod - 2); }

void c_p_c() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
}

const int mXn = 1;
const ll inf = 1e18;

signed main() {
    c_p_c();
    ll a, b, c; cin >> a >> b >> c;
    if (a == 0 or b == 0) {
        if (a == 0 and b == 0)cout << "=";
        else if (a == 0) {
            if (b < 0) {
                if (c % 2)cout << ">";
                else cout << "<";
            }
            else cout << "<";
        }
        else {
            if (a < 0) {
                if (c % 2)cout << "<";
                else cout << ">";
            }
            else cout << ">";
        }
    }
    else if (a < 0 or b < 0) {
        if (a < 0 and b < 0) {
            if (c % 2) {
                if (abs(a) < abs(b))cout << ">";
                else if (abs(a) > abs(b))cout << "<";
                else cout << "=";
            }
            else {
                if (abs(a) > abs(b))cout << ">";
                else if (abs(a) < abs(b))cout << "<";
                else cout << "=";
            }
        }
        else if (a < 0) {
            if (c % 2)cout << "<";
            else {
                if (abs(a) > abs(b))cout << ">";
                else if (abs(a) < abs(b))cout << "<";
                else cout << "=";
            }
        }
        else if (b < 0) {
            if (c % 2)cout << ">";
            else {
                if (abs(a) > abs(b))cout << ">";
                else if (abs(a) < abs(b))cout << "<";
                else cout << "=";
            }
        }
    }
    else {
        if (a > b)cout << ">";
        else if (a < b)cout << "<";
        else cout << "=";
    }
}


#include <bits/stdc++.h>
using namespace std;
int main(){
    long long N;
    cin >> N;
    vector<int> ans;
    long long INF = 1000000000000000000;
    vector<long long> fib(87, INF);
    fib[0] = 1;
    fib[1] = 1;
    for(int i = 2; i < 87; i++){
        fib[i] = fib[i - 1] + fib[i - 2];
    }
    vector<int> ind;
    while(N > 0){
        for(int i = 86; i >= 0; i--){
            if(N >= fib[i]) {
                N -= fib[i];
                ind.push_back(86 - i);
                break;
            }
        }
    }
    int id = 0;
    for(int i = 0; i < 86; i++){
        if(i > 0){
            if(i % 2 == 0){
                ans.push_back(3);
            }
            else{
                ans.push_back(4);
            }
        }
        while(id < ind.size() && ind[id] == i){
            if(i % 2 == 0){
                ans.push_back(1);
            }
            else ans.push_back(2);
            id++;
        }
    }
    long long x = 0, y = 0;
    ans.push_back(3);
    for(int i = 0; i < ans.size(); i++){
        if(ans[i] == 1) x++;
        else if(ans[i] == 2) y++;
        else if(ans[i] == 3) x = x + y;
        else y = x + y;
    }
    cout << ans.size() << endl;
    for(int t: ans) cout << t << endl;
}

#include <bits/stdc++.h>
// clang-format off
using namespace std; using ll=long long; using ull=unsigned long long; using pll=pair<ll,ll>; const ll INF=4e18;
void print0(){}; template<typename H,typename... T> void print0(H h,T... t){cout<<h;print0(t...);}
void print(){print0("\n");}; template<typename H,typename... T>void print(H h,T... t){print0(h);if(sizeof...(T)>0)print0(" ");print(t...);}
void perr0(){}; template<typename H,typename... T> void perr0(H h,T... t){cerr<<h;perr0(t...);}
void perr(){perr0("\n");}; template<typename H,typename... T>void perr(H h,T... t){perr0(h);if(sizeof...(T)>0)perr0(" ");perr(t...);}
void ioinit() { cout << fixed << setprecision(15); cerr<<fixed<<setprecision(6); ios_base::sync_with_stdio(0); cin.tie(0); }
// clang-format on

ll fibrest(ll x0, ll y0, ll n, bool isx) {
    ll iter = 0;
    vector<ll> fib = {x0, y0};
    ll x = x0;
    ll y = y0;
    ll op = 0;
    while (true) {
        if (isx) {
            x = x + y;
        } else {
            y = y + x;
        }
        if (x >= n) break;
        op++;
        isx = !isx;
    }
    return op;
}
void op(vector<ll> &ops, ll &x, ll &y, ll t) {
    if (t == 1) {
        x = x + 1;
    }
    if (t == 2) {
        y = y + 1;
    }
    if (t == 3) {
        x = x + y;
    }
    if (t == 4) {
        y = y + x;
    }
    ops.push_back(t);
}
void output(vector<ll> &ops) {
    ll k = ops.size();
    print(ops.size());
    for (auto ope : ops) {
        print(ope);
    }
}

int main() {
    ioinit();

    ll n;
    cin >> n;
    // while (fib.back() < n) {
    //     fib.push_back(fib[fib.size() - 1] + fib[fib.size() - 2]);
    // }
    // ll m = fib.size();

    ll x = 0;
    ll y = 0;

    vector<ll> ops;
    if (n < 120) {
        while (x < n) {
            op(ops, x, y, 1);
        }
        output(ops);
        return 0;
    }

    op(ops, x, y, 2);
    bool isx = true;
    while (true) {
        if (x + y > n) {
            while (x < n) {
                op(ops, x, y, 1);
            }
            break;
        }
        ll curop = fibrest(x, y, n, isx);

        {
            ll k = 0;
            while (true) {
                ll r = fibrest(x + k + 1, y, n, isx);
                if (r != curop) break;
                //perr(curop, r);
                op(ops, x, y, 1);
                k = k + 1;
            }
        }
        if (isx) {
            op(ops, x, y, 3);
        } else {
            op(ops, x, y, 4);
        }
        isx = !isx;
        if (x >= n) break;
    }
    output(ops);
}


#include<iostream>
#include<string>
#include<algorithm>
#include<cmath>
#include<ctime>
#include<map>
#include<vector>
#include<math.h>
#include<stdio.h>
#include<stack>
#include<queue>
#include<tuple>
#include<cassert>
#include<set>
#include<bitset>
#include<functional>
#include <fstream>
//#include<bits/stdc++.h>
#pragma GCC target("avx2")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#define rep(i, x) for(ll i = 0; i < x; i++)
#define rep2(i, x) for(ll i = 1; i <= x; i++)
#define rep3(i, x, y) for(ll i = x; i < y; i++)
#define rep4(i, x) for(ll i = x; i >= 0; i--)
#define all(a) (a).begin(),(a).end()
#define puts(x) cout << (x) << "\n"
using ll = long long;
using ld = long double;
using namespace std;
const ll INF = 1000000000000000000;
const int intINF = 1000000000;
const ll mod = 1000000007;
const ll MOD = 998244353;
const ld pi = 3.141592653589793238;
//const ld EPS = 1e-9;

bool isprime(int p) {
	if (p == 1) return false;
	for (int i = 2; i < p; i++) {
		if (p % i == 0) return false;
	}
	return true;
}
ll gcd(ll a, ll b) {
	if (a < b)swap(a, b);
	if (a % b == 0)return b;
	return gcd(b, a % b);
}
//ax + by = cが整数解をもつための必要十分条件は c が gcd(a,b) で割り切れること。
// 返り値: a と b の最大公約数
// ax + by = gcd(a, b) を満たす (x, y) が格納される
//main関数内に extGCD(a, b, x, y); でx, yに解が格納
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;
}
ll lcm(ll a, ll b) {
	return a / gcd(a, b) * b;
}
ll keta(ll n) {
	ll res = 0;
	while (n >= 1) {
		res += n % 10; n /= 10;
	}
	return res;
}
ll modpow(ll x, ll y, ll m) {
	ll res = 1;
	while (y) {
		if (y % 2) { res *= x; res %= m; }
		x = x * x % m; y /= 2;
	}
	return res;
}
ll kaijyo[600005];
void nCkinit(ll n, ll m) {
	ll cnt = 1; kaijyo[0] = 1;
	for (int h = 1; h <= n; h++) { cnt *= h; cnt %= m; kaijyo[h] = cnt; }
}
ll nCk(ll n, ll k, ll m) {
	/*ll a = 1, b = 1;
	for (int h = 1; h <= n; h++) { a *= h; a %= m; }
	for (int h = 1; h <= k; h++) { b *= h; b %= m; }
	for (int h = 1; h <= n - k; h++) { b *= h; b %= m; }*/
	ll a = kaijyo[n], b = kaijyo[k] * kaijyo[n - k] % m;
	return a * modpow(b, m - 2, m) % m;
}
//printf("%.10f\n", n);
typedef pair <ll, ll> P;
typedef pair <ll, string> pp;
ll dx[4] = { 1, 0, -1, 0 }, dy[4] = { 0, 1, 0, -1 };
struct edge { ll to, cost; };
struct xy { ll x, y; };
struct status {
	ll cost;
	ll x;
	ll y;

	bool operator<(const status& rhs) const { return cost < rhs.cost; };
	bool operator>(const status& rhs) const { return cost > rhs.cost; };
};

map<ll, set<ll>> ma;
map<ll, bool> ok;
void dfs(ll x, ll y) {
	//まず自分の下にあるかどうか
	auto itr1 = ma[y].lower_bound(x + 1);
	ll sita = 0;
	if (itr1 == ma[y].end()) { ok[y] = true; sita = INF; }
	else { sita = *itr1; }
	//y-1
	if (y != 0) {
		ll now = x + 1;
		while (true) {
			auto itr2 = ma[y - 1].lower_bound(now);
			if (itr2 == ma[y - 1].end()) { break; }
			if (sita < *itr2) { break; }
			now = *itr2;
			ma[y - 1].erase(now); dfs(now, y - 1);
		}
	}
	//y + 1
	ll now = x + 1;
	while (true) {
		auto itr2 = ma[y + 1].lower_bound(now);
		if (itr2 == ma[y + 1].end()) { break; }
		if (sita < *itr2) { break; }
		now = *itr2;
		ma[y + 1].erase(now); dfs(now, y + 1);
	}
}

int main() {
	ios::sync_with_stdio(false);
	std::cin.tie(nullptr);
	//cout << fixed << setprecision(15);

	ll n, m; cin >> n >> m; vector<ll>x(m), y(m);
	rep(i, m) {
		cin >> x[i] >> y[i]; ma[y[i]].insert(x[i]);
	}
	/*for (int i = max((ll)0, n - m - 1); i <= n + m + 1; i++) {
		sort(all(ma[i]));
	}*/
	dfs(0, n);
	ll ans = 0;
	for (int i = max((ll)0, n - m - 1); i <= n + m + 1; i++) {
		if (ok[i]) { ans++; }
	}
	cout << ans << endl;
	return 0;
}

#include <bits/stdc++.h>
using namespace std;
#pragma GCC optimize("Ofast,unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,avx,avx2,fma,tune=native")

#define ll long long
#define int ll
#define ull unsigned ll
#define ld long double
#define rep(a) rep1(i,a)
#define rep1(i,a) rep2(i,0,a)
#define rep2(i,b,a) for(int i=(b); i<((int)(a)); i++)
#define rep3(i,b,a) for(int i=(b); i>=((int)(a)); i--)
#define all(a) a.begin(),a.end()
#define pii pair<int,int>
#define pb push_back
//#define inf 1010000000
#define inf 4000000000000000000
#define eps 1e-9
#define sz(a) ((int)a.size())
#define pow2(x) (1ll<<(x))
#define ceiling(a,b) (((a)+(b)-1)/(b))
#define print0(a) cout << (a) << ' '
#define ykh mt19937 rng(chrono::steady_clock::now().time_since_epoch().count())
#ifdef i_am_noob
#define bug(...) cerr << "#" << __LINE__ << ' ' << #__VA_ARGS__ << "- ", _do(__VA_ARGS__)
template<typename T> void _do(vector<T> x){for(auto i: x) cerr << i << ' ';cerr << "\n";}
template<typename T> void _do(set<T> x){for(auto i: x) cerr << i << ' ';cerr << "\n";}
template<typename T> void _do(unordered_set<T> x){for(auto i: x) cerr << i << ' ';cerr << "\n";}
template<typename T> void _do(T && x) {cerr << x << endl;}
template<typename T, typename ...S> void _do(T && x, S&&...y) {cerr << x << ", "; _do(y...);}
#else
#define bug(...) 826
#endif
template<typename T> void print(T && x) {cout << x << "\n";}
template<typename T, typename... S> void print(T && x, S&&... y) {cout << x << ' ';print(y...);}

const int Mod=1000000007,Mod2=998244353;
const int MOD=Mod;
const int maxn=200005;

//i_am_noob
//#define wiwihorz
template<int N>
struct hash_table1{
    int ground=0,siz=0;
    bool vis[N+5]={0};
    int size(){return siz;}
    void insert(int x){x-=ground;if(!vis[x]) siz++;vis[x]=1;}
    void erase(int x){x-=ground;if(vis[x]) siz--;vis[x]=0;}
    int count(int x){x-=ground;return vis[x];}
};

int n,m;
pii a[maxn];
map<int,vector<int>> mm;
hash_table1<maxn<<1> st;

void orzck(){
    cin >> n >> m;
    rep(m){
        int x,y;
        cin >> x >> y;
        if(y>=n-m&&y<=n+m) mm[x].pb(y);
    }
    st.ground=n-maxn;
    st.insert(n);
    for(auto p: mm){
        vector<int> vec=p.second;
        unordered_set<int> st1,st2;
        for(auto i: vec){
            if(st.count(i-1)||st.count(i+1)) st1.insert(i);
            else st2.insert(i);
        }
        for(auto i: st1) st.insert(i);
        for(auto i: st2) st.erase(i);
    }
    print(sz(st));
}

signed main(){
    ios_base::sync_with_stdio(0),cin.tie(0);
    #ifdef i_am_noob
    freopen("input1.txt","r",stdin);
    freopen("output1.txt","w",stdout);
    freopen("output2.txt","w",stderr);
    #endif
    cout << fixed << setprecision(15);
    int t;
    #ifdef wiwihorz
    cin >> t;
    #else
    t=1;
    #endif
    while(t--) orzck();
    return 0;
}


#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
using ll = long long;
using ull = unsigned long long;
#define rep(i,n) for(int i=0; i<(n); i++)

int N,Q;
vector<ll> A;
vector<ll> K;

int main(){
  cin >> N >> Q;
  A.resize(N);
  rep(i,N) cin >> A[i];
  rep(i,N) A[i] -= i;
  K.resize(Q);
  rep(i,Q) cin >> K[i];
  rep(i,Q){
    ll ans = K[i] + (upper_bound(A.begin(),A.end(),K[i]) - A.begin());
    cout << ans << "\n";
  }
  return 0;
}

struct ios_do_not_sync{
  ios_do_not_sync(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
  }
} ios_do_not_sync_inst;

//@formatter:off
#include<bits/stdc++.h>
#define overload4(_1,_2,_3,_4,name,...) name
#define rep1(i,n) for (ll i = 0; i < ll(n); ++i)
#define rep2(i,s,n) for (ll i = ll(s); i < ll(n); ++i)
#define rep3(i,s,n,d) for(ll i = ll(s); i < ll(n); i+=d)
#define rep(...) overload4(__VA_ARGS__,rep3,rep2,rep1)(__VA_ARGS__)
#define rrep(i,n) for (ll i = ll(n)-1; i >= 0; i--)
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define popcount(x) __builtin_popcount(x)
#define pb push_back
#define eb emplace_back
#ifdef __LOCAL
#define debug(...) { cout << #__VA_ARGS__; cout << ": "; print(__VA_ARGS__); cout << flush; }
#else
#define debug(...) void(0)
#endif
#define INT(...) int __VA_ARGS__;scan(__VA_ARGS__)
#define LL(...) ll __VA_ARGS__;scan(__VA_ARGS__)
#define STR(...) string __VA_ARGS__;scan(__VA_ARGS__)
#define CHR(...) char __VA_ARGS__;scan(__VA_ARGS__)
#define DBL(...) double __VA_ARGS__;scan(__VA_ARGS__)
#define LD(...) ld __VA_ARGS__;scan(__VA_ARGS__)
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<int,int>;
using LP = pair<ll,ll>;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;
using vd = vector<double>;
using vvd = vector<vector<double>>;
using vs = vector<string>;
using vc = vector<char>;
using vvc = vector<vector<char>>;
using vb = vector<bool>;
using vvb = vector<vector<bool>>;
using vp = vector<P>;
using vvp = vector<vector<P>>;
template<class S,class T> istream& operator>>(istream &is,pair<S,T> &p) { return is >> p.first >> p.second; }
template<class S,class T> ostream& operator<<(ostream &os,const pair<S,T> &p) { return os<<'{'<<p.first<<","<<p.second<<'}'; }
template<class T> istream& operator>>(istream &is,vector<T> &v) { for(T &t:v){is>>t;} return is; }
template<class T> ostream& operator<<(ostream &os,const vector<T> &v) { os<<'[';rep(i,v.size())os<<v[i]<<(i==int(v.size()-1)?"":","); return os<<']'; }
template<class T> bool chmin(T& a,T b) {if(a > b){a = b; return true;} return false;}
template<class T> bool chmax(T& a,T b) {if(a < b){a = b; return true;} return false;}
void scan(){}
template <class Head, class... Tail> void scan(Head& head, Tail&... tail){ cin >> head; scan(tail...); }
template<class T> void print(const T& t){ cout << t << '\n'; }
template <class Head, class... Tail> void print(const Head& head, const Tail&... tail){ cout<<head<<' '; print(tail...); }
template<class... T> void fin(const T&... a) { print(a...); exit(0); }
const string yes[] = {"no","yes"};
const string Yes[] = {"No","Yes"};
const string YES[] = {"NO","YES"};
const int inf = 1001001001;
const ll linf = 1001001001001001001;
//@formatter:on

template<typename T>
class BIT {
    int n;
    vector<T> val;
public:
    BIT(int n) : n(n), val(n + 1, 0) {}

    void add(int i, T x = 1) {
        i++;
        while (i <= n) {
            val[i] += x;
            i += i & -i;
        }
    }

    T sum(int i) {
        T ret = 0;
        i++;
        while (i > 0) {
            ret += val[i];
            i -= i & -i;
        }
        return ret;
    }

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

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    INT(n);
    vi a(n);
    cin >> a;
    BIT<int> bt(n);
    ll ans = 0;
    rep(i, n) {
        ans += bt.sum(a[i] + 1, n);
        bt.add(a[i]);
    }
    rep(i, n) {
        print(ans);
        ans -= a[i];
        ans += n - 1 - a[i];
    }
}


#include <iostream>

constexpr int N = 5005;
constexpr int p = 998244353;

int add(int x, int y) { return (x += y) >= p ? x - p : x; }
int sub(int x, int y) { return (x -= y) < 0 ? x + p : x; }
int mul(int x, int y) { return (long long)x * y % p; }

int n, m;
int f[N], g[N];

int main() {
    std::ios::sync_with_stdio(false), std::cin.tie(nullptr);
    std::cin >> n >> m;
    g[0] = 1;
    for (int i = 1; i <= n; ++i) g[i] = mul(g[i - 1], m);
    int ans = mul(n, g[n]);
    for (int i = 1; i <= m; ++i)
        for (int j = 1; j <= n; ++j) {
            f[j] = add(mul(f[j - 1], i), sub(g[j - 1], f[j - 1]));
            ans = sub(ans, mul(f[j - 1], g[n - j]));
        }
    std::cout << ans << '\n';
    return 0;
}

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

using namespace std;
//using namespace __gnu_pbds;

const int N = 105;
const int MOD = 1e9 + 7;
const long long INF = 5e18;
const double PI = 2 * acos(0.0);
#define debug(x) cerr << #x << " :: " << x << '\n';
//template<typename T> using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

long long x, a[N], dp[2][N][N][N];
int n, COL, K;

long long fun(int pos, int cnt, int rem) {
    if (pos == n || cnt == K) {
        long long vaL = x - rem;
        if (vaL % K == 0 && cnt == K) {
            return vaL / K;
        }
        return INF;
    }
    long long &tmp = dp[0][pos][cnt][rem];
    long long &vmp = dp[1][pos][cnt][rem];
    if (vmp == COL) {
        return tmp;
    }
    vmp = COL;
    tmp = INF;
    long long vaL = a[pos] + rem;
    tmp = min(tmp, fun(pos + 1, cnt, rem));
    tmp = min(tmp, fun(pos + 1, cnt + 1, vaL % K) - (vaL / K));
    return tmp;
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cin >> n >> x;
    for (int i = 0; i < n; i++) {
        cin >> a[i];
    }
    long long ans = INF;
    for (int i = 1; i <= n; i++) {
        COL++, K = i;
        ans = min(ans, fun(0, 0, 0));
    }
    cout << ans << '\n';
    return 0;
}


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

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

  for(int i = 0; i < X.size(); i++){
    if(X.at(i) == '.') break;
    cout << X.at(i);
  }

  cout << endl;
}

#include <iostream>
#include <iomanip>
#include <algorithm>
#include <assert.h>
#include <complex>
#include <utility>
#include <vector>
#include <string>
#include <stack>
#include <queue>
#include <tuple>
#include <cmath>
#include <bitset>
#include <cctype>
#include <set>
#include <map>
#include <unordered_map>
#include <numeric>
#include <functional>
#include <chrono>
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(ll i=a;i<b;++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define _rrep(i,a) rrepi(i,a,0)
#define rrepi(i,a,b) for(ll i=a-1;i>=b;--i)
#define rrep(...) _overload3(__VA_ARGS__,rrepi,_rrep,)(__VA_ARGS__)
#define all(x) (x).begin(),(x).end()
#define PRINT(V) cout << V << "\n"
#define SORT(V) sort((V).begin(),(V).end())
#define RSORT(V) sort((V).rbegin(), (V).rend())
using namespace std;
using ll = long long;
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; }
inline void Yes(bool condition){ if(condition) PRINT("Yes"); else PRINT("No"); }
template<class itr> void cins(itr first,itr last){
    for (auto i = first;i != last;i++){
        cin >> (*i);
    }
}
template<class itr> void array_output(itr start,itr goal){
    string ans = "",k = " ";
    for (auto i = start;i != goal;i++) ans += to_string(*i)+k;
    if (!ans.empty()) ans.pop_back();
    PRINT(ans);
}
ll gcd(ll a, ll b) {
    return a ? gcd(b%a,a) : b;
}

const ll INF = 1e18;
const ll MOD = 1000000007;
const ll MOD2 = 998244353;
const ll MOD3 = 1e6;
const ll EPS = 1e-10;
int sgn(const double a){
    return (a < -EPS ? -1 : (a > EPS ? +1 : 0));
}
typedef pair<int,int> pi;
typedef pair<ll,ll> P;
typedef tuple<ll,ll,ll> tri;
typedef pair<double,double> point;
typedef complex<double> Point;
typedef string::const_iterator State;
const ll MAX = 125000;
constexpr ll nx[4] = {-1,0,1,0};
constexpr ll ny[4] = {0,1,0,-1};

int main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    string s;
    cin >> s;
    string ans = "";
    rep(i,s.length()){
        if (s[i] == '.') break;
        ans += s[i];
    }
    PRINT(ans);
}


#include <bits/stdc++.h>
using namespace std;
#define int long long int
#define pb emplace_back
#define mp make_pair
#define fi first
#define se second
#define all(v) v.begin(),v.end()
#define run ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);cerr.tie(0);
#define LL_MAX LLONG_MAX

#define ub(v,x) upper_bound(v.begin(),v.end(),x)
#define lb(v,x) lower_bound(v.begin(),v.end(),x)

#define mod 1000000007
int exp(int x,int y){int res=1;x=x%mod;while(y>0){if(y&1)res=(res*x)%mod;y=y>>1;x=(x*x)%mod;}return res;}
int modinv(int x){return exp(x,mod-2);}
int add(int a,int b){a%=mod,b%=mod;a=((a+b)%mod+mod)%mod;return a;}
int sub(int a,int b){a%=mod,b%=mod;a=((a-b)%mod+mod)%mod;return a;}
int mul(int a,int b){a%=mod,b%=mod;a=((a*b)%mod+mod)%mod;return a;}
int fac[1000009];int ncr_mod(int n,int k){int ans=fac[n];ans*=modinv(fac[k]);ans%=mod;ans*=modinv(fac[n-k]);ans%=mod;return ans;}

vector<int>v_prime;void Sieve(int n){bool prime[n + 1];memset(prime,true,sizeof(prime));for (int p = 2; p*p <=n;p++){if(prime[p] ==true) {for(int i = p*p; i<= n; i += p)prime[i]=false;}}for(int p = 2;p<= n;p++)if (prime[p])v_prime.pb(p);}
vector<int>v_factor;void factor(int n){ for (int i=1; i<=sqrt(n); i++) {if (n%i == 0) {if (n/i == i) v_factor.pb(i);else { v_factor.pb(i),v_factor.pb(n/i);};} } sort(all(v_factor)); }

int power(int x, int y){int temp;if( y == 0)return 1; temp = power(x, y / 2);if (y % 2 == 0) return temp * temp;else return x * temp * temp;}
int gcd(int a, int b){if (b == 0)return a; return gcd(b, a % b);}
int log2n( int n){ return (n > 1) ? 1 + log2n(n / 2) : 0;}

void out(vector<int>&a){for(int i=0;i<a.size();i++) cout<<a[i]<<" ";  cout<<endl;}
void sout(set<int>s){for(auto it=s.begin();it!=s.end();++it)cout<<*it<<" ";  cout<<endl;}
void mout(map<int,int>mm){for(auto it=mm.begin();it!=mm.end();++it) cout<<it->fi<<" "<<it->se<<endl;}

#define ms(a,x)  memset(a, x, sizeof(a));

#define decimal(n,k) cout<<fixed<<setprecision(k)<<n<<endl
#define yes cout<<"YES"<<endl
#define no cout<<"NO"<<endl

// debug functions
#define deb1(x) cout << #x <<" " << x <<endl
#define deb2(x,y) cout << #x <<" "<< x << " " << #y <<" " << y <<endl
#define deb3(x, y, z) cout << #x <<" " << x << " "  << #y <<" " << y << " "  << #z << " " << z<<endl

// In binary search always report l-1

signed main()
{

      run;

/*
open for mod factorial

     fac[0]=1;
      for(int i=1;i<1000009;i++)
      {
          fac[i]=mul(fac[i-1],i);

      }
*/

/*
  for sieve open this and use v_prime

          int pp=pow(10,6)+100000;
               Sieve(pp);
*/

 // factor(n)  &&   USE v_factor For calculating factors && don't forget v_factor.clear();

int  t=1;

while(t--)
{
             //  map<int,int>mm; // it->second-->frequency

             int  n,i,x,y,ok=0,sum=0,ans=0,j,k,cnt=0,m,c=0,q,z;
             int  h[100009]={0};

         cin>>x>>y;
         if(x==y)
           cout<<y<<endl;

           else
           {
               sum+=x+y;
               cout<<3-sum<<endl;
           }

}
}

#include <bits/stdc++.h>

#define rep(i,n) for(int i=0;i<n;++i)
#define repn(i,n) for(int i=1;i<=n;++i)
#define LL long long
#define pii pair <int,int>
#define pb push_back
#define fi first
#define se second
#define mpr make_pair

using namespace std;

const LL MOD=1e9+7;

int main()
{
  int a,b;
  cin>>a>>b;
  if(a==b) cout<<a<<endl;
  else
  {
    if(a>b) swap(a,b);
    if(a==0&&b==1) cout<<2<<endl;
    else if(a==0&&b==2) cout<<1<<endl;
    else cout<<0<<endl;
  }
	return 0;
}


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

int32_t main(){
    ios::sync_with_stdio(0),cin.tie(0);
    int n,m,q;
    cin >> n;
    int x[n],y[n];
    for(int i=0;i<n;i++)
    	cin >> x[i] >> y[i];
    cin >> m;
    vector <pair <int,int> > op,ans;
    vector <pair <int,int> > qry[m];
    for(int i=0;i<m;i++){
    	int t,p=0;
    	cin >> t;
    	if(t>2)cin >> p;
    	op.push_back({t,p});
    }
    cin >> q;
    ans.resize(q);
    int s=0,fx=1,fy=1,dx=0,dy=0;
    for(int i=0;i<q;i++){
    	int a,b;
    	cin >> a >> b;
    	b--;
    	a--;
    	if(a==-1){
    		ans[i]={x[b],y[b]};
    		continue;
    	}
    	qry[a].push_back({b,i});
    }
    for(int i=0;i<m;i++){
    	auto [t,p]=op[i];
    	if(t==1){
    		s^=1;
    		swap(fx,fy);
    		swap(dx,dy);
    		fy=-fy;
    		dy=-dy;
    	}
    	if(t==2){
    		s^=1;
    		swap(fx,fy);
    		swap(dx,dy);
    		fx=-fx;
    		dx=-dx;
    	}
    	if(t==3){
    		fx=-fx;
    		dx=-dx;
    		dx+=2*p;
    	}
    	if(t==4){
    		fy=-fy;
    		dy=-dy;
    		dy+=2*p;
    	}
    	for(auto &[j,id]:qry[i]){
    		int tx=x[j],ty=y[j];
    		if(s)swap(tx,ty);
    		tx*=fx,ty*=fy;
    		tx+=dx,ty+=dy;
    		ans[id]={tx,ty};
    	}
    }
    for(auto [tx,ty]:ans)
    	cout << tx << ' ' << ty << '\n';
}

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define forn(i,x,n) for(int i = x;i <= n;++i)
typedef pair<int,int> pii;
#define x first
#define y second

const int N = 3,_N = 2e5 + 7;
struct mat
{
	ll m[N][N];
};

pii a[_N];
mat op[_N];

mat mul(mat A,mat B,int len)
{
    mat c;memset(c.m,0,sizeof c.m);
    for(ll i = 0;i < len;++i)
        for(ll j = 0;j < len;++j)
            for(ll k = 0;k < len;++k)
            {
            	c.m[i][j]=(c.m[i][j]+(A.m[i][k]*B.m[k][j]));
            }
	return c;
}
mat qpow(mat a,ll len,ll k)
{
   	mat res;memset(res.m,0,sizeof res.m);
    for(ll i = 0;i < len;++i)   res.m[i][i] = 1;
    while(k)
    {
        if(k & 1)   res = mul(res,a,len);
        a = mul(a,a,len);
        k >>= 1;
    }
    return res;
}

int main()
{
	int n;scanf("%d",&n);
	forn(i,1,n)	scanf("%d%d",&a[i].x,&a[i].y);
    int m;scanf("%d",&m);
    forn(i,1,m)
    {
    	int t;scanf("%d",&t);
    	mat _;memset(_.m,0,sizeof _.m);
    	if(t == 1)
    	{
    		_.m[0][1] = -1;_.m[1][0] = 1;_.m[2][2] = 1;
    		op[i] = mul(op[i - 1],_,3);
    	}
    	else if(t == 2)
    	{
    		_.m[0][1] = 1;_.m[1][0] = -1;_.m[2][2] = 1;
    		op[i] = mul(op[i - 1],_,3);
    	}
    	else if(t == 3)
    	{
    		int p;scanf("%d",&p);
    		_.m[0][0] = -1;_.m[1][1] = 1;_.m[2][0] = 2 * p;_.m[2][2] = 1;
    		op[i] = mul(op[i - 1],_,3);
    	}
    	else
    	{
    		int p;scanf("%d",&p);
    		_.m[0][0] = 1;_.m[1][1] = -1;_.m[2][1] = 2 * p;_.m[2][2] = 1;
    		op[i] = mul(op[i - 1],_,3);
    	}
    	if(i == 1)	op[i] = _;
    }
    int q;scanf("%d",&q);
    while(q--)
    {
    	int A,B;scanf("%d%d",&A,&B);
    	if(A == 0)	printf("%d %d\n",a[B].x,a[B].y);
    	else
    	{
    		mat gamma;memset(gamma.m,0,sizeof gamma.m);
    		gamma.m[0][0] = a[B].x,gamma.m[0][1] = a[B].y,gamma.m[0][2] = 1;
    		gamma = mul(gamma,op[A],3);
    		printf("%lld %lld\n",gamma.m[0][0],gamma.m[0][1]);
    	}
    }
    return 0;
}


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

int main(){
  int n, k;
  int ans = 0;

  cin >> n >> k;
  for (int i = 100; i <= n * 100; i += 100) {
    for (int j = 1; j <= k; j++) {
      ans += i + j;
    }
  }
  cout << ans << endl;
  return 0;
}

#include<bits/stdc++.h>
using namespace std;
using namespace std::chrono;
#define IOS ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define int long long
#define rep(i,a,b)    for(int i=a;i<b;i++)
#define repn(i,a,b)   for(int i=a;i>=b;i--)
#define F first
#define S second
#define pii pair<int,int>
#define vi vector<int>
#define vii vector<pii>
#define pb push_back
#define all(v) (v).begin(), (v).end()
#define mod 1000000007

int fexp(int a, int b,int m){int ans = 1;while(b){if(b&1)ans=(ans*a)%m; b/=2;a=(a*a)%m;}return ans;}
int inverse(int a, int p){return fexp(a, p-2,p);}

// int fac[2000001];

// int nCrModPFermat(int n, int r,int p) {
//     // cout<<1<<endl;
//     if (r==0) return 1;
//     return (((fac[n]*((((inverse(fac[r],p)%p)*inverse(fac[n-r],p))%p))))%p);
// }

// vi spf(10000001,1);

void solve(){
    int n,k;cin>>n>>k;
    int val=(k)*(k+1)/2;
    int temp=(n)*(n+1)/2;
    cout<<(temp*100*k+val*n);

}

signed main(){
        IOS;

        auto start = high_resolution_clock::now();
        int t=1;
        // cin>>t;
        // spf[1]=1;
        // for(int i=2; i<=10000001; i++){
        // if(spf[i]==1){
        //     // allprime.pb(i);
        //     for(int j=i; j<=10000001; j+=i)
        //         if(spf[j]==1)spf[j]=i;
        // }
        // }
        // fac[0] = 1;
        // for (int i=1 ; i<=200001; i++) fac[i] = fac[i-1]*i%mod;

        rep(i,0,t){
            // cout<<"Case #"<<i+1<<": ";
            solve();
            cout<<"\n";
        }
        auto stop = high_resolution_clock::now();
        auto duration = duration_cast<microseconds>(stop - start);
        cerr<<"Time taken:"<<duration.count()/1000000.0<<"seconds"<<"\n";
    //    return 0;
}


#include <cstdio>

int n;

int main(){
	scanf("%d", &n);
	printf("%d\n", (1 << n) - 1);
	for(int i = 1; i < (1 << n); ++i){
		for(int j = 0; j < (1 << n); ++j)
			if(__builtin_popcount(i & j) & 1) putchar('A');
			else putchar('B');
		puts("");
	}
	return 0;
}

#include<iostream>
#include<algorithm>
#include<math.h>
#include<cstring>
#include<queue>
#include<vector>
#include<map>
#include<set>
#include<stack>
#include<string.h>
using namespace std;
long long int a[300001];
long long int b[300001];
long long int amax[200001];
string func0(string s);
string func1(string s);
string func2(string s);
int main() {

	int n;
	cin >> n;
	int bi[9] = { 1,2,4,8,16,32,64,128,256 };
	cout << bi[n] - 1 << endl;

	string ab[256], abold[256];

	int i, j;
	ab[0] = "AB";

	for (i = 2; i <= n; i++) {
		for (j = 0; j < 256; j++) {
			abold[j] = ab[j];
		}
		ab[0] = func0(abold[0]);
		for (j = 0; j < bi[i - 1] - 1; j++) {
			ab[j+1] = func1(abold[j]);
		}
		for (j = 0; j < bi[i - 1]-1; j++) {
			ab[j + bi[i - 1]] = func2(abold[j]);
		}
	}

	for (i = 0; i < bi[n]-1; i++) {
		cout << ab[i] << endl;
	}
	return 0;

}

string func0(string s) {
	return s + s;
}
string func1(string s) {
	int i;
	string t = "";
	for (i = 0; i < s.size(); i++) {
		if (s[i] == 'A') {
			t = t + "AA";
		}
		else if(s[i] == 'B') {
			t = t + "BB";
		}
	}
	return t;
}
string func2(string s) {

	int i;
	string t = "";
	for (i = 0; i < s.size(); i++) {
		if (s[i] == 'A') {
			t = t + "AB";
		}
		else if (s[i] == 'B') {
			t = t + "BA";
		}
	}
	return t;

}


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

long long int MOD = 1000000007;

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

int main() {
  long long int N, P;
  cin >> N >> P;
  long long int ans = (P - 1) * modpow(P - 2, N - 1) % MOD;
  if (ans < 0) ans += MOD;
  cout << ans << endl;
}

#include<iostream>
#include<iterator>
#include<algorithm>
#include<climits>
#include<map>
#include<set>
#include<numeric>
#include<string>
#include<sstream>
#include<cstdio>
#define ll long long
using namespace std;

int main()
{
    int i, j;
    cin >> i >> j;
    cout << (abs(i-j)<3?"Yes":"No");
}


#include<bits/stdc++.h>
#define int long long
using namespace std;
inline int read() {
    int x = 0, f = 1; char ch = getchar();
    while(ch<'0' || ch>'9') { if(ch=='-') f=-1; ch=getchar(); }
    while(ch>='0'&&ch<='9') { x=(x<<3)+(x<<1)+(ch^48); ch=getchar(); }
    return x * f;
}
const int N = 3007, mod = 998244353;
int n,K;
int f[N][N];
int DP(int i,int k) {
	if(k>i || k==0) return 0;	//先要判断是否越界，如果 k>i 可以会爆数组 f[N][N] 的下表，因为 N=3007
	if(f[i][k] != -1) return f[i][k];
	if(i == k) return f[i][k] = 1;
	return f[i][k] = (DP(i-1,k-1) + DP(i,2*k)) % mod;
}
signed main()
{
	n = read(), K = read();
	memset(f, -1, sizeof(f));
	printf("%lld\n",DP(n,K));
	return 0;
}

#include <bits/stdc++.h>
using namespace std;
#define reps(i, a, n) for (int i = (a); i < (n); ++i)
#define rep(i, n) reps(i, 0, n)
#define deps(i, a, n) for (int i = (a); i >= (n); --i)
#define dep(i, n) deps(i, n, 0)
#define inf 2147483647
#define mod 1000000007
#define int long long

int x, y;
map<int, int> mp;

int absll(int a)
{
	if (a > 0) return a;
	return -a;
}

int func(int a)
{
	if (mp.find(a) != mp.end()) return mp[a];
	if (a == 1) return mp[a] = absll(x - a);
	if (a % 2 == 0) return mp[a] = min(absll(x - a), func(a / 2) + 1);
	return mp[a] = min(absll(x - a), min(func((a + 1) / 2) + 2, func((a - 1) / 2) + 2));
}

signed main(void)
{
    cin >> x >> y;
	cout << func(y) << endl;
}