#include <bits/stdc++.h>
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define drep(i,j,n) for(int i=0;i<(int)(n-1);i++)for(int j=i+1;j<(int)(n);j++)
#define trep(i,j,k,n) for(int i=0;i<(int)(n-2);i++)for(int j=i+1;j<(int)(n-1);j++)for(int k=j+1;k<(int)(n);k++)
#define codefor int test;scanf("%d",&test);while(test--)
#define INT(...) int __VA_ARGS__;in(__VA_ARGS__)
#define LL(...) ll __VA_ARGS__;in(__VA_ARGS__)
#define yes(ans) if(ans)printf("yes\n");else printf("no\n")
#define Yes(ans) if(ans)printf("Yes\n");else printf("No\n")
#define YES(ans) if(ans)printf("YES\n");else printf("NO\n")
#define popcount(v) __builtin_popcount(v)
#define vector2d(type,name,h,...) vector<vector<type>>name(h,vector<type>(__VA_ARGS__))
#define vector3d(type,name,h,w,...) vector<vector<vector<type>>>name(h,vector<vector<type>>(w,vector<type>(__VA_ARGS__)))
#define umap unordered_map
#define uset unordered_set
using namespace std;
using ll = long long;
const int MOD=1000000007;
const int MOD2=998244353;
const int INF=1<<30;
const ll INF2=1LL<<60;
//入力系
void scan(int& a){scanf("%d",&a);}
void scan(long long& a){scanf("%lld",&a);}
template<class T,class L>void scan(pair<T, L>& p){scan(p.first);scan(p.second);}
template<class T,class U,class V>void scan(tuple<T,U,V>& p){scan(get<0>(p));scan(get<1>(p));scan(get<2>(p));}
template<class T> void scan(T& a){cin>>a;}
template<class T> void scan(vector<T>& vec){for(auto&& it:vec)scan(it);}
void in(){}
template <class Head, class... Tail> void in(Head& head, Tail&... tail){scan(head);in(tail...);}
//出力系
void print(const int& a){printf("%d",a);}
void print(const long long& a){printf("%lld",a);}
void print(const double& a){printf("%.15lf",a);}
template<class T,class L>void print(const pair<T, L>& p){print(p.first);putchar(' ');print(p.second);}
template<class T> void print(const T& a){cout<<a;}
template<class T> void print(const vector<T>& vec){if(vec.empty())return;print(vec[0]);for(auto it=vec.begin();++it!= vec.end();){putchar(' ');print(*it);}}
void out(){putchar('\n');}
template<class T> void out(const T& t){print(t);putchar('\n');}
template <class Head, class... Tail> void out(const Head& head,const Tail&... tail){print(head);putchar(' ');out(tail...);}
//デバッグ系
template<class T> void dprint(const T& a){cerr<<a;}
template<class T> void dprint(const vector<T>& vec){if(vec.empty())return;cerr<<vec[0];for(auto it=vec.begin();++it!= vec.end();){cerr<<" "<<*it;}}
void debug(){cerr<<endl;}
template<class T> void debug(const T& t){dprint(t);cerr<<endl;}
template <class Head, class... Tail> void debug(const Head& head, const Tail&... tail){dprint(head);cerr<<" ";debug(tail...);}
ll intpow(ll a, ll b){ ll ans = 1; while(b){ if(b & 1) ans *= a; a *= a; b /= 2; } return ans; }
ll modpow(ll a, ll b, ll p){ ll ans = 1; while(b){ if(b & 1) (ans *= a) %= p; (a *= a) %= p; b /= 2; } return ans; }
ll modinv(ll a, ll m) {ll b = m, u = 1, v = 0;while (b) {ll t = a / b;a -= t * b; swap(a, b);u -= t * v; swap(u, v);}u %= m;if (u < 0) u += m;return u;}
ll updivide(ll a,ll b){if(a%b==0) return a/b;else return (a/b)+1;}
template<class T> void chmax(T &a,const T b){if(b>a)a=b;}
template<class T> void chmin(T &a,const T b){if(b<a)a=b;}

/*string dijkstra(int sy,int sx,int gy,int gx){

}*/

int main(){
    int test=1000,sy,sx,gy,gx;
    int score;
    double d2;
    while(test--){
        cin>>sy>>sx>>gy>>gx;
        string s,t;
        if(gy>sy)s.resize(gy-sy,'D');
        else s.resize(sy-gy,'U');
        if(gx>sx)t.resize(gx-sx,'R');
        else t.resize(sx-gx,'L');
        cout<<s<<t<<endl;
        cin>>score;
    }
}

#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")
#pragma GCC optimize("unroll-loops")
#include<bits/stdc++.h>
using namespace std;
//#include<atcoder/all>
//using namespace atcoder;
using ll = long long;
#define For(i,n,k) for(int i=(n);i<(k);i++)
#define ALL(a) (a).begin(),(a).end()
const int MAX_N = 18;
vector<vector<int>> exdist(MAX_N, vector<int> (MAX_N, 1e9));
int k;
vector<int> c(MAX_N);
int dp[1<<MAX_N][MAX_N];
int dfs(int s, int v){
    if(dp[s][v] >= 0){
        return dp[s][v];
    }

    if(s == (1<<k)-1){
        return dp[s][v] = 0;
    }

    int ans = 1e9+100;
    For(u,0,k){
        if(!(s >> u & 1)){
            ans = min(ans, dfs(s | 1 << u, u) + exdist[v][u]);
        }
    }

    dp[s][v] = ans;
    return ans;
}
void Main(){
    int n, m;
    cin >> n >> m;
    vector<vector<int>> graph(n+1);
    For(i,0,m){
        int a, b;
        cin >> a >> b;
        graph[a].push_back(b);
        graph[b].push_back(a);
    }
    cin >> k;
    For(i,0,k){
        cin >> c[i];
    }
    For(i,0,k){
        int cnt = 0;
        vector<int> dist(n+1, 1e9);
        queue<int> q;
        dist[c[i]] = 0;
        q.push(c[i]);
        while(!q.empty()){
            auto now = q.front();
            q.pop();
            for(auto to:graph[now]){
                if(dist[to] > dist[now] + 1){
                    dist[to] = dist[now] + 1;
                    q.push(to);
                }
            }
        }
        For(j,0,k) exdist[i][j] = dist[c[j]];
    }
    For(i,0,k+1){
        exdist[i][k] = 0;
        exdist[k][i] = 0;
    }
    memset(dp,-1,sizeof(dp));
    int ans = dfs(0,k) + 1;
    cout << (ans >= 1e9 ? -1 : ans) << endl;
}
int main(){
    Main();
    /*
    東方風神録は神が出てくるので当然神ゲー
    */
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define ff first
#define ss second
#define rep(i, a, b) for(int i = a; i < (b); ++i)
#define per(i, a, b) for(int i = b-1; i>=a ; i--)
#define trav(a, x) for(auto& a : x)
#define allin(a , x) for(auto a : x)
#define all(x) begin(x), end(x)
#define sz(x) (int)(x).size()
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<ll> vl;
typedef vector<pii> vpi;
typedef pair<ll,ll> pll;
typedef vector<string> vs;
typedef vector<pll> vpl;
typedef vector<int> vi;
std::mt19937 rng((int) std::chrono::steady_clock::now().time_since_epoch().count());
#define endl '\n'
#define pb push_back
#define db(x) cerr << #x <<" == "<<x << endl;
#define db2(x,y) cerr<<#x <<" == "<<x<<", "<<#y<<" == "<<y<<endl;
#define db3(x,y,z) cerr << #x<<" == "<<x<<", "<<#y<<" == "<<y<<", "<<#z<<" == "<<z<<endl;
#define ms(v,x) memset(v,x,sizeof(v))
ll exp(ll b,ll e,ll m){
  b%=m;
  ll ans = 1;
  for (; e; b = b * b % m, e /= 2)
      if (e & 1) ans = ans * b % m;
  return ans;
}

const int N = 21;
vi g[N];
int vis[N];

vi order;
void dfs(int i){
  vis[i] = 1;
  order.pb(i);
  for(auto j : g[i])if(!vis[j])dfs(j);
}

int cor[N];

ll go(int p){
  if(p==sz(order))return 1;
  ll tot=0;
  vi cnt(4,0);
  for(auto to : g[order[p]]){
    cnt[cor[to]]++;
  }
  rep(j,1,4){
    if(cnt[j])continue;
    cor[order[p]] = j;
    tot+=go(p+1);
    cor[order[p]] = 0;
  }
  return tot;
}

ll solve(int i){
  order.clear();
  dfs(i);

  return go(0);
}

int32_t main(){
  ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
  int n,m;
  cin >> n >> m;

  ll ans = 1;
  rep(i,0,m){
    int a,b;
    cin>>a>>b;
    --a;--b;
    g[a].pb(b);
    g[b].pb(a);
  }
  rep(i,0,n){
    if(!vis[i]){
      ans = ans * solve(i);
    }
  }
  cout << ans << endl;

}

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

using namespace std;
using namespace __gnu_pbds;

#define endl '\n'

typedef long long ll;
typedef pair<ll, ll> pii;
typedef tree<int,null_type,less<int>,rb_tree_tag, tree_order_statistics_node_update> indexed_set;

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

const ll mod = 1e9 + 7;

ll mod_exp(ll a, ll b){
	if(b == 0)
		return 1ll;

	if(b % 2 == 0){
		ll t = mod_exp(a, b / 2) % mod;
		return t * t % mod;
	}
	return a * mod_exp(a, b - 1) % mod;
}

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

	//freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);

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

	ll ans = 0, k = 0;
	vector<string> a(n);
	for(int i = 0; i < n; i++){
		cin >> a[i];
		for(int j = 0; j < m; j++)
			if(a[i][j] == '.')
				k++;
	}

	vector<vector<int>> u(n, vector<int>(m)), d(n, vector<int>(m));
	vector<vector<int>> l(n, vector<int>(m)), r(n, vector<int>(m));

	for(int i = 0; i < n; i++){
		for(int j = 0; j < m; j++){
			if(a[i][j] == '.'){
				if(j - 1 >= 0 && a[i][j - 1] == '.')
					l[i][j] = l[i][j - 1] + 1;
			}
		}

		for(int j = m - 1; j >= 0; j--){
			if(a[i][j] == '.'){
				if(j + 1 < m && a[i][j + 1] == '.')
					r[i][j] = r[i][j + 1] + 1;
			}
		}
	}

	for(int j = 0; j < m; j++){
		for(int i = 0; i < n; i++){
			if(a[i][j] == '.'){
				if(i - 1 >= 0 && a[i - 1][j] == '.')
					u[i][j] = u[i - 1][j] + 1;
			}
		}

		for(int i = n - 1; i >= 0; i--){
			if(a[i][j] == '.'){
				if(i + 1 < n && a[i + 1][j] == '.')
					d[i][j] = d[i + 1][j] + 1;
			}
		}
	}

	for(int i = 0; i < n; i++)
		for(int j = 0; j < m; j++){
			if(a[i][j] == '.'){
				ll cnt = 1 + u[i][j] + d[i][j] + l[i][j] + r[i][j];
				ll rem = k - cnt;
				ll ways = (mod_exp(2ll, cnt) + mod - 1) % mod;
				ways = (ways * mod_exp(2ll, rem)) % mod;
				ans = (ans + ways) % mod;
			}
		}

	cout << ans << endl;

	return 0;
}


#include <iostream>
using namespace std;
int H, W, A, B, ans = 0;
void dfs(int i, int bit, int A, int B){
    if(i == H * W) return (void)ans++;
    if(bit & 1 << i) return dfs(i + 1, bit, A, B);
    if(B) dfs(i + 1, bit | 1 << i, A, B - 1);
    if(A){
        if(i % W != W - 1 && ~bit & 1 << (i + 1)) dfs(i + 1, bit | 1 << i | 1 << (i + 1), A - 1, B);
        if(i + W < H * W) dfs(i + 1, bit | 1 << i | 1 << (i + W), A - 1, B);
    }
}
int main(){
    cin >> H >> W >> A >> B;
    dfs(0, 0, A, B);
    cout << ans << endl;
}

#include<bits/stdc++.h>
using namespace std;
main()
{
	float v,t,s,d;
	cin>>v>>t>>s>>d;
	 float app=d/v;
	 if(app<t||app>s)
	 {
	 	cout<<"Yes"<<endl;
	 }
	 else
	 {
	 	cout<<"No"<<endl;
	 }
}


#include <stdio.h>
#include <algorithm>
#include <vector>

using namespace std;

int a[110];
int b[110];
int c[110];
int d[110];
int n,m,k;
int ans=0;
int s[110];
int p[110];

void f(int x)
{
    if(x==k)
    {
        for(int i=1;i<=n;i++) p[i]=0;
        for(int i=1;i<=k;i++)
        {
            if(s[i-1]==0) p[c[i]]=1;
            else p[d[i]]=1;
        }
        int cnt=0;
        for(int i=1;i<=m;i++)
        {
            if(p[a[i]]==1&&p[b[i]]==1) cnt++;
        }
        ans=max(ans,cnt);
        return;
    }
    s[x]=0;
    f(x+1);
    s[x]=1;
    f(x+1);
    return;
}

int main()
{
    scanf("%d%d",&n,&m);
    for(int i=1;i<=m;i++)
    {
        scanf("%d%d",&a[i],&b[i]);
    }
    scanf("%d",&k);
    for(int i=1;i<=k;i++)
    {
        scanf("%d%d",&c[i],&d[i]);
    }
    f(0);
    printf("%d",ans);
    return 0;
}

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

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

#define REP(i, n) for (int i = 0; i < (n); ++i)
#define RREP(i, n) for (int i = (n); i >= 0; --i)
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define RFOR(i, a, b) for (int i = (a); i >= (b); --i)
#define ALL(v) (v).begin(), (v).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" \
                      << " " << __FILE__ << endl;

typedef vector<int> vi;
typedef vector<string> vs;
typedef vector<vi> vvi;
typedef pair<int, int> pii;

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

    int N, M;
    cin >> N >> M;
    vi a(M), b(M);
    REP(i, M) {
        cin >> a[i] >> b[i];
        a[i]--, b[i]--;
    }
    int K;
    cin >> K;
    vi c(K), d(K);
    REP(i, K) {
        cin >> c[i] >> d[i];
        c[i]--, d[i]--;
    }

    int ans = 0;
    for (int bit = 0; bit < (1<<K); ++bit)
    {
        vector<bool> S(N, false);
        REP(i, K)
            if (bit & (1<<i)) {
                S[c[i]] = true;
            } else {
                S[d[i]] = true;
            }

        int cnt = 0;
        REP(i, M) {
            if (S[a[i]] and S[b[i]]) cnt++;
        }

        ans = max(ans, cnt);
    }

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


#include<iostream>
#include<utility>
#include<algorithm>
#include<map>
#include<vector>
#include<cmath>
#define forn(i, x, n) for(int i = x; i < (int)(n); i++)
using namespace std;
typedef long long ll;
const int mod = 1e9 + 7;
const bool DEBUG = 0;

void solve(){
    int n;
    cin>>n;
    int sz = (1 << n);
    int a[sz];
    forn(i, 0, sz) cin>>a[i];
    int l = 0, r = sz/2;
    forn(i, 0, sz/2) if(a[l] < a[i]) l = i;
    forn(i, sz/2, sz) if(a[r] < a[i]) r = i;
    cout<< ((a[l] > a[r])? r+1: l+1);
}

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	int t = 1;
    //cin>>t;
	//while(t--) cout<<solve()<<'\n';
	while(t--) solve(), cout<<'\n';

}

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

int main()
{
    ios_base::sync_with_stdio(0); cin.tie(0);
    int a,b,c,d;
    cin>>a>>b>>c>>d;
    cout<<min(min(a,b),min(c,d));
    return 0;
}


#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <queue>
#include <stack>
#include <map>
#include <algorithm>
#include <math.h>
#include <cassert>
#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; ll x;
  cin >> n >> x;
  vector<ll> a(n);
  rep(i,n) cin >> a[i];
  reverse(a.begin(),a.end());

  map<ll,ll> dp;
  ll x0 = x/a[0]*a[0];
  dp[x0] = 1;
  if(x0!=x) dp[x0+a[0]] = 1;

  for(int i=1;i<n;++i){
    map<ll,ll> ndp;
    ll mx = a[i-1]/a[i];
    for(auto p:dp){
      ll d = x-p.first;
      ll m = d/a[i];
      ll nx = p.first + m*a[i];
      if(abs(m)<mx) {
        ndp[nx] += p.second;
      }
      if(nx!=x && abs(m)+1<mx) {
        ndp[nx + a[i]*(d/abs(d))] += p.second;
      }
    }
    swap(dp,ndp);
  }
  cout << dp[x] << endl;
}

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

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

namespace IO {
	const int MAXIOSIZE = 1 << 24 | 1;
	unsigned char buf[MAXIOSIZE], *p1, *p2;
	#define gc (p1 == p2 && (p2 = (p1 = buf) + fread(buf, 1, 1 << 24, stdin), p1 == p2) ? EOF : *p1++)
	template <typename T> void read(T& x) {
		x = 0; char ch = gc; bool flg = false;
		for (; ch < '0' || '9' < ch; ch = gc) if (ch == '-') flg |= true;
		for (; '0' <= ch && ch <= '9'; ch = gc) x = x * 10 + ch - '0';
		flg ? x = -x : 0;
	}
	template <typename T> void out(const T& x) { if (x > 9) out(x / 10); putchar(x % 10 + '0'); }
	template <typename T> inline void write(const T& x, const char& ed) { if (x < 0) putchar('-'), out(-x); else out(x); putchar(ed); }
}

typedef long long ll;

const int MAXN = 50 + 10;

int n;
ll x, X[MAXN], a[MAXN], A[MAXN], f[MAXN][2];

int main() {
	IO::read(n); IO::read(x);
	a[0] = 1;
	rep(i, 1, n) IO::read(a[i]), A[i - 1] = (a[i] / a[i - 1]) - 1;
	A[n] = LONG_LONG_MAX;
	ll x_copy = x;
	per(i, n, 1) {
		if (!x_copy) break;
		if (x_copy >= a[i]) X[i] = x_copy / a[i], x_copy %= a[i];
	}
	f[0][0] = 1;
	rep(i, 0, n - 1) {
		rep(carry, 0, 1) {
			ll& slf = f[i][carry];
			ll nxt = X[i + 1] + carry; bool carry_tag = false;
			if (nxt > A[i + 1]) carry_tag = true;
			f[i + 1][carry_tag] += slf;
			nxt = A[i + 1] + 1 - carry - X[i + 1];
			if (nxt > 0 && nxt <= A[i + 1]) f[i + 1][true] += slf;
		}
	}
	IO::write(f[n][false], '\n');
	return 0;
}


#include <iostream>
using namespace std;

int main() {
	int c,a,b;
	cin >> a >> b>> c;
	cout << a-b+c;
	// your code goes here
	return 0;
}

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

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

    vector<int> m(3);
    m[0] = a;
    m[1] = b;
    m[2] = c;

    sort(m.rbegin(), m.rend());

    int ans = 0;
    rep(i, 0, 2) ans += m[i];

    cout << ans << endl;
}


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

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

//-----------------------------------------------MACROS----------------------------------------------------------------------
#include<bits/stdc++.h>
using namespace std;
#define IOS ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define ll long long
#define ull unsigned long long
#define lld long double
#define all(a) a.begin(),a.end()
#define fi first
#define sc second
#define pii pair<int,int>
#define FOR(sz) for(int i = 0; i < sz; i++)
#define pb(x) push_back(x)
#define sz(x) (int)x.size()
//-----------------------------------------------MACROS----------------------------------------------------------------------

//---------------------------------------------DEBUGGER-----------------------------------------------------------------------
#ifndef ONLINE_JUDGE
#define debug(x) cerr << #x <<" "; _print(x); cerr << endl;
#else
#define debug(x)
#endif

void _print(ll t) {cerr << t;}
void _print(int t) {cerr << t;}
void _print(string t) {cerr << t;}
void _print(char t) {cerr << t;}
void _print(lld t) {cerr << t;}
void _print(double t) {cerr << t;}
void _print(ull t) {cerr << t;}

template <class T, class V> void _print(pair <T, V> p);
template <class T> void _print(vector <T> v);
template <class T> void _print(set <T> v);
template <class T, class V> void _print(map <T, V> v);
template <class T> void _print(multiset <T> v);
template <class T, class V> void _print(pair <T, V> p) {cerr << "{"; _print(p.ff); cerr << ","; _print(p.ss); cerr << "}";}
template <class T> void _print(vector <T> v) {cerr << "[ "; for (T i : v) {_print(i); cerr << " ";} cerr << "]";}
template <class T> void _print(set <T> v) {cerr << "[ "; for (T i : v) {_print(i); cerr << " ";} cerr << "]";}
template <class T> void _print(multiset <T> v) {cerr << "[ "; for (T i : v) {_print(i); cerr << " ";} cerr << "]";}
template <class T, class V> void _print(map <T, V> v) {cerr << "[ "; for (auto i : v) {_print(i); cerr << " ";} cerr << "]";}
//---------------------------------------------DEBUGGER-----------------------------------------------------------------------

//TO-DO ll V/s int?

int t;
ll n;
ll f(ll m) {
	ll x = (ll)((100 + t) * m)/100;
	return x;
}
void solve() {
   cin >> t >> n;
   ll l = 1;
   ll r = 1e12 + 1;
   while(r > l + 1) {
   	ll  mid = (l+r)/2;
   	if(f(mid) - mid < n) {
   		l = mid;
   	}
   	else
   		r = mid;
   }
   cout << f(l) + 1;
}

int main(){
  IOS;
  #ifndef ONLINE_JUDGE
      freopen("input.txt","r", stdin);
      freopen("output.txt", "w" , stdout);
      freopen("Error.txt","w",stderr);
  #endif
  int tc = 1;
 //cin >> tc;
  while(tc--) {
    solve();
  }
  return 0;
}


#include <iostream>
#include <cstdio>
#include <cmath>
#include <ctime>
#include <cstdlib>
#include <cassert>
#include <vector>
#include <list>
#include <stack>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <bitset>
#include <string>
#include <algorithm>
#include <utility>
#include <complex>
#define rep(x, s, t) for(llint (x) = (s); (x) <= (t); (x)++)
#define reps(x, s) for(llint (x) = 0; (x) < (llint)(s).size(); (x)++)
#define chmin(x, y) (x) = min((x), (y))
#define chmax(x, y) (x) = max((x), (y))
#define all(x) (x).begin(),(x).end()
#define outl(x) cout << x << endl
#define SP << " " <<
#define inf 1e18

using namespace std;

typedef long long llint;
typedef long long ll;
typedef pair<llint, llint> P;

ll n;
vector<ll> G[100005];
ll num[100005];
ll dp[100005];

void dfs(int v)
{
	num[v] = 1;
	for(auto u : G[v]) dfs(u), num[v] += num[u];

	vector<ll> vec[2];
	for(auto u : G[v]) vec[num[u]%2].push_back(dp[u]);
	sort(all(vec[0])), reverse(all(vec[0]));
	sort(all(vec[1])), reverse(all(vec[1]));

	dp[v] = -1;
	reps(i, vec[0]) if(vec[0][i] >= 0) dp[v] += vec[0][i];
	reps(i, vec[1]){
		if(i % 2 == 0) dp[v] += vec[1][i];
		else dp[v] -= vec[1][i];
	}
	reps(i, vec[0]) if(vec[0][i] < 0){
		if(vec[1].size() % 2) dp[v] -= vec[0][i];
		else dp[v] += vec[0][i];
	}
}

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

	cin >> n;
	ll p;
	rep(i, 2, n){
		cin >> p;
		G[p].push_back(i);
	}
	dfs(1);

	//rep(i, 1, n) cout << dp[i] << " "; cout << endl;

	cout << (n-dp[1])/2 << endl;

	return 0;
}

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

using std::cin;
using std::cout;
using std::vector;
using ll = long long;

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

	vector<int> a(n);
	rep(i, n) cin >> a[i];

	vector<int> cnt(200);
	rep(i, n) cnt[a[i] % 200]++;

	ll ans = 0;
	rep(i, 200) ans += (ll)cnt[i] * (cnt[i] - 1) / 2;

	cout << ans << '\n';

	return 0;
}


//Let's join Kaede Takagaki Fan Club !!
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
//#define int long long
typedef long long ll;
typedef pair<int,int> P;
typedef pair<int,P> P1;
typedef pair<P,P> P2;
#define pu push
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define eps 1e-7
#define INF 1000000000
#define a first
#define b second
#define fi first
#define sc second
#define rng(i,a,b) for(int i=int(a);i<int(b);i++)
#define rep(i,x) for(int i=0;i<x;i++)
#define repn(i,x) for(int i=1;i<=x;i++)
#define SORT(x) sort(x.begin(),x.end())
#define ERASE(x) x.erase(unique(x.begin(),x.end()),x.end())
#define POSL(x,v) (lower_bound(x.begin(),x.end(),v)-x.begin())
#define POSU(x,v) (upper_bound(x.begin(),x.end(),v)-x.begin())
#define all(x) x.begin(),x.end()
#define si(x) int(x.size())

#ifdef LOCAL
#define dmp(x) cerr<<__LINE__<<" "<<#x<<" "<<x<<endl
#else
#define dmp(x) void(0)
#endif

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

template<class t> using vc=vector<t>;

template<class t,class u>
ostream& operator<<(ostream& os,const pair<t,u>& p){
	return os<<"{"<<p.fi<<","<<p.sc<<"}";
}

template<class t> ostream& operator<<(ostream& os,const vc<t>& v){
	os<<"{";
	for(auto e:v)os<<e<<",";
	return os<<"}";
}

template<class T>
void g(T &a){
	cin >> a;
}
template<class T>
void o(const T &a,bool space=false){
	cout << a << (space?' ':'\n');
}
//ios::sync_with_stdio(false);
const ll mod = 1000000007;//998244353
mt19937_64 mt(chrono::steady_clock::now().time_since_epoch().count());
template<class T>
void add(T&a,T b){
	a+=b;
	if(a >= mod) a-=mod;
}
ll modpow(ll x,ll n){
	ll res=1;
	while(n>0){
		if(n&1) res=res*x%mod;
		x=x*x%mod;
		n>>=1;
	}
	return res;
}

void solve(){
	int l, r; cin >> l >> r;
	ll ans = 0;
	if(l+l > r) ans = 0;
	else ans = 1LL * (r - l - l + 1) * (r - l - l + 2) / 2;
	cout << ans << endl;;
}
signed main(){
	cin.tie(0);
	ios::sync_with_stdio(0);
	cout<<fixed<<setprecision(20);
	int t; cin >> t;
	while(t--) solve();
}

#include<stdio.h>
#include<iostream>
#include<string.h>
#include<algorithm>
#include<queue>
#include<stack>
#include<math.h>
#include<map>
typedef long long int ll;
using namespace std;
#define maxn 0x3f3f3f3f
#define INF 0x3f3f3f3f3f3f3f3f
const int mm=2e5+100;
ll d[mm];
int main()
{
   ll n,m,i,j,t,a,b,c,p,k,kk;
   scanf("%lld",&t);
   while(t--)
   {
	  scanf("%lld%lld",&n,&m);
	  ll sum=0;
	  a=m-(2*n)+1; a=max(0ll,a);
	  p=m-(n+m)+1; p=max(0ll,p);
	  sum=(a+p)*(a-p+1)/2;
	  cout<<sum<<endl;
    }
}


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

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

  int n;
  cin >> n;
  vi a(n), b(n);
  rep(i, n){cin >> a[i];
  }
  rep(i, n)cin >> b[i];

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

  if(ans!=0)cout << "No\n";
  else cout << "Yes\n";

  return 0;
}

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

using namespace std;
//using namespace atcoder;

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

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

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

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

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

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

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

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

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

// edit

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

    while (T--) {
        int N;
        cin >> N;
        vector<ll> v(N);
        REP(i, N) cin >> v[i];
        if (N % 2 == 1) {
            cout << "Second" << endl;
        } else {
//            cout << "First" << endl;
            sort(ALL(v));
            bool first = false;
            for (int i = 0; i < v.size(); i += 2) {
                if (v[i] != v[i + 1]) {
                    first = true;
                    break;
                }
            }
            if (first) {
                cout << "First" << endl;
            } else {
                cout << "Second" << endl;
            }
        }
    }

}

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

    solve();

    return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define d(x) cout<<x<<" "
#define nl cout<<endl
#define rep(var,init_val,final_val) for(int var = init_val; var < final_val; ++var)
#define show(a,b) rep(i,0,b) d(a[i]);nl;
#define showv(a) for(auto x : a) d(x);nl;
#define vi std::vector<int>
#define pi pair<int,int>
#define mod 1000000007
void solve(){
	int a , b;
	cin>>a>>b;
	vi ans;
	if(a>b){
		int sum = 0;
		rep(i,1,a+1){
			ans.pb(i);
			sum+=i;
		}
		rep(i,1,b){
			ans.pb(-i);
			sum-=i;
			}
		ans.pb(-sum);
		}
	else{
		int sum = 0;
		rep(i,1,b+1){
			ans.pb(-i);
			sum+=i;
		}
		rep(i,1,a){
			ans.pb(i);
			sum-=i;
			}
		ans.pb(sum);
	}
	showv(ans);
}

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

#include <bits/stdc++.h>
using namespace std;
int main() {
    ios::sync_with_stdio(false), cin.tie(0);
    if (fopen("input.in", "r"))
        freopen("input.in", "r", stdin), freopen("output.out", "w", stdout);
    int n;
    cin>>n;
    vector<int> a(n); for(int& i : a) cin>>i, i--;
    vector<int> loc(n);
    for(int i = 0; i < n; i++) loc[a[i]] = i;
    vector<int> ans;
    vector<bool> used(n-1, 0);
    bool bad = 0;
    for(int i = 0; i < n; i++) {
        if(loc[i] != i){
            assert(loc[i] > i);
            for(int k = loc[i]-1; k>=i; k--){
                if(used[k]) {
                    bad = 1; goto done;
                }
                used[k] = 1;
                ans.push_back(k);
                loc[a[k]]++;
                loc[a[k+1]]--;
                swap(a[k], a[k+1]);
                assert(loc[a[k+1]]==k+1 && loc[a[k]]==k);
            }
        }
        assert(loc[i] == i);
    }
    done:;
    if(ans.size()!=n-1) bad=1;
    if(bad) cout<<-1<<'\n';
    else for(int i : ans) cout<<i+1<<'\n';

}


#include <iostream>
#include <vector>
using namespace std;
vector<int> v[1500010];
int main(){
    int i,j,n,m; cin >> n >> m;
    for(i=0;i<n;i++) v[i].push_back(-1);
    for(i=0;i<n;i++){
        int a; cin >> a;
        v[a].push_back(i);
    }
    for(i=0;i<n;i++) v[i].push_back(n);
    for(i=0;i<=n;i++){
        if(v[i].size()<=2){
            cout << i << endl;
            return 0;
        }
        for(j=1;j<v[i].size();j++){
            if(v[i][j] - v[i][j - 1]>m){
                cout << i << endl;
                return 0;
            }
        }
    }
}

#include<bits/stdc++.h>
using namespace std;
#define debug(...) fprintf(stderr, __VA_ARGS__), fflush(stderr)
typedef int ll;
typedef long double ld;
typedef pair<ll,ll> p2;
#define sz(a) ll(a.size())
ll a[2000005];
void solve(){
	ll n,m;
	cin>>n>>m;
	for(ll i=0;i<n;i++)
		cin>>a[i];
	ll l0=0,r0=n;
	while(l0<=r0){
		ll m0=(l0+r0)/2,f=0;
		vector<ll> v(m0,0);
		for(ll i=0;i<m;i++){
			if(a[i]>=m0)
				continue;
			v[a[i]]++;
		}
		for(ll i=0;i<m0;i++)
			if(v[i]==0){
				f=1;
				break;
			}
		if(!f){
			for(ll i=1;i<=n-m;i++){
				if(a[i+m-1]<m0){
					v[a[i+m-1]]++;
				}
				if(a[i-1]<m0){
					v[a[i-1]]--;
					if(v[a[i-1]]==0){
						f=1;
						break;
					}
				}
			}
		}
		if(f)
			r0=m0-1;
		else
			l0=m0+1;
	}
	cout<<r0;
}
int 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
    clock_t z=clock();
    ll qc=1;
    //cin>>qc;
    for(ll i=1;i<=qc;i++){
        solve();
    }
    debug("Total Time:%.4Lf\n",(ld)(clock()-z)/CLOCKS_PER_SEC);
}


#include <cmath>
#include <iostream>

int main() {
    long long n;
    std::cin >> n;
    long long ans {0};
    long long k {1};
    while (n >= pow(10, k*3)) {
        ans += n - pow(10, k*3) + 1;
        ++k;
    }
    std::cout << ans << std::endl;
}

#include <bits/stdc++.h>
using namespace std;
#define ll long long int
int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);cout.tie(0);
       string s;cin>>s;int cnt=0;
       for(int i=3;i<s.size();i++){
           if(s[i]=='e' && s[i-1]=='N' && s[i-2]=='O' && s[i-3]=='Z')cnt++,i+=2;
       }
       cout<<cnt<<endl;

}


// arc110_a
#include <bits/stdc++.h>
#ifdef LOCAL
#include "../cxx-prettyprint/prettyprint.hpp"
#endif
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> P;

#define REP(i, n) for (int (i) = 0 ; (i) < (int)(n) ; ++(i))
#define REPN(i, m, n) for (int (i) = m ; (i) < (int)(n) ; ++(i))
#define REP_REV(i, n) for (int (i) = (int)(n) - 1 ; (i) >= 0 ; --(i))
#define REPN_REV(i, m, n) for (int (i) = (int)(n) - 1 ; (i) >= m ; --(i))
#define ALL(x) x.begin(), x.end()

#define INF (ll)(1e9)
#define MOD (1000000007)

#define print2D(h, w, arr) REP(i, h) { REP(j, w) cout << arr[i][j] << " "; cout << endl; }
#define print_line(vec, n) {for(int idx=0;idx<(n-1);idx++) cout << (vec)[idx] << " "; cout << (vec)[(n)-1] << endl;}
template<class T> void print(const T& x){cout << x << "\n";}
template<class T, class... A> void print(const T& first, const A&... rest) { cout << first << " "; print(rest...); }
struct PreMain {PreMain(){cin.tie(0);ios::sync_with_stdio(false);cout<<fixed<<setprecision(20);}} premain;

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

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

int main() {
#ifdef LOCAL
    ifstream in("../arg.txt"); cin.rdbuf(in.rdbuf());
#endif

    ll N;
    cin >> N;

    ll m = 1;
    REPN(i, 2, N+1){
        m = lcm(m, i);
    }

    print(m+1);

    return 0;
}

#include <bits/stdc++.h>
#define mk make_pair
#define fs first
#define sc second
using namespace std;
typedef long long ll;
typedef long double ld;
// please, read the question correctly (do you need set or multiset)???
const int N=200010; //check the limits, dummy
int a[N];
int n, m;
int main(){
	// int t;
	// while(){
	scanf("%d",&n);
	ll ans = 2, tmp;
	for(ll i=3; i<=n; ++i){
		tmp = __gcd(ans, i);
		ans = (ans * i)/tmp;
	}
	ans += 1;
	for(int i=2; i<=n; ++i){
		assert(ans%i==1);
	}
	cout<<ans<<endl;
	// }
}


#include <cstdio>

int main() {
  long long s, p;
  scanf("%lld%lld", &s, &p);
  for (long long i = 1; i * i <= p; ++i)
    if (p % i == 0) {
      if (i + p / i == s) return puts("Yes"), 0;
    }
  puts("No");
  return 0;
}

#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) begin(v),end(v)
template<typename A, typename B> inline bool chmax(A &a, B b) { if (a<b) { a=b; return 1; } return 0; }
template<typename A, typename B> inline bool chmin(A &a, B b) { if (a>b) { a=b; return 1; } return 0; }
using ll = long long;
using pii = pair<int, int>;
constexpr ll INF = 1ll<<30;
constexpr ll longINF = 1ll<<60;
constexpr ll MOD = 1000000007;
constexpr bool debug = 0;
//---------------------------------//

int main() {
	ll S, P;
	cin >> S >> P;
	puts([&] {
		for (ll i = 1; i * i <= P; ++i) {
			ll n = i, m = S - i;
			if (n > 0 && m > 0 && n * m == P) return true;
		}
		return false;
	}() ? "Yes": "No");
	return 0;
}


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

int main()
{
    io;
    int n, m; cin >> n >> m;
    ll a = 0, b = 0;
    rep(i, n) {
        string s;
        cin >> s;
        int cnt = 0;
        for (auto c : s) {
            if (c == '1') cnt++;
        }
        if (cnt % 2 == 0) a++;
        else b++;
    }
    cout << a*b << endl;
    return 0;
}

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

#define rep2(i,k,n) for(i64 i=(i64)(k);i<(i64)(n);i++)
#define rep(i,n) rep2(i,0,n)
#define all(x) begin(x),end(x)
#ifdef ENV_LOCAL
#define dump if (1) cerr
#else
#define dump if (0) cerr
#endif

using namespace std;
using namespace std::string_literals;

using i32 = int32_t;
using i64 = int64_t;
using f64 = double;
using f80 = long double;
using vi32 = vector<i32>;
using vi64 = vector<i64>;

//using namespace harudake;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  i32 n;
  cin>>n;
  vi32 oknum;
  rep2(i,1,5000) {
    if (i % 3 == 0 || i % 5 == 0 || i % 7 == 0) {
      oknum.push_back(i*2);
    }
  }
  rep(i,n-1) {
    cout<<oknum[i]<<" ";
  }
  cout<<(3*5*7)<<endl;
  return 0;
}


#include <bits/stdc++.h>
using namespace std;
//#include "testlib.h"
#define ff first
#define ss second
#define all(v) v.begin(),v.end()
#define int long long
#define ll long long
#define M 1000000007
#define MM 998244353
#define inputarr(a,n) for(int i=0;i<n;++i) cin>>a[i]
#define GCD(m,n) __gcd(m,n)
#define LCM(m,n) m*(n/GCD(m,n))
#define mii  map<ll ,ll >
#define msi  map<string,ll >
#define rep(a,b)    for(ll i=a;i<b;i++)
#define rep0(n)    for(ll i=0;i<n;i++)
#define repi(i,a,b) for(ll i=a;i<b;i++)
#define pb push_back
#define vi vector<ll>
#define vs vector<string>
#define ppb pop_back
#define endl '\n'
#define asdf ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define r0 return 0;
#define FORD(i, a, b) for (int i = (int) (a); i >= (int) (b); --i)
#define inputoutput freopen("input.txt", "r", stdin);freopen("output.txt", "w", stdout);
#define Set(a, s) (a, s, sizeof (a))
#define FOR repi
#define vii vector<pii>
#define pii pair<int,int>
#define REVERSE(v) reverse(all(v))
#define trav(a, x) for(auto& a : x)
#define display(x) trav(a,x) cout<<a<<" ";cout<<endl
#define debug cerr<<"bhau"<<endl
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
    std::cerr << name << " : " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
    const char* comma = strchr(names + 1, ',');std::cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
template<typename T, typename U> static inline void amin(T &x, U y)
{
    if (y < x)
        x = y;
}
template<typename T, typename U> static inline void amax(T &x, U y)
{
    if (x < y)
        x = y;
}
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

ll max(ll a, ll b) { return (a > b)? a : b;}
int min(int a, int b) { return (a < b)? a : b;}

const int N = 4e5+10;
vi adj[N];
bool vis[N];
int vert;
bool tree = 1;
void dfs(int v,int p){
    vert++;
    vis[v]=1;
    for(auto i:adj[v]){
        if(i!=p){
            if(vis[i])
                tree=0;
            else
                dfs(i,v);
        }
    }
}
int solve(){

    int n;cin>>n;
    int a,b;
    rep0(n){
        cin>>a>>b;
        adj[a].pb(b);
        adj[b].pb(a);
    }
    int ans=0;
    for(int i=1;i<=N;i++){
        if(!vis[i]){
            tree = 1;
            vert=0;
            dfs(i,-1);

            if(tree){
                ans+=vert-1;
            }
            else ans+=vert;
        }
    }
    cout<<ans<<endl;

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

#include <bits/stdc++.h>
using namespace std;
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
template <class c, class cmp = less<c> > using ordered_set = tree<c, null_type, cmp, rb_tree_tag, tree_order_statistics_node_update>;
#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define TRACE
#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
  cerr << name << " : " << arg1 << std::endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
  const char* comma = strchr(names + 1, ',');cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
#else
#define trace(...)
#endif
template<class T> ostream& operator<<(ostream &os, vector<T> V) {os << "[ "; for(auto v : V) os << v << " "; return os << "]";}
template<class L, class R> ostream& operator<<(ostream &os, pair<L,R> P) {return os << "(" << P.first << "," << P.second << ")";}
template <typename T,typename U>pair<T,U> operator+(const pair<T,U> & l,const std::pair<T,U> & r) { return {l.first+r.first,l.second+r.second};}
typedef long long int ll;
const ll MOD = 1e9 + 7;
const ll maxn = 5e6 + 5;
#define endl '\n'
#define ld long double
#define int ll
#define all(x)  (x).begin(),(x).end()

ll sum(ll x, ll y)
{
  x += y;
  if (x >= MOD)
    return x - MOD;
  return x;
}
ll mult(ll x, ll y)
{
  return (x * y) % MOD;
}

inline ll power(ll a, long long b) {
  ll res = 1;
  while (b > 0) {
    if (b & 1) {
      res = mult(res, a);
    }
    a = mult(a, a);
    b >>= 1;
  }
  return res;
}

const ll N=100;
int n;
struct Matrix
{
  ll a[N][N];

  Matrix()
  {
    for (int i = 0; i < n; i++)
      for (int j = 0; j < n; j++)
        a[i][j] = 0;
  }

  Matrix operator * (const Matrix &X) const
  {
    Matrix res;
    for (int i = 0; i < n; i++)
      for (int j = 0; j < n; j++)
      {
        res.a[i][j] = 0;
        for (int h = 0; h < n; h++)
        {
          res.a[i][j] = sum(res.a[i][j], mult(a[i][h], X.a[h][j]));
        }
      }
    return res;
  }
};

Matrix bin_pow(Matrix x, ll pow)
{
  if (pow == 1) return x;
  if (pow == 2) return x * x;
  if (pow & 1) return x * bin_pow(x, pow - 1);
  return bin_pow(bin_pow(x, pow / 2), 2);
}

int32_t main(){

  IOS

  int m, k;
  cin >> n >> m >> k;
  int a[n];
  for(int i = 0; i<n;i++){
    cin >> a[i];
    if(k == 0) cout << a[i] << endl;
  }
  if(k == 0) return 0;

  int inv_m = power(2*m, MOD - 2);
  Matrix G;
  int deg[n] = {0};
  for(int i = 0; i < m;i++){
    int u, v;
    cin >> u >> v;
    u--, v--;
    deg[u]++;
    deg[v]++;
    G.a[u][v] = inv_m;
    G.a[v][u] = inv_m;
  }

  for(int i = 0;i < n;i++) G.a[i][i] = mult(2*m - deg[i], inv_m);

  // for(int i = 0; i < n;i++){
  //   for(int j = 0;j<n;j++) cout << G.a[i][j] << " ";
  //   cout << endl;
  // }
  G = bin_pow(G, k);
  for(int i = 0; i < n;i++){
    int ans = 0;
    for(int j = 0; j < n;j++){
      ans = sum(ans, mult(a[j], G.a[j][i]));
    }
    cout << ans << endl;
  }

}


#include"bits/stdc++.h"
using namespace std;
#define pb push_back
#define eb emplace_back
#define ins insert
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
#define rep(i,a,b) for(int i=a;i<=b;i++)
#define repr(i,a,b) for(int i=a;i>=b;i--)
#define lb lower_bound
#define ub upper_bound
#define sz(x) (int)x.size()
#define pii pair<int,int>
#define fir first
#define sec second
#define popcount __builtin_popcount
#pragma GCC target ("avx2")
#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
using ll=long long int;
using ld=long double;
#define mp make_pair
#define mt make_tuple
#define bit(x,j) (((ll)x>>j)&1)
#define um unordered_map
#define mem(a,val) memset(a,val,sizeof(a))
void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x){cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(ld x){cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x){cerr<<'\"'<<x<<'\"';}
void __print(const string &x) {cerr<<'\"'<<x<<'\"';}
void __print(bool x){cerr<<(x?"true":"false");}
template<typename T, typename V>
void __print(const pair<T, V> &x){cerr<<'{'; __print(x.first);cerr<<','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
template <typename A, typename B, typename C>
string to_string(tuple<A, B, C> p)
{ return "(" + to_string(get<0>(p)) + ", " + to_string(get<1>(p)) + ", " + to_string(get<2>(p)) + ")";}
template <typename A, typename B, typename C, typename D>
string to_string(tuple<A, B, C, D> p)
{ return "(" + to_string(get<0>(p)) + ", " + to_string(get<1>(p)) + ", " + to_string(get<2>(p)) + ", " + to_string(get<3>(p)) + ")"; }
void debug_out() { cerr << endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T)
{
  cerr << " " << to_string(H);
  debug_out(T...);
}
#ifndef ONLINE_JUDGE
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define debug(x...)
#endif
#ifndef ONLINE_JUDGE
#define debugt(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
#define debugt(...) 42
#endif
constexpr ll inf=2223372036854775807;
constexpr int mod1=(1e9+7);
constexpr int mod2=(998244353);
constexpr int MAX=(1e4+3);
constexpr int N=2e5+5;
int f(int n){
  int s=0;
  while(n){
    s+=n%10; n/=10;
  }
  return s;
}
void solve()
{
 int a,b; cin>>a>>b;
 cout<<max(f(a),f(b))<<"\n";
}
int main()
{
  #ifndef ONLINE_JUDGE
  freopen("input.txt","r",stdin);
  freopen("output.txt","w",stdout);
  #endif
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  int t=1; int c=1;
  while(t--)
  {
    solve(); c++;
  }
}

#include<bits/stdc++.h>
#define For(a,b,c) for(int a=b;a<=c;++a)
#define Dor(a,b,c) for(int a=b;a>=c;--a)
#define CC(_...) fprintf(stderr,_)
using namespace std;
typedef long long LL;
enum{N=800007};
int n,A[N],B[N],I[N],S[N];
bool cmp(int x,int y) {
	return A[x]<A[y];
}
int main() {
	scanf("%d",&n);
	For(i,1,2*n) scanf("%d",A+i),I[i]=i;
	sort(I+1,I+1+2*n,cmp);
	For(i,1,n) B[I[i]]=1;
	int t=0,o;
	For(i,1,2*n) {
		if(!t||o==B[i]) {
			S[++t]=i,o=B[i];
			putchar('(');
		}
		else {
			--t;
			putchar(')');
		}
	}
	return 0;
}


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

#define Mod(x) (x>=P)&&(x-=P)
#define rep(i,a,b) for(ll i=a,i##end=b;i<=i##end;++i)
#define drep(i,a,b) for(ll i=a,i##end=b;i>=i##end;--i)
#define erep(i,a) for(ll i=hd[a];i;i=nxt[i])

typedef long long ll;
void Max(ll &x,ll y){x<y&&(x=y);}
void Min(ll &x,ll y){x>y&&(x=y);}

bool vio;
char IO;
ll rd(ll res=0){
	bool f=0;
	while(IO=getchar(),IO<48||IO>57)
		f|=IO=='-';
	do res=(res<<1)+(res<<3)+(IO^48);
	while(IO=getchar(),isdigit(IO));
	return f?-res:res;
}
const ll M=1005;
ll nxt[M],to[M],hd[M],ecnt,n,m;
bool mk[M],fl;
ll dep[M];
void Add(ll a,ll b){
	nxt[++ecnt]=hd[a],to[hd[a]=ecnt]=b;
}
void dfs(ll x){
	if(!fl)return ;
	erep(i,x){
		ll y=to[i];
		if(!mk[y])continue;
		if(dep[y]==-1)dep[y]=dep[x]^1,dfs(y);
		else if(dep[y]==dep[x])fl=0;
	}
}
bool let;
int main(){
	cerr<<(&vio-&let)/1024.0/1024<<endl;
	n=rd(),m=rd();
	rep(i,1,m){
		ll a=rd(),b=rd();
		Add(a,b),Add(b,a);
	}
	ll S=(1<<n)-1,res=0;
	rep(k,0,S){
		rep(i,1,n)mk[i]=0,dep[i]=-1;
		rep(i,1,n)if(1<<(i-1)&k)
			mk[i]=1;
		ll ans=1;
		fl=1;
		rep(i,1,n)if(!mk[i])
			erep(j,i)if(!mk[to[j]])fl=0;
		rep(i,1,n)if(mk[i]&&dep[i]==-1)
			ans=ans*2,dep[i]=0,dfs(i);
		if(fl)res+=ans;
	}
	printf("%lld",res);
	return 0;
}

#include<iostream>
#include<cstdio>
#include<string>
#include<cstring>
#include<algorithm>
#include<vector>
#include<utility>
using namespace std;
typedef long long ll;
const int MAXN = 1e5 + 5;
ll A[MAXN], N, M, K, mx[MAXN], mn[MAXN];
bool check(ll x) {
	ll MX = 0, MN = 0;
	for(int i = 1; i <= K; i++) {
		MX += (x + M * A[i]) / N;
		if(M * A[i] - x > 0) {
			MN += (M * A[i] - x) / N + ((M * A[i] - x) % N != 0);
		}
	}
	return (MX >= M && MN <= M);
}
ll find() {
	ll l = 0, r = M * N;
	ll ans = (l + r) >> 1;
	while(l <= r) {
		ll mid = (l + r) >> 1;
		if(check(mid)) {
			ans = mid;
			r = mid - 1;
		} else l = mid + 1;
	}
	return ans;
}
int main() {
	scanf("%lld%lld%lld", &K, &N, &M);
	for(int i = 1; i <= K; i++) scanf("%lld", &A[i]);
	ll ans = find();
	for(int i = 1; i <= K; i++) {
		mx[i] = (ans + M * A[i]) / N;
		if(M * A[i] - ans > 0) {
			mn[i] = (M * A[i] - ans) / N + ((M * A[i] - ans) % N != 0);
		} else  mn[i] = 0;
	}
	for(int i = 1; i <= K; i++) M -= mn[i];
	for(int i = 1; i <= K; i++) {
		ll diff = mx[i] - mn[i];
		mn[i] += min(M, diff);
		M -= min(M, diff);
		if(M == 0) break;
	}
	for(int i = 1; i <= K; i++) printf("%lld ", mn[i]);
	return 0;
}


#include <bits/stdc++.h>
//#include <atcoder/all>
#define endl "\n"
using namespace std;
typedef long long ll;
typedef pair<ll, ll> l_l;
typedef pair<int, int> i_i;
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;
}

const long long INF = 1e18;
//const ll mod = 1000000007;
ll N, K;
ll h(ll j) {
    ll ret = 0;
        if(j <= 0) return 0;
        if(j > 2 * N) {
            return 0;
        }
        if(j <= N + 1) {
            return j - 1;
        } else {
            ll k = N - (j - N) + 1;
            return k;
        }
        return ret;
}

ll g(ll j) {
    ll ret = 0;
        if(j <= 0) return 0;
        if(j > 2 * N) {
            ret += N * N;
            return ret;
        }
        if(j <= N + 1) {
            ret += (j - 1) * j / 2;
        } else {
            ret += N * N;
            ll k = N - (j - N) + 1;
            ret -= (k - 1) * (k) / 2;
        }
        return ret;
}

ll f(ll x) {
    ll ret = 0;
    for(ll i = 1; i <= N; i++) {
        ll j = x - i;
        ret += g(j);
    }
    return ret;
}

ll f2(ll x) {
    if(1 <= x and x <= N) return 1;
    return 0;
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cin >> N >> K;
    ll ok = 0;
    ll ng = 3 * N + 1;
    while(abs(ok - ng) > 1) {
        ll mid = (ok + ng) / 2;
        if(f(mid) < K) ok = mid;
        else ng = mid;
    }
    ll sum = ok + 1;
    K -= f(ok);
    //cout << ok << " " << K << endl;
    for(ll a = 1; a <= N; a++) {
        if(K > h(sum - a)) {
            K -= h(sum - a);
            continue;
        }
        for(ll b = 1; b <= N; b++) {
            if(K > f2(sum - a - b)) {
                K -= f2(sum - a - b);
                continue;
            }
            ll c = sum - a - b;
            cout << a << " " << b << " " << c << endl;
            return 0;
        }
    }
    return 0;
}

#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <algorithm>
#include <utility>
#include <functional>
#include <set>
#include <map>
#include <queue>
#include <deque>
#include <bitset>
#include <math.h>
#include <random>
#include <chrono>
#include <assert.h>
using namespace std ;
using ll = long long ;
using ld = long double ;
template<class T> using V = vector<T> ;
template<class T> using VV = V<V<T>> ;
using pll = pair<ll,ll> ;
#define all(v) v.begin(),v.end()
ll mod = 1000000007 ;
long double pie = acos(-1) ;
ll INF = 1e18 ;

void yorn(bool a){if(a) cout << "Yes" << endl ; else cout << "No" << endl ;}
//void YorN(bool a){if(a) cout << "YES" << endl ; else cout << "NO" << endl ;}
ll gcd(long long a,long long b){if(b==0) return a ; return gcd(b,a%b) ;}
ll lcm(long long a,long long b){return a/gcd(a,b)*b ;}
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 fix_cout(){cout << fixed << setprecision(20) ;}
template<class T> void chmax(T &a,T b){if(a<b) a = b ;}
template<class T> void chmin(T &a,T b){if(a>b) a = b ;}

int main(){
    ll n,k ;
    cin >> n >> k ;
    auto f = [&](ll a){
        ll res = 0 ;
        if(a-3<0) return res ;
        res += (a-1)*(a-2)/2 ;
        if(a-3-n<0) return res ;
        res -= (a-1-n)*(a-2-n)/2*3 ;
        if(a-3-2*n<0) return res ;
        res += (a-1-2*n)*(a-2-2*n)/2*3 ;
        if(a-3-3*n<0) return res ;
        res -= (a-1-3*n)*(a-2-3*n)/2 ;
        return res ;
    } ;
    V<ll> three(3*n+1,0) ;
    for(int i=0;i<=3*n;i++) three[i] = f(i) ;
    for(int i=1;i<=3*n;i++) three[i] += three[i-1] ;
    auto g = [&](ll a){
        ll res = 0 ;
        if(a-2<0) return res ;
        res += (a-1) ;
        if(a-2-n<0) return res ;
        res -= (a-1-n)*2 ;
        if(a-2-2*n<0) return res ;
        res += (a-1-2*n) ;
        return res ;
    } ;
    ll l=0,r=3*n,mid ;
    while(l+1<r){
        mid = (l+r)/2 ;
        if(three[mid]>=k) r = mid ;
        else l = mid ;
    }
    ll sum = r ;
    k -= three[l] ;
    V<ll> two(2*n+2,0) ;
    for(int i=1;i<=n;i++) if(2<=sum-i&&sum-i<=2*n) two[sum-i] = g(sum-i) ;
    for(int i=2*n-1;i>=0;i--) two[i] += two[i+1] ;
    // for(auto i:two) cout << i << " " ; cout << endl ;
    // cout << "???" << endl ;
    l = max(1ll,sum-2*n)-1 ;
    r = min(n,sum-2) ;
    while(l+1<r){
        mid = (l+r)/2 ;
        // cout << l << " " << mid << " " << r  << " " << k << endl ;
        if(sum-mid<=2*n&&(sum-mid<2||two[sum-mid]>=k)) r = mid ;
        else l = mid ;
    }
    // cout << sum << " " << r << endl ;
    k -= two[sum-r+1] ;
    mid = max(1ll,sum-r-n)+k-1 ;
    cout << r << " " << mid << " " << sum-r-mid << endl ;
}


#pragma GCC optimize("Ofast")   //Comment optimisations for interactive problems (use endl)
#pragma GCC target("avx,avx2,fma")
#pragma GCC optimization ("unroll-loops")
#include<bits/stdc++.h>

using namespace std;

#define  fastio         ios:: sync_with_stdio(0);cin.tie(0);cout.tie(0);cout<<fixed;cout<<setprecision(10);
#define  randomINIT     mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());
#define  all(x)         (x).begin(),(x).end()
#define  mset(x,val)    memset(x,val,sizeof(x))
#define  endl           "\n"
#define  pb             push_back
#define  sym(s)         s="#"+s+"#";
#define  mp             make_pair
#define  s              second
#define  f              first
#define  dline          cerr<<"///REACHED///\n";
#define  debv(a)        for(auto it: a)cout<<it<<" ";cout<<endl;
#define  deb1(a)        cout<<a<<endl;
#define  deb2(a,b)      cout<<a<<" "<<b<<endl;
#define  deb3(a,b,c)    cout<<a<<" "<<b<<" "<<c<<endl;
#define  deb4(a,b,c,d)  cout<<a<<" "<<b<<" "<<c<<" "<<d<<endl;
#define  uniq(a)        a.resize(unique(a.begin(), a.end()) - a.begin());

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

const ll   MOD   =  1e+9+7;
const ll   INF   =  0x7f7f7f7f7f7f7f7f;
const int  INFi  =  0x7f7f7f7f;
const ll   N  =  3e+5+7;

vll adj[N];ll vis[N]={};
int dx8[]={0,1,1,1,0,-1,-1,-1}, dy8[]={1,1,0,-1,-1,-1,0,1};
int dx4[]={0,1,0,-1}, dy4[]={1,0,-1,0};

//<<-----Declare Variable Here------->>//
int t=1;
ll n,a[N];
vll v;
ll p[N],sz[N];
//<<-----Implement Functions Here---->>//
void make(){
    for(ll i = 1;i <= 2e5; i++)p[i] = i,sz[i] = 1;
}
ll find(ll x){
    return (p[x] == x)? x: p[x] = find(p[x]);
}

void merge(ll x, ll y){
    ll a = find(x);ll b = find(y);
    if(a != b){
        if(sz[a] >= sz[b])swap(a,b);
        p[a] = b;sz[b] += sz[a];
    }
    //else cycle.
}

//<<-----Start of Main--------------->>//
void MAIN(){
		cin>>n;ll ans = 0;make();set<ll>set1;
		for(ll i=1;i<=n;i++)cin>>a[i];
		for(ll i=1;i<=n;i++){
			merge(a[i],a[n-i+1]);set1.insert(a[i]);
		}
		// for(ll i=1;i<=n;i++)find(a[i]);
		for(ll i=1;i<=n;i++){
			if(vis[find(a[i])])continue;
			vis[find(a[i])] = 1;ans++;
		}
		cout<<set1.size()-ans<<endl;

}

int main(){
    fastio;randomINIT;

    //cin>>t;
    while(t--){
        MAIN();
    }

    #ifndef ONLINE_JUDGE
    cout<<"\nTime Elapsed: " << 1.0*clock() / CLOCKS_PER_SEC << " sec\n";
    #endif
}

#include<bits/stdc++.h>
using namespace std;
namespace IO
{
    const int buffer_size=1e5+5;
    char buf[buffer_size],*S,*T;
    bool flag_EOF;
    inline char read_char()
    {
        if(S==T)
            T=(S=buf)+fread(buf,1,buffer_size,stdin);
        return S!=T?*(S++):EOF;
    }
    inline int read_int()
    {
        int flag=1;
        char c=read_char();
        while(c<'0'||c>'9')
        {
            if(c==EOF)
            {
                flag_EOF=true;
                return 0;
            }
            flag=(c=='-'?-1:1);
            c=read_char();
        }
        int x=0;
        while(c>='0'&&c<='9')
        {
            x=x*10+(c^48);
            c=read_char();
        }
        return x*flag;
    }
    inline void read_string(char *s)
    {
        char x;
        do
        {
            x=read_char();
            if(x==EOF)
            {
                flag_EOF=true;
                return;
            }
        }while(x<'a'||x>'z');
        int len=0;
        while(x>='a'&&x<='z')
        {
            s[len++]=x;
            x=read_char();
        }
        s[len]='\0';
    }
    char fw[buffer_size];
    int pw;
    inline void flush()
    {
        fwrite(fw,1,pw,stdout);
        pw=0;
    }
    inline void write_char(char x)
    {
        if(pw==buffer_size)
            flush();
        fw[pw++]=x;
    }
    char st[13];
    int top;
    inline void write_int(int x)
    {
        if(!x)
        {
            write_char('0');
            return;
        }
        if(x<0)
        {
            write_char('-');
            x=-x;
        }
        while(x)
        {
            st[++top]=x%10+'0';
            x/=10;
        }
        while(top>0)
            write_char(st[top--]);
    }
    inline void write_string(const char *s)
    {
        for(int i=0;s[i];++i)
            write_char(s[i]);
    }
    inline void write_double(double x,int cnt_digits,bool mark=true)
	{
		if(x<0)
		{
			write_char('-');
			x=-x;
		}
		if(mark)
		{
			double eps=0.1;
			for(int i=1;i<=cnt_digits;++i)
				eps*=0.1;
			x+=5*eps;
		}
		write_int(int(x));
		write_char('.');
		for(int i=1;i<=cnt_digits;++i)
		{
			x-=int(x);
			x*=10;
			write_char(int(x)+'0');
		}
	}
}
const int max_N=49+5;
int X[max_N];
const int prime[15]={2,3,5,7,11,13,17,19,23,29,31,37,41,43,47};
long long Gcd(long long a,long long b)
{
	return b?Gcd(b,a%b):a;
}
int main()
{
	int N;
	scanf("%d",&N);
	for(int i=1;i<=N;++i)
		scanf("%d",X+i);
	long long ans=7e17;
	for(int s=0;s<(1<<15);++s)
	{
		long long now=1;
		for(int i=0;i<15;++i)
			now*=((s>>i)&1)?prime[i]:1;
		bool flag=true;
		for(int i=1;i<=N;++i)
		{
			if(Gcd(now,X[i])==1)
			{
				flag=false;
				break;
			}
		}
		if(flag)
			ans=min(ans,now);
	}
	printf("%lld\n",ans);
	IO::flush();
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(n);++i)
#define ALL(v) begin(v),end(v)
template<typename A, typename B> inline bool chmax(A &a, B b) { if (a<b) { a=b; return 1; } return 0; }
template<typename A, typename B> inline bool chmin(A &a, B b) { if (a>b) { a=b; return 1; } return 0; }
#define TO_STRING(VariableName) # VariableName
#define debug(x) cerr<<TO_STRING(x)<<" : "<<x<<" "<<endl;
void debugs() { cerr << endl; }
template <class T, class... Args>
void debugs(const T& x, const Args &... args) {
		cerr << x << " ";
		debugs(args...);
}
template<class A, class B>
ostream& operator<<(ostream& ost, const pair<A, B>& p) {
		ost << "{ " << p.first << ", " << p.second << " }";
	return ost;
}
template<class T>
ostream& operator<<(ostream& ost, const vector<T>& v) {
	ost << "{ ";
	for (int i = 0; i < v.size(); i++) {
		if (i)ost << ", ";
		ost << v[i];
	}
	ost << " }";
	return ost;
}
template<class A, class B>
ostream& operator<<(ostream& ost, const map<A, B>& v) {
	ost << "{ ";
	for (auto p : v) {
		ost << "{ " << p.first << ", " << p.second << " }";
	}
	ost << " }";
	return ost;
}
using ll = long long;
using pii = pair<int, int>;
constexpr ll INF = 1ll<<30;
constexpr ll longINF = 1ll<<60;
constexpr ll MOD = 1000000007;
constexpr bool debug = 0;
//---------------------------------//

int main() {
	string s;
	cin >> s;
	vector<ll> cnt(26);
	char p_c = s.back();
	cnt[p_c-'a']++;
	ll ans = 0;
	for (ll i = s.length()-2; i >= 0; i--){
		char c = s[i];
		cnt[c-'a']++;
		if (p_c == c){
			ans+=(s.length()-i) - cnt[c-'a'];
			rep(j, 26) cnt[j] = 0;
			cnt[c-'a'] = s.length()-i;
		}
		p_c = c;
	}
	cout << ans << endl;
	return 0;
}

#pragma comment(linker, "/STACK:1024000000,1024000000")
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <ctime>
#include <algorithm>
#include <iostream>
#include <vector>
#include <string>
#include <map>
#include <set>
#include <queue>

using namespace std;
typedef long long LL;
typedef pair<int, int> PII;
#define PB push_back
#define fi first
#define se second
#define MP make_pair
const int P = 1000000007;
const int V = 200100;
char s[V];
int a[30];
int main() {
    while (~scanf("%s", s)) {
        int n = strlen(s);
        memset(a, 0, sizeof(a));
        int last = -1;
        LL ans = 0;
        for (int i = n - 1; i >= 0; --i) {
            a[s[i] - 'a']++;
            if (i != n - 1 && s[i + 1] == s[i]) {
                if (last == -1) {
                    ans += n - i - a[s[i] -'a'];
                } else if (s[last] == s[i]) {
                    ans += last - i - a[s[i] - 'a'];
                } else {
                    ans += n - i - a[s[i] - 'a'];
                }
                last = i;
                for (int j = 0; j < 26; ++j) a[j] = 0;
            }
        }
        printf("%lld\n", ans);
    }
    return 0;
}

/*
accept
atcoder
anerroroccurred
*/


#include <bits/stdc++.h>

using namespace std;

#define IOS             ios::sync_with_stdio(false); cin.tie(0);

void solve()
{
    int n; cin >> n;
    vector<int> a(n);
    for (int i = 0; i < n; ++i) cin >> a[i];
    int max_gcd = 1;
    int max_count = 0;
    for (int gcd = 1000; gcd > 1; --gcd) {
        int count = 0;
        for (int i = 0; i < n; ++i) {
            if (a[i] % gcd == 0) ++count;
        }
        if (max_count < count) {
            max_count = count;
            max_gcd = gcd;
        }
    }
    cout << max_gcd << "\n";
}

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

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

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

signed main(void)
{
	int n;
	int ans, out, tmp, g, g_tmp;

	cin >> n;
	vector<int> a(n);
	rep(i, n) cin>>a[i];
	sort(a.begin(), a.end());
	ans = 0;
	out = 1;
	for (int i = 0; i < n - 1; i++)
	{
		tmp = 1;
		g = a[i];
		for (int j = i + 1; j < n; j++)
		{
			g_tmp = gcd(g, a[j]);
			if (g_tmp == 1)
				continue;
			g = g_tmp;
			tmp++;
		}
		if (tmp > ans)
		{
			out = g;
			ans = tmp;
		}
	}
	cout << (out == 1 ? a[0] : out )<< endl;
	return 0;
}


#pragma GCC optimize(2)
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<vector>
#include<cmath>
#include<queue>
#include<set>
#include<map>
#include<bitset>
#include<climits>
using namespace std;
//#define int long long
typedef long long ll;
//template<typename T = int>
inline int read(){
    int f = 1,r = 0;
    char c = getchar();
    while(c<'0'||c>'9'){if(c == '-') f = -1; c = getchar();}
    while(c>='0'&&c<='9'){ r = (r<<1) + (r<<3) + c - '0';c = getchar();}
    return f*r;
}
typedef pair<ll,int> PII;
#define fi first
#define se second
#define mst(a,b) memset(a,b,sizeof(a))
#define For(i,a,b) for(int i = a;i<=b;i++)
#define For_(i,a,b) for(int i = a;i>=b;i--)
#define _for(i,a) for(int i = 0;i<a;i++)
#define All(x) x.begin(),x.end()

const int N = 18 ,M = 4e6,INF = 0x3f3f3f3f;

int n,m,t;
int a[(1<<N)+1],g[N+1][N+1],dp[(1<<N) + 1];

signed main(){
    n = read();m = read();
    For(i,1,m){
        int x = read(),y = read();
        g[x][y] = g[y][x] = 1;
    }
    For(S,0,(1<<n)-1){//枚举全部集合
        bool ok = 1;
        For(i,1,n){//判断集合是不是一个完全联通图（把集合中的边完全遍历一遍）都有，是就储存
            if(!(S & (1<<(i-1)))) continue;
            For(j,1,n){
                if(i == j) continue;
                if(!(S & (1<<(j-1)))) continue;
                if(g[i][j] == 0){
                    ok = 0;
                    break;
                }
            }
            if(!ok) break;
        }
        a[S] = ok;
    }
    mst(dp,0x3f);
    dp[0] = 0;
    For(S,1,(1<<n)-1){
        for(int sub = S;sub;sub =(sub-1)&S){
            if(a[sub]) dp[S] = min(dp[S],dp[S ^ sub] + 1);
        }
    }
    cout<<dp[(1<<n)-1]<<"\n";
    return 0;
}

#include <bits/stdc++.h>
using namespace std;
using vi = vector <int>;using vl = vector <long long>;
using vs = vector <string>;using vc = vector <char>;
using ll= long long;using vvl = vector<vector<ll> >;
using vvc = vector<vector<char> >;using vd = vector <double>;
using vpl = vector <pair<ll,ll> >;using vb = vector<bool>;
#define rep(i,r) for(ll i=0;i<(r);i++)
#define Rep(i,l,r) for(ll i=(l);i<(r);i++)
#define print(n) cout<<n<<endl
#define vcin(a) rep(i,a.size())cin>>a[i]
#define sortp(d) sort(d.begin(),d.end()) //1234
#define sortm(d) sort(d.rbegin(),d.rend()) //4321
#define all(n) n.begin(),n.end()
 //各位の和
int wa(ll x){ll sum = 0;while(x!=0){sum += x% 10;x /= 10;}return sum;}
/*-----------順列生成-----------------
do {
} while (next_permutation(配列変数.begin(), 配列変数.end()));*/
//最大公約数　ユークリッドの互除法
ll gcd(ll a, ll b) {if (b==0) return a;else return gcd(b, a%b);}
//最小公倍数　a*b/gcd
ll lcm(ll a, ll b){return a/gcd(a, b)*b;}
//コンビネーション nCk
ll C(ll n,ll k){ll p=1;rep(i,k)p=p*(n-i)/(i+1);return p;}
//'A'65,'a'97
/*小数点精度指定
cout<<fixed<<setprecision(9)<<;
*/
//priority_queue 優先度付きキュー
ll modpow(ll a,ll n,ll mod) {ll res=1;while(n>0)
{if(n&1)res=res*a%mod;a=a*a%mod;n >>= 1;}return res;}
ll modinv(ll a,ll mod){return modpow(a, mod - 2, mod);}

ll p=0,q=0,r=0;
int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
#define inf 1000000000000 //10^12:∞
#define mod 1000000007 //10^9+7:合同式の法
const long double pi = acos(-1);

int main()
{
  ll n,m;cin>>n>>m;
  print((modpow(10,n,m*m)/m)%m);
}


#include<bits/stdc++.h>
using namespace std;
#define fs first
#define sc second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define ALL(A) A.begin(),A.end()
#define RALL(A) A.rbegin(),A.rend()
typedef long long ll;
typedef pair<ll,ll> P;
const ll mod=1000000007;
const ll LINF=1LL<<60;
const int INF=1<<30;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
map<ll,ll> prime_factor(ll n){
	map<ll,ll> res;
	for(ll i = 2; i * i  <= n; i++) {
		while(n % i == 0){
			res[i]++;
			n /= i;
		}
	}
	if (n != 1){
		res[n] = 1;
	}
	return res;
}
int main(){
	int n;cin>>n;
	ll x = 1;
	map<ll,ll> ans;
	for(ll i = 2; i <= n; i++) {
		map<ll,ll> tmp = prime_factor(i);
		for(auto e:tmp) {
			if(ans[e.fs] < e.sc){
				ans[e.fs] = e.sc;
			}
		}
	}
	for(auto e:ans) {
		for(int i = 0; i < e.sc; i++) {
			x *= e.fs;
		}
	}
	for(int i = 2; i <= n; i++) {
		if((x + 1) % i == 1){
			continue;
		}
		else{
			cout << "no" << endl;
		}
	}
	cout << x + 1 << endl;
	return 0;
}

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

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

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

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

//My tools
#define fastio ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define rep(i,s,e)  for(int i=s;i<e;i++)
#define repe(i,s,e) for(int i=s;i<=e;i++)
#define all(v)  (v).begin(),(v).end()

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


//Iamskk//
#include <iostream>
#include <iosfwd>
#include <iomanip>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <ctime>
#include <cmath>
#include <cassert>
#include <cctype>
#include <climits>
#include <vector>
#include <bitset>
#include <set>
#include <queue>
#include <stack>
#include <map>
#include <deque>
#include <string>
#include <list>
#include <iterator>
#include <sstream>
#include <complex>
#include <fstream>
#include <functional>
#include <numeric>
#include <utility>
#include <algorithm>
#include <assert.h>
#include <unordered_map>
using namespace std;
#define IOS ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(0);
#define endl '\n'
#define yes cout<<"YES"<<endl
#define no cout<<"NO"<<endl
#define pb push_back
#define all(c) (c).begin(),(c).end()
#define rall(c) (c).rbegin(),(c).rend()
#define ai(arr,n) for(int i=0;i<n;i++)cin>>arr[i];
#define ao(arr) for(auto asdfasdfasdf:arr) cout<<asdfasdfasdf<<" ";
#define mi(arr,m,n) for(int i=0;i<m;i++){ for(int j=0;j<n;j++) cin>>arr[i][j];}
#define mo(arr,m,n) for(int i=0;i<m;i++){ for(int j=0;j<n;j++) cout<<arr[i][j]<<" "; cout<<endl;}
#define countsetbits(x) __builtin_popcount(x)
#define ll long long
#define debug cout<<"I AM EXECUTING"<<endl
#define testcases int asdf; cin>>asdf; while(asdf--)
#define vi vector<int>
#define vll vector<long long int>
#define vppo(prs) for(auto x:prs){cout<<x.first<<" "<<x.second<<endl;}
#define For(__,hajmola,adfdf) for(int __ = hajmola; __<adfdf;__++)
#define formax 1e18
#define formin -1e18
string sconvert(ll int n)
{
	stringstream ss;
	ss<<n;
	string str = ss.str();
	return str;
}
bool sortbysec(const pair<int,int> &a,
              const pair<int,int> &b)
{
    return (a.second > b.second);
}

template<typename T>
void imax(T &x,T y){
	x = max(x,y);
}
template<typename T>
void imin(T &x,T y){
	x = min(x,y);
}

void  single()
{
	int n;
	cin>>n;
	int m;
	cin>>m;
	vector<string> mat(n+1);
	for(int i=0;i<n;i++){
		cin>>mat[i];
	}
	int finalanswer=0;
	For(i,0,n-1){
		For(j,0,m-1){
			int count=0;
            if(mat[i+1][j+1]==mat[i][j]){
            	count++;
            }
            if(mat[i+1][j]==mat[i][j]){
            	count++;
            }
            if(mat[i][j+1]==mat[i][j]){
            	count++;
            }
            if(count==0 or count==2){
            	finalanswer++;
            }

		}
	}
	cout<<finalanswer<<endl;
	return;
}
void multiple()
{
	testcases
    {
		single();
	}
}

int main()
{
  IOS;
 // freopen("input.txt","r",stdin);
  //freopen("output.txt","w",stdout);
  single();
}

#include <bits/stdc++.h>
#define rep(i, l, r) for (int i = (l); i < (r); i++)
#define max(p, q) ((p) > (q) ? (p) : (q))
#define min(p, q) ((p) < (q) ? (p) : (q))
#define INF ((1LL << 62) - (1LL << 31))
#define MOD 1000000007
using namespace std;
using ll = long long;
int main(void)
{
    std::cin.tie(0);
    std::ios::sync_with_stdio(false);
    int vx[8] = {1, 1, 0, -1, -1, -1, 0, 1};
    int vy[8] = {0, 1, 1, 1, 0, -1, -1, -1};
    int h, w;
    cin >> h >> w;
    char s[h][w];
    pair<int, int> a;
    rep(i, 0, h)
    {
        rep(j, 0, w)
        {
            char tmp;
            cin >> tmp;
            if (tmp == '#' || tmp == '.')
            {
                s[i][j] = tmp;
            }
        }
    }
    ll ans=0;
    rep(i,0,h){
        rep(j,0,w){
            ll tmp=0;
            if(s[i][j]=='#')tmp++;
            if(s[i][j+1]=='#')tmp++;
            if(s[i+1][j]=='#')tmp++;
            if(s[i+1][j+1]=='#')tmp++;

            if(tmp%2==1){
                ans++;
            }
        }
    }
    cout << ans << endl;
    return 0;
}


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

int main() {
  int N,M,P;
  cin >> N >> M;
  P=N+M;
  vector<int> A(P);
  for (int i=0;i<P;i++) {
    cin >> A.at(i);
  }
  sort(A.begin(),A.end());
  for (int i=0;i<P;i++) {
     if (i==0) {
       int a,b;
       a=A.at(0);
       b=A.at(1);
       if (a!=b) {
         cout << A.at(0) << " ";
       }
     }
    else if ((i>0)&&(i<P-1)) {
      int a,b,c;
      a=A.at(i-1);
      b=A.at(i);
      c=A.at(i+1);
      if ((a!=b)&&(b!=c)) {
        cout << A.at(i) << " ";
      }
    }
    else if (i==P-1) {
      int b,c;
      b=A.at(P-2);
      c=A.at(P-1);
      if (b!=c) {
        cout << A.at(P-1) << " ";
      }
    }
  }
}

///********************** Bismillahir Rahmanir Rahim *****************///
#include<bits/stdc++.h>
using namespace std;

///*********************** Template Start Here ***********************///
///************************ C o n t a i n e r ************************///
typedef long long ll;
typedef unsigned long long ull;
typedef vector<ll> vl;
typedef vector<int> vi;
typedef vector<char> vc;
typedef vector<string> vs;
typedef vector<int>::iterator vit;
typedef set<int> si;
typedef set<string> ss;
typedef set<int>::iterator sit;
typedef map<int, int> mii;
typedef map<string, int> msi;
typedef map<int, string> mis;
typedef map<string, string> mss;
typedef pair<ll, ll> pll;
typedef pair<int,int> pii;
typedef pair<double, double> pdd;
typedef double dl;

///**************************** M a r c o ****************************///
#define f first
#define s second
#define endl '\n'
#define sp <<" "<<
#define pb push_back
#define MP make_pair
#define MOD 1000000007
#define sqr(a) ((a) * (a))
#define sz(x) (int)x.size()
#define mid(l,r) ((l+r)/2)
#define fora(a) for(auto u:a)
#define gcd(a,b) __gcd(a,b)
#define lcm(a,b) (a*(b/gcd(a,b)))
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define mem(a,b) memset(a, b, sizeof(a))
#define test int tc; cin>>tc; while(tc--)
#define forn(i,n) for(auto i=0; i<n; i++)
#define rforn(i,n) for(auto i=n-1; i>=0; i--)
#define abid() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define fori(a,b,c) {for(a = c.begin(); a!=b; a++) cout<< *a<< " "; cout<<endl;}

int main()
{
    abid();

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

    vi v(n),v1(m),ans(n+m);

    forn(i,n) cin>>v[i];
    forn(i,m) cin>>v1[i];
    vit st,it;
    it = set_symmetric_difference(all(v), all(v1), ans.begin());

    fori(st,it,ans);

    return 0;
}


#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> ii;
typedef vector<ii> vii;
typedef long double ld;
#define FOR(i, a, b) for(int i = a; i < b; i++)
#define ROF(i, a, b) for(int i = a; i >= b; i--)
#define ms memset
#define pb push_back
#define F first
#define S second
ll MOD = 1000000007;

ll power(ll base, ll n){
	if (n == 0) return 1;
	if (n == 1) return base;
	ll halfn = power(base, n/2);
	if (n % 2 == 0) return (halfn * halfn) % MOD;
	return (((halfn * halfn) % MOD) * base) % MOD;
}

ll inverse(ll n){
	return power(n, MOD-2);
}

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

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

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

int main(){
	ios::sync_with_stdio(false);
	int n; cin >> n;
	string s; cin >> s;
	vi a(n+1); FOR(i, 0, n+1) cin >> a[i];
	int mini = abs(a[1] - a[0]);
	FOR(i, 1, n+1){
		mini = min(mini, abs(a[i]-a[i-1]));
	}
	cout << mini << '\n';
	FOR(i, 0, mini){
		FOR(j, 0, n+1){
			if (a[j] % mini > i) cout << a[j]/mini + 1 << " ";
			else cout << a[j]/mini << " ";
		}
		cout << '\n';
	}
	return 0;
}

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

#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
//All indexing is 0-based
template<class key, class cmp = std::less<key>>
using oset = tree<key, null_type, cmp, rb_tree_tag, tree_order_statistics_node_update>;
//methods: find_by_order(k); & order_of_key(k);
//To make it an ordered_multiset, use pairs of (value, time_of_insertion)
//to distinguish values which are similar
template<class key, class value, class cmp = std::less<key>>
using omap = tree<key, value, cmp, rb_tree_tag, tree_order_statistics_node_update>;

#define ll long long
#define ull unsigned long long
#define lld long double
#define w(x) ll x;cin>>x;while(x--)
#define all(x) x.begin(), x.end()
#define iceil(n, x) (((n) + (x) - 1) / (x))
#define gcd(a,b)	__gcd(a,b)
#define lcm(a,b)	__detail::__lcm(a,b)
#define goog(tno) cout << "Case #" << tno <<": "
#define PRESS_F_TO_PAY_RESPECT ios_base::sync_with_stdio(false), cin.tie(nullptr)

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

ll dx[]= {-1,-1,-1,0,0,1,1,1};
ll dy[]= {-1,0,1,-1,1,-1,0,1};
const lld pi=3.1415926535897932384626433832795;
const ll INF=1e18;
const ll mod=1000000007;
const ll maxn=1e5+5;

template<typename T>
void printv(const vector<T>& v) { for(auto i:v) cout<<i<<' '; cout<<'\n'; }
template<typename T>
void printv(const vector<pair<T, T>>& v) { for(auto p:v) cout<<"("<<p.first<<","<<p.second<<"),"; cout<<'\n'; }

int main(){
	PRESS_F_TO_PAY_RESPECT;
	//freopen("input.txt","r",stdin);
	//freopen("output.txt","w",stdout);
	ll pos,neg;	cin>>pos>>neg;
	vector<ll> p,n;
	for(ll i=0;i<neg;i++){
		// cout<<-1*pos<<" ";
		n.push_back(-1*pos);
	}
	for(ll i=0;i<pos;i++){
		// cout<<neg<<" ";
		p.push_back(neg);
	}
	vector<ll> v;
	ll cnt=0;
	for(ll i=0;i<p.size();i++){
		v.push_back(p[i]+cnt);
		cnt++;
	}
	cnt=0;
	for(ll i=0;i<n.size();i++){
		v.push_back(n[i]-cnt);
		cnt++;
	}
	bug(v);
	ll s=accumulate(all(v),0LL);
	bug(s);
	if(s>0)	v.back()-=s;
	else v.front()-=s;
	bug(v);
	s=accumulate(all(v),0LL);
	bug(s);
	printv(v);
	return 0;
}


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

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

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

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

pair<int,int> a[200002]={};
ll b[200002]={};

string s="",ss="";

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

int main()
{
    cin.tie(0);
    cin.sync_with_stdio(0);
    //freopen("rect.in","r",stdin);
    //freopen("output.txt","w",stdout);
    int t=1;
    //cin>>t;
    while(t--)
    {
       cin>>n;
       rep(i,0,1ll<<n)cin>>a[i].x,a[i].y=i;
       n=(1ll<<n);
       n/=2;
       sort(a,a+n);
       sort(a+n,a+n+n);
       if(a[n-1].x<a[n+n-1].x)cout<<a[n-1].y+1;
       else cout<<a[n+n-1].y+1;
    }
    return 0;
}

#include <bits/stdc++.h>

using namespace std;
typedef long long ll;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
#define MOD 1000000007

int main() {
    int n, x;
    cin >> n >> x;
    // vector<int> v(n), p(n);
    int sum = 0;
    rep(i, n) {
        int v, p;
        cin >> v >> p;
        sum += v * p;
        if (x * 100 < sum) {
            cout << i + 1 << endl;
            return 0;
        }
    }
    cout << -1 << endl;
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define pb push_back
typedef long long ll;
const int maxn=2e5+5;
struct node{
    int l,r,x;
}p[maxn];
ll a[maxn*2];
int b[maxn*2];
map<int,int>pos;

int main(){
    int n,c;
    scanf("%d%d",&n,&c);
    int cnt=0;
    for(int i=1;i<=n;i++){
        int l,r,x;
        scanf("%d%d%d",&p[i].l,&p[i].r,&p[i].x);
        b[++cnt]=p[i].l;
        b[++cnt]=p[i].r+1;
    }
    sort(b+1,b+1+cnt);
    cnt= unique(b+1,b+1+cnt)-b-1;
    for(int i=1;i<=cnt;i++){
        pos[b[i]]=i;
    }
    for(int i=1;i<=n;i++){
        a[pos[p[i].l]]+=p[i].x;
        a[pos[p[i].r+1]]-=p[i].x;
    }
    b[cnt+1]=b[cnt]+1;

    ll ans=0;
    for(int i=1;i<=cnt;i++){
        a[i]+=a[i-1];
        ans+=(b[i+1]-b[i])*min(a[i],1ll*c);
    }
    printf("%lld\n",ans);

    return 0;
}

#include <iostream>
#include <vector>
#include <algorithm>

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

int main() {
	int n;
	long long t;
	std::cin >> n >> t;
	std::vector<long long> a(n);
	for (auto &e : a) std::cin >> e;

	int n1 = (n >> 1), n2 = n - n1;
	long long time = 0;
	std::vector<long long> times(1 << n1, 0);
	for (int s = 1; s < (1 << n1); s++) {
		const int tmp = (s ^ (s >> 1));
		const int i = __builtin_ctz(s);
		if (tmp >> i & 1) time += a[i];
		else time -= a[i];
		times[s] = time;
	}

	time = 0;
	std::sort(times.begin(), times.end());
	times.erase(std::unique(times.begin(), times.end()), times.end());
	long long ans = *std::prev(std::upper_bound(times.begin(), times.end(), t));
	for (int s = 1; s < (1 << n2); s++) {
		const int tmp = (s ^ (s >> 1));
		const int i = __builtin_ctz(s);
		if (tmp >> i & 1) time += a[n1 + i];
		else time -= a[n1 + i];
		if (time <= t) {
			chmax(ans, time + *std::prev(std::upper_bound(times.begin(), times.end(), t - time)));
		}
	}

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


#include <iostream>
#include <vector>
#include <array>
#include <cmath>
#include <string>
#include <algorithm>
#include <functional>
#include <map>
#include <tuple>
#include <queue>
#include <bitset>
#define rep(i,n) for(int i = 0;i < (n);i++)
using namespace std;
using ll = long long int;
int cnt = 0;
using Graph = vector<vector<int>>;

vector<bool> seen;  // 探索したか記録
void dfs(const Graph &G, int v) {
    seen[v] = true;
    for (auto e : G[v]) {
        if (seen[e]) continue;  // 訪問済みでなければ探索

        dfs(G, e);

    }
    cnt++;
}

int main(){
    int n,m;cin>>n>>m;
    Graph G(n);
    rep(i,m){
        int a,b;cin>>a>>b;
        a--;b--;
        G[a].push_back(b);
    }
      // 初期化

    rep(i,n) {
        seen.assign(n, false);
        if (!seen[i]) {
            dfs(G, i);

        }
    }
    cout << cnt << endl;
    return 0;
}

//#include <atcoder/all>
//using namespace atcoder;
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define REP(i, n) for(int i=0; i<n; i++)
#define REPR(i, n) for(int i=n-1; i>=0; i--)
#define FOR(i, m, n) for(int i=m; i<n; i++)
#define ALL(v) v.begin(), v.end()
#define bit(n) (1LL<<(n))
#define FIX(d) fixed << setprecision(d)
using P = pair<int, int>;
using LP = pair<ll, ll>;
using vvi = vector<vector<int>>;
using vvl = vector<vector<ll>>;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const int INF = 1e9;
const ll LINF = (1LL<<60);

struct edge
{
  int to;
  int cost;

  edge(int a, int b){
    to = a;
    cost = b;
  }
};
using Graph = vector<vector<edge>>;

vector<ll> dijkstra(int s, const Graph &G)
{
  int n = G.size();
  priority_queue<P, vector<P>, greater<P>> que;
  vector<ll> d(n, INF);
  d[s] = 0;
  que.emplace(0, s);

  while (!que.empty()){
    P p = que.top();
    que.pop();
    int v = p.second;
    if (d[v] < p.first) continue;

    for(auto nv: G[v]){
      if (d[nv.to] > d[v] + nv.cost){
        d[nv.to] = d[v] + nv.cost;
        que.emplace(d[nv.to], nv.to);
      }
    }
  }
  return d;
}

int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  int r,c; cin >> r >> c;
  vvi a(r, vector<int>(c-1)), b(r-1, vector<int>(c));
  REP(i,r) REP(j,c-1) cin >> a[i][j];
  REP(i,r-1) REP(j,c) cin >> b[i][j];

  Graph G(r*c);
  REP(i,r) REP(j,c){
    // r,c -> r,c+1
    if(j<c-1) G[i*c+j].push_back(edge(i*c+(j+1), a[i][j]));

    // r,c -> r,c-1
    if(j>0) G[i*c+j].push_back(edge(i*c+(j-1), a[i][j-1]));

    // r,c -> r+1,c
    if(i<r-1) G[i*c+j].push_back(edge((i+1)*c+j, b[i][j]));

    // r,c -> r-k,c
    REP(k,i) G[i*c+j].push_back(edge((i-k-1)*c+j, k+2));
  }

  auto dist = dijkstra(0, G);
  cout << dist[r*c-1] << endl;
  return 0;
}


#define _CRT_SECURE_NO_WARNINGS
#include<bits/stdc++.h>
#include<unordered_map>
using namespace std;
#define ll long long
#define sz(s) (int)s.size()
#define vi vector<int>
#define ii pair<int,int>
#define vii vector<ii>
const int MOD = 1e9 + 7;
const double pi = acos(-1);
const double EPS = 1e-9;
ll binpowmod(ll a, ll b)
{
	a %= MOD;
	ll ret = 1;
	while (b)
	{
		if (b & 1)
			ret = ret * a % MOD;
		a = a * a % MOD;
		b >>= 1;
	}
	return ret % MOD;
}
int gcd(int a, int b)
{
	if (!b)
		return a;
	return gcd(b, a % b);
}
const int N = 1 << 18;
const int E = N * 2;
#define neigh(u,v,e) for (int e = head[u], v; ~e && ((v = to[e]), 1); e = nxt[e])
#define foreach(it, x) for(auto it = x.begin(); it != x.end(); ++it)
vector <set<pair<int,ll>>> adj;
vector<int> subtreeSz;
vector<ll> OurAns,OurAns2;
vector<int> parent;
void calcSz(int u = 0, int p = -1)
{
	subtreeSz[u] = 1;
	for (auto i = adj[u].begin(); i != adj[u].end(); ++i)
	{
		int v = i->first;
		if (v != p)
		{
			calcSz(v, u);
			subtreeSz[u] += subtreeSz[v];
			parent[v] = u;
		}
	}
}
void calcAns(int u = 0)
{
	for (auto i = adj[u].begin(); i != adj[u].end(); ++i)
	{
		int v = i->first;
		ll w = i->second;
		if (v != parent[u])
		{
			calcAns(v);
			OurAns[u] += subtreeSz[v] * w + OurAns[v];
		}
	}
}
void calcAns2(int u = 0, int cnt = 0, ll weight = 0)
{
	OurAns2[u] = (parent[u] != -1 ? OurAns2[parent[u]] : 0) + cnt * weight;
	for (auto i = adj[u].begin(); i != adj[u].end(); ++i)
	{
		int v = i->first;
		ll w = i->second;
		if (v != parent[u])
		{
			calcAns2(v, cnt + 1, w);
		}
	}
}
void solve()
{
	int n, m, x, y;
	cin >> n >> m >> x >> y;
	vector<string> v(n);
	for (int i = 0; i < n; ++i)
		cin >> v[i];
	x--; y--;
	int ans = 1;
	for (int i = x + 1; i < n; ++i)
	{
		if (v[i][y] == '#')
			break;
		ans++;
	}
	for (int i = x - 1; i >= 0; --i)
	{
		if (v[i][y] == '#')
			break;
		ans++;
	}
	for (int i = y + 1; i < m; ++i)
	{
		if (v[x][i] == '#')
			break;
		ans++;
	}
	for (int i = y - 1; i >= 0; --i)
	{
		if (v[x][i] == '#')
			break;
		ans++;
	}
	cout << ans << '\n';
}
int main(void)
{
#ifdef ONLINE_JUDGE
	//freopen("hamming.in", "r", stdin);
#endif
	//freopen("output.txt", "w", stdout);
	ios::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	int tc = 1;
	//cin >> tc;
	while (tc--)
	{
		solve();
	}
}

/*/ Author : Abhishek Chauhan /*/

#include<bits/stdc++.h>
#include "ext/pb_ds/assoc_container.hpp"
#include "ext/pb_ds/tree_policy.hpp"
using namespace std::chrono;
using namespace __gnu_pbds;
using namespace std;

// a+b = a^b + 2*(a&b)
// whenever using a comparator return true only if a<b

#define rep(i,n)             for(int i=0;i<n;i++)
#define int                  long long
#define pb                   push_back
#define mp                   make_pair
#define all(x)               x.begin(),x.end()
#define mod                  1000000007
#define umap                 unordered_map
#define trailzero(x)         __builtin_ctz(x)
#define bpop(x)              __builtin_popcountll((x))
#define fastio               ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define endl                 '\n'

template<class T>
using ordered_set = tree<T, null_type,less<T>, rb_tree_tag,tree_order_statistics_node_update> ;
// find_by_order(k)  returns iterator to kth element starting from 0;
// order_of_key(k) returns count of elements strictly smaller than k;

template<class T>
T power(T x, T y){T res = 1;while (y > 0){ if (y & 1){res = res*x;} y = y>>1;x = x*x;}return res;}
template<class T>
T powermod(T x, T y, T p){T res = 1;x = x % p;while (y > 0){if (y & 1){res = (res*x) % p;}y = y>>1; x = (x*x) % p;}return res;}

mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());
inline int64_t random_long(long long l,long long r){
    uniform_int_distribution<int64_t> generator(l,r);
    return generator(rng);
}
inline int64_t random_long(){
    uniform_int_distribution<int64_t> generator(LLONG_MIN,LLONG_MAX);
    return generator(rng);
}

const int mxn = 5e5+10;
int st[8*mxn];
int lazy[8*mxn];
int arr[mxn];
int merge(int a,int b){
   return min(a,b);
}
int query( int ss, int se, int qs, int qe, int si)
{
    if (qs <= ss && qe >= se)
        return st[si];
    if (se < qs || ss > qe)
        return 1e18;
    int mid = ss+(se-ss)/2;
    return merge(query( ss, mid, qs, qe, 2*si+1),query( mid+1, se, qs, qe, 2*si+2));
}
void build(int ss, int se,int si)
{
    if (ss == se){
        st[si] = arr[ss];
        return;
    }
    int mid = ss+(se-ss)/2;
    build(ss , mid, 2*si +1);
    build(mid+1, se,2*si +2);
    st[si]  = merge(st[2*si+1],st[2*si+2]);
}

void snow(){

   int n;
   cin>>n;
   rep(i,n){
    cin>>arr[i];
   }
   build(0,n-1,0);
   int ans = 0;
   for(int i=0;i<n;i++){
     int l = 0;
     int r = i-1;
     int left = i;
     while(l<=r){
       int mid = (l+r)/2;
       int f = query(0,n-1,mid,i-1,0);
       if(f<arr[i]){
         l = mid+1;
       }
       else{
         left = mid;
         r = mid-1;
       }
     }
     l = i+1;
     r = n-1;
     int right = i;
     while(l<=r){
       int mid = (l+r)/2;
       int f = query(0,n-1,i+1,mid,0);
       if(f<arr[i]){
         r = mid-1;
       }
       else{
         l = mid+1;
         right = mid;
       }
     }
     ans = max(ans,(right-left+1)*arr[i]);
   }
   cout<<ans<<endl;

}

int32_t main()
{
    #ifndef ONLINE_JUDGE
    freopen("input.txt","r",stdin);
    freopen("output.txt","w",stdout);
    #endif
    auto start = high_resolution_clock::now();
    fastio;
    int _;
    _=1;
    // cin>>_;
    for(int i=1;i<=_;i++){
     // cout<<"Case #"<<i<<": ";
        snow();
    }
    auto stop = high_resolution_clock::now();
    auto duration = duration_cast<microseconds>(stop - start);
    #ifndef ONLINE_JUDGE
     cerr << "Time: " << duration.count()/1000.0 << endl;
    #endif
    return 0;
}


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

const int MX = 2000005;
vector<vector<int>> g(MX);
vector<int> a;
int ans = 0;
vector<bool> used(MX , false);

void dfs(int v , int &depth) {
  if (used[v]) {
    return;
  }
  used[v] = true;
  for (int v2 : g[v]) {
    if (!used[v2]) {
      depth++;
      dfs(v2 , depth);
    }
  }
  return;
}

int main() {
  int n;
  cin >> n;
  a = vector<int>(n);
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  for (int i = 0; i < n / 2; i++) {
    g[a[i]].push_back(a[n - 1 - i]);
    g[a[n - 1 - i]].push_back(a[i]);
  }

  for (int i = 0; i < n / 2; i++) {
    int depth = 0;
    dfs(a[i] , depth);
    ans += depth;
  }
  cout << ans << endl;
  return 0;
}

#include <bits/stdc++.h>
#define all(a) a.begin(), a.end()
#define put(i) cout << i << endl
#define rep(i, s, n) for (long long i = s; i < (long long)(n); i++)
using namespace std;
using ll = long long;

ll n;
vector<ll> a;

struct UnionFind {
    vector<int> r;

    UnionFind(int N) { r = vector<int>(N + 1, -1); }

    int root(int x) {
        if (r[x] < 0) return x;
        return r[x] = root(r[x]);
    }

    bool unite(int x, int y) {
        x = root(x);
        y = root(y);
        if (x == y) return false;
        if (r[x] > r[y]) swap(x, y);
        r[x] += r[y];
        r[y] = x;
        return true;
    }

    int size(int x) { return -r[root(x)]; }
};

int main() {
    cin >> n;
    a = vector<ll>(n);
    rep(i, 0, n) cin >> a[i];

    UnionFind UF(*max_element(all(a)));

    ll ans = 0;

    rep(i, 0, n / 2) { UF.unite(a[i], a[n - 1 - i]); }

    set<ll> st, st2;
    for (auto x : a) st.insert(x);

    rep(i, 0, n) { st2.insert(UF.root(a[i])); }

    put(st.size() - st2.size());
}


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

typedef long long ll;

int main(){

    ll N, X;

    cin >> N >> X;

    vector<int> V(N);
    vector<int> P(N);
    int flag = 0;
    ll now = 0;

    ll total = 0;

    for(ll i = 0; i < N; i++){
        cin >> V.at(i) >> P.at(i);
    }

    for(ll i = 0; i < N; i++){
        total += V.at(i) * P.at(i);
        if(total > X*100){
            flag = 1;
            now = i+1;
            break;
        }
    }

    if(flag == 1){
        cout << now << endl;
    }else{
        cout << "-1" << endl;
    }
}

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

#pragma GCC target ("avx2")
#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")
#pragma comment(linker, "/stack:200000000")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
//turn on extra precision
//#pragma GCC target("fpmath=387")

using namespace std;
using namespace __gnu_pbds;

typedef long long ll;
typedef string str;
typedef pair <int,int> pii;
typedef pair <ll,ll> pll;
typedef vector <int> vi;
typedef vector <ll> vll;
typedef vector <pii> vpii;
typedef vector <pll> vpll;

#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
#define ordered_multiset tree<int, null_type,less_equal<int>, rb_tree_tag,tree_order_statistics_node_update>
#define mp make_pair
#define pb push_back
#define pob pop_back
#define pf push_front
#define pof pop_front
#define fi first
#define se second
#define fs first.second
#define ss second.second
#define ff first.first
#define sf second.first
#define newl '\n'
#define fbo find_by_order
#define ook order_of_key
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(),x.rend()
#define watch(x) cout << (#x) << " is : " << (x) << newl

mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());
vi dirx = {0,0,1,-1};
vi diry = {1,-1,0,0};
char to_upper (char x){
    if( 97 <= int(x) && int(x) <= 122) return char(x-32);
    if( 65 <= int(x) && int(x) <= 90) return x;
    return -1;
}
char to_lower (char x){
    if( 97 <= int(x) && int(x) <= 122) return x;
    if( 65 <= int(x) && int(x) <= 90) return char(x+32);
    return -1;
}
int numerize (char x){
    if(48 <= int(x) && int(x) <= 57) return int(x-'0');
    if(97 <= int(x) && int(x) <= 122) return int(x-96);
    if(65 <= int(x) && int(x) <= 90) return int(x-64);
    return -1;
}
bool isect (int l1, int r1, int l2, int r2){ return max(l1,l2) <= min(r1,r2); }
ll quickpow (ll num1, ll num2, ll MOD){
    if(num2==0)return 1%MOD;
    else if(num2==1)return num1%MOD;
    else{
        ll temp = quickpow (num1,num2>>1LL,MOD); ll res = ((temp%MOD) * (temp%MOD))%MOD;
        if(num2&1) res = ((res%MOD)*(num1%MOD))%MOD; return res;
    }
}
ll invmod (ll num, ll MOD){return quickpow (num,MOD-2,MOD);}
ll gcd (ll num1, ll num2){
    if(num1 < num2) swap(num1,num2); ll num3 = num1 % num2 ;
    while(num3 > 0){ num1 = num2; num2 = num3; num3 = num1 % num2;}
    return num2;
}
ll lcm (ll num1 , ll num2){return (ll) (num1/__gcd(num1,num2))*num2;}
// end of Template
ll n,x,p[3000];
int main(){

//    freopen("input.txt", "r", stdin);
//    freopen("output.txt", "w", stdout);

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

    cin >> n >> x; x *= 100;
    for(int i = 1; i <= n; ++i){
        int  a,b; cin >> a >> b;
        p[i] = a * b;
    }

    int res = 0;
    int ans = INT_MAX;
    for(int i = 1; i <= n; ++i){
        res += p[i];
        if(res > x) ans = min(ans,i);
    }
    if(ans == INT_MAX) ans = -1;
    cout << ans << newl;

    return 0;
}


#include<bits/stdc++.h>
using namespace std;
int n,a[1001],t[1001];
int main()
{
	scanf("%d",&n);
	for(int i=1;i<=n;i++){
		scanf("%d",&a[i]);
		t[a[i]]++;
	}
	for(int i=1;i<=n;i++){
		if(t[i]!=1){
			puts("No");
			return 0;
		}
	}
	puts("Yes");
	return 0;
}

#include<bits/stdc++.h>
using namespace std;
#define fs first
#define sc second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define ALL(A) A.begin(),A.end()
#define RALL(A) A.rbegin(),A.rend()
typedef long long ll;
typedef pair<ll,ll> P;
const ll mod=1000000007;
const ll LINF=1LL<<60;
const int INF=1<<30;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

int main(){
	int t;cin>>t;
	for(int i = 0; i < t; i++) {
		int n;cin>>n;
		map<ll,ll> dict;
		for(int i = 0; i < n; i++) {
			ll tmp;cin>>tmp;
			dict[tmp]++;
		}
		if(n % 2 == 1){
			cout << "Second" << endl;
			continue;
		}
		else{
			bool flag = true;
			for(auto e:dict) {
				if(e.sc % 2 == 1){
					cout << "First" << endl;
					flag = false;
					break;
				}
			}
			if(flag)cout << "Second" << endl;
		}
	}
	return 0;
}


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

int main() {
  int N;
  cin >> N;
  if ( N%2 == 1 ) {
    cout << "Black" << endl;
  }
  else {
    cout << "White" << endl;
  }
}

#include <bits/stdc++.h>
#define ll long long
#define vi vector<int>
#define vl vector<long long>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep_lr(i, f, n) for (int i = f; i < (int)(n); i++)
#define sum(v) accumulate(arr.begin(),arr.end(),0)
#define sumll(v) accumulate(arr.begin(),arr.end(),0LL)
#define maxe(v) *max_element(v.begin(),v.end())
#define mine(v) *min_element(v.begin(),v.end())
#define sorts(v) sort(v.begin(),v.end())
#define sortg(v) sort(v.begin(),v.end(),greater<int>)
using namespace std;

string replace_all(string &s, string from, string to) {
    ll pos = s.find(from);
    while(true){
        pos = s.find(from, pos);
        if(pos==-1) break;
        s.replace(pos, from.length(), to);
        pos += to.length();
    }
    return s;
}

int combination(int n, int r) {
    if(r < n) return 0;
    if(r*2 > n) r = n-r;
    int nume = 1;
    int deno = 1;
    rep_lr(i, 1, r+1) {
        nume *= (n-i+1);
        deno *= i;
    }
    return nume / deno;
}

int ceil(int nume, int deno){
    return (nume+deno-1)/deno;
}

template<typename T>
void vinp(int n, T v){
    rep(i,n){
        cin >> v.at(i);
    }
}

void solve(){
    int N;
    cin >> N;
    cout << (N%2==0?"White":"Black") << endl;
}

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