#include <bits/stdc++.h>
using namespace std;
// #define LOCAL // 提出時はコメントアウト
#define DEBUG_

typedef long long ll;
const double EPS = 1e-9;
const ll INF = ((1LL<<62)-(1LL<<31));
typedef vector<ll> vecl;
typedef pair<ll, ll> pairl;
template<typename T> using uset = unordered_set<T>;
template<typename T, typename U> using mapv = map<T,vector<U>>;
template<typename T, typename U> using umap = unordered_map<T,U>;

#define ALL(v) v.begin(), v.end()
#define REP(i, x, n) for(int i = x; i < n; i++)
#define rep(i, n) REP(i, 0, n)
#define sz(x) (ll)x.size()
ll llceil(ll a,ll b) { return (a+b-1)/b; }
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; }
template<class T> vector<vector<T>> genarr(ll n, ll m, T init) { return vector<vector<T>>(n,vector<T>(m,init)); }

///// DEBUG
#define DUMPOUT cerr
#define repi(itr, ds) for (auto itr = ds.begin(); itr != ds.end(); itr++)
template<typename T>istream&operator>>(istream&is,vector<T>&vec){for(T&x:vec)is>>x;return is;}
template<typename T,typename U>ostream&operator<<(ostream&os,pair<T,U>&pair_var){os<<"("<<pair_var.first<<", "<<pair_var.second<<")";return os;}
template<typename T>ostream&operator<<(ostream&os,const vector<T>&vec){os<<"{";for(int i=0;i<vec.size();i++){os<<vec[i]<<(i+1==vec.size()?"":", ");}
os<<"}";return os;}
template<typename T,typename U>ostream&operator<<(ostream&os,map<T,U>&map_var){os<<"{";repi(itr,map_var){os<<*itr;itr++;if(itr!=map_var.end())os<<", ";itr--;}
os<<"}";return os;}
template<typename T>ostream&operator<<(ostream&os,set<T>&set_var){os<<"{";repi(itr,set_var){os<<*itr;itr++;if(itr!=set_var.end())os<<", ";itr--;}
os<<"}";return os;}
void dump_func(){DUMPOUT<<endl;}
template<class Head,class...Tail>void dump_func(Head&&head,Tail&&...tail){DUMPOUT<<head;if(sizeof...(Tail)>0){DUMPOUT<<", ";}
dump_func(std::move(tail)...);}
#ifndef LOCAL
#undef DEBUG_
#endif
#ifdef DEBUG_
#define DEB
#define dump(...)                                                          \
DUMPOUT << "  " << string(#__VA_ARGS__) << ": "                            \
        << "[" << to_string(__LINE__) << ":" << __FUNCTION__ << "]"        \
        << endl                                                            \
        << "    ",                                                         \
    dump_func(__VA_ARGS__)
#else
#define DEB if (false)
#define dump(...)
#endif

//////////

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

int solve(ostringstream &cout) {
    #ifdef LOCAL
    ifstream in("../../Atcoder/input.txt");
    cin.rdbuf(in.rdbuf());
    #endif

    ll T;
    cin>>T;

    rep(q,T) {
        ll x;
        cin>>x;
        ll r = x % 4;
        if (r == 1 || r == 3) cout << "Odd" << endl;
        else if (r == 2) cout << "Same" << endl;
        else cout << "Even" << endl;
    }

    return 0;
}

int main() {
    ostringstream oss;
    int res = solve(oss);

    cout << oss.str();
    return res;
}

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
#define IOS ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).begin(), (x).end()
#define fp(a,i,c) for(int (a) = (i); (a) < (c); (a)++)
#define fpp(a,i,c) for(ll (a) = (i); (a) <= (c); (a)++)
#define fv(c) for(int (a) = (1); (a) <= (c); (a)++)
#define fz(c) for(int (a) = (0); (a) < (c); (a)++)
#define fm(a,i,c) for(int (a) = (i); (a) > (c); (a)--)
#define fmm(a,i,c) for(int (a) = (i); (a) >= (c); (a)--)
#define pb push_back
#define in insert
#define ss second
#define ff first
void check(ll n)
{
	ll x = 2, ans = 1, ann = 0;
	while(n % 2 == 0)
		n/=2, ann ++;
	for(ll i = 3; i*i <= n; i += 2)
	{
		if(n % x == 0)
			ans *= (x+1);
		while(n % x == 0)
		{
			n /= x;
		}
	}
	ans *= 2;
	//cout << ans << " " << ann << "\n";
	if(ans - ann == ann)
	{
		cout << "Same\n";
		return;
	}
	if(ans - ann > ann)
	{
		cout << "Odd\n";
		return;
	}
	cout << "Even\n";
	return;
}
void S()
{
	ll n;
	cin >> n;
	check(n);
}
int main()
{
	IOS;
	int t;
	cin >> t;
	while(t--)
		 S();
}


#include <bits/stdc++.h>

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

using namespace std;

const LL MOD=1e9+7;

int n,m,dist[2010][2010],dx[4]={1,-1,0,0},dy[4]={0,0,1,-1};
string s[2010];
deque <pair <int,pii> > q;
vector <pii> v[30];

bool out(int x,int y)
{
	return x<0||x>=n||y<0||y>=m;
}

int main()
{
	cin>>n>>m;
	rep(i,n) cin>>s[i];
	int sx,sy,tx,ty;
	rep(i,n)
	{
		rep(j,m)
		{
			if(s[i][j]=='S') sx=i,sy=j;
			if(s[i][j]=='G') tx=i,ty=j;
			if(islower(s[i][j])) v[s[i][j]-'a'].pb(mpr(i,j));
		}
	}
	rep(i,n+5) rep(j,2005) dist[i][j]=1e9;
	dist[sx][sy]=0;
	q.pb(mpr(0,mpr(sx,sy)));
	while(!q.empty())
	{
		pair <int,pii> f=q.front();
		q.pop_front();
		if(dist[f.se.fi][f.se.se]<f.fi) continue;
		if(f.se.fi==tx&&f.se.se==ty) break;//cout<<f.se.fi<<' '<<f.se.se<<endl;
		if(f.se.fi==n)
		{
			rep(i,v[f.se.se].size())
			{
				pii nxt=v[f.se.se][i];
				if(dist[nxt.fi][nxt.se]<=f.fi) continue;
				dist[nxt.fi][nxt.se]=f.fi;
				//cout<<nxt.se<<'p'<<endl;
				q.push_front(mpr(f.fi,mpr(nxt.fi,nxt.se)));
			}
			continue;
		}//cout<<f.se.fi<<' '<<f.se.se<<endl;
		rep(i,4)
		{
			int x=f.se.fi+dx[i],y=f.se.se+dy[i];
			if(out(x,y)||s[x][y]=='#'||dist[x][y]<=f.fi+1) continue;
			dist[x][y]=f.fi+1;
			q.pb(mpr(f.fi+1,mpr(x,y)));
		}
		if(islower(s[f.se.fi][f.se.se]))
		{
			if(dist[n][s[f.se.fi][f.se.se]-'a']>f.fi+1)
			{
				dist[n][s[f.se.fi][f.se.se]-'a']=f.fi+1;
				q.pb(mpr(f.fi+1,mpr(n,s[f.se.fi][f.se.se]-'a')));
			}
		}
		//cout<<f.se.fi<<' '<<f.se.se<<' '<<q.size()<<endl;
	}
	if(dist[tx][ty]==1e9) puts("-1");
	else cout<<dist[tx][ty]<<endl;
	return 0;
}

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

int main()
{
    int t;
    // cin >> t;
    t = 1;
    while (t--)
    {
        int n, m;
        cin >> n >> m;
        char arr[n + 1][m + 1];
        vector<vector<int>> vis(n + 1, vector<int>(m + 1, 0));
        unordered_map<char, vector<pair<int, int>>> map;
        int startx = 1, starty = 1;
        for (int i = 1; i <= n; i++)
        {
            for (int j = 1; j <= m; j++)
            {
                cin >> arr[i][j];
                if (arr[i][j] != '.' && arr[i][j] != '#')
                {
                    map[arr[i][j]].push_back({i, j});
                }
                if (arr[i][j] == 'S')
                {
                    startx = i;
                    starty = j;
                }
            }
        }
        int dr[] = {0, 0, 1, -1};
        int dc[] = {1, -1, 0, 0};
        queue<pair<int, int>> q;
        int level = 0;
        q.push({startx, starty});
        vis[startx][starty] = -1;
        bool flag = false;
        while (q.size() != 0)
        {
            int size = q.size();
            // cout << "size " << size << endl;
            for (int i = 0; i < size; i++)
            {
                pair<int, int> p = q.front();
                q.pop();
                int currx = p.first;
                int curry = p.second;
                char ch = arr[currx][curry];
                //  cout << currx << " " << curry << " " << ch << "level is " << level << endl;
                if (ch == 'G')
                {
                    flag = true;
                    break;
                }
                for (int j = 0; j < 4; j++)
                {
                    int x = currx + dr[j];
                    int y = curry + dc[j];
                    // cout << "inside dr dc " << x << " " << y << endl;
                    if (x > n || x < 1 || y < 1 || y > m || arr[x][y] == '#')
                        continue;
                    if (vis[x][y] != -1)
                    {
                        //   cout << "here" << endl;
                        vis[x][y] = -1;
                        q.push({x, y});
                    }
                }
                // cout << q.size() << endl;
                for (int j = 0; j < map[ch].size(); j++)
                {
                    // cout << "inside map " << endl;
                    int tempx = map[ch][j].first;
                    int tempy = map[ch][j].second;
                    if (vis[tempx][tempy] != -1)
                    {
                        vis[tempx][tempy] = -1;
                        q.push({tempx, tempy});
                    }
                }
                map.erase(ch);
                // cout << "end of map  " << endl;
            }
            //cout << "size heere is " << q.size() << endl;
            if (flag)
                break;
            level++;
        }
        if (flag)
        {
            cout << level << endl;
        }
        else
        {
            cout << -1 << endl;
        }
    }
    return 0;
}


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

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	string s;
	cin>>s;
	s = '#' + s;
	ll ans = 0;
	int n = s.length();
	cnt[s[n-1]-'a']++;
	ll total = 1;

	for(int i=n-2; i>=1; i--){
		cnt[s[i]-'a']++;
		total++;

		if(s[i]==s[i+1]){
			ans+=(total - cnt[s[i]-'a']);
			memset(cnt,0,sizeof(cnt));
			cnt[s[i]-'a'] = total;
		}
	}
	cout<<ans;
}

#include<bits/stdc++.h>
using namespace std;
#define SZ(v) ((int)(v).size())
#define zero(v) memset(v,0,sizeof(v))
#define rep(i,n) for(int i=0;i<(n);i++)
#define foreach(it,c) for(__typeof(c.begin()) it=c.begin();it!=c.end();it++)
#define all(v) (v).begin(),(v).end()
template<typename T>inline bool chkmin(T &a,const T &b){return a>b?a=b,1:0;}
template<typename T>inline bool chkmax(T &a,const T &b){return a<b?a=b,1:0;}
typedef long long ll;
typedef unsigned uint;
const int INF=0x3f3f3f3f;
const double EPS=1e-10;
typedef pair<int,int> pii;
int inline in(){int x=0,c;for(;(uint)((c=getchar())-'0')>=10;)
{if(c=='-')return -in();if(!~c)throw ~0;}do{x=(x<<3)+(x<<1)+(c-'0');}
while((uint)((c=getchar())-'0')<10);return x;}

ll n;

int main(){
	scanf("%lld",&n);
	vector<ll>ans;
	for(ll i=1;i*i<=n;i++){
		if(n%i==0){
			if(i*i==n){
				ans.push_back(i);
			}else{
				ans.push_back(i);
				ans.push_back(n/i);
			}
		}
	}
	sort(all(ans));
	rep(i,SZ(ans))printf("%lld\n",ans[i]);
	return 0;
}


#include <algorithm>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <cassert>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <vector>

#define For(i, l, r) for (i = int64(l); i <= int64(r); i++)
#define Fo(i, n) For(i, 1, n)
#define Rof(i, r, l) for (i = int64(r); i >= int64(l); i--)
#define Ro(i, n) Rof(i, n, 1)
#define clr(a) memset(a, 0, sizeof(a))
#define cpy(a, b) memcpy(a, b, sizeof(b))
#define fc(a, ch) memset(a, ch, sizeof(a))

typedef long long int64;

#define T1 template <class A>
#define T2 template <class A, class B>
#define T3 template <class A, class B, class C>
#define T4 template <class A, class B, class C, class D>
inline void read(char &x)
{
    do
        x = getchar();
    while (x <= ' ');
}
inline void read(char *s)
{
    char ch;

    do
        ch = getchar();
    while (ch <= ' ');
    while (ch > ' ')
    {
        (*s) = ch;
        s++;
        ch = getchar();
    }
    (*s) = 0;
}
inline void read(std::string &s)
{
    char ch;

    do
        ch = getchar();
    while (ch <= ' ');
    while (ch > ' ')
    {
        s.push_back(ch);
        ch = getchar();
    }
}
T1 inline void readint(A &x)
{
    bool neg = false;
    char ch;

    do
        ch = getchar();
    while (ch <= ' ');
    if (ch == '-')
    {
        neg = true;
        ch = getchar();
    }
    x = 0;
    while (ch > ' ')
    {
        x = x * 10 + (ch & 15);
        ch = getchar();
    }
    if (neg)
        x = -x;
}
inline void read(int &x) { readint(x); }
inline void read(int64 &x) { readint(x); }

T2 inline void read(A &a, B &b)
{
    read(a);
    read(b);
}
T3 inline void read(A &a, B &b, C &c)
{
    read(a);
    read(b);
    read(c);
}
T4 inline void read(A &a, B &b, C &c, D &d)
{
    read(a);
    read(b);
    read(c);
    read(d);
}
inline void writeln() { putchar('\n'); }
T1 inline void write(A x)
{
    static char buf[20];
    int top = 0;

    if (!x)
    {
        putchar('0');
        return;
    }
    if (x < 0)
    {
        putchar('-');
        x = -x;
    }
    while (x)
    {
        buf[++top] = (x % 10) | 48;
        x /= 10;
    }
    while (top)
        putchar(buf[top--]);
}
T1 inline void write_(A x)
{
    write(x);
    putchar(' ');
}
T1 inline void writeln(A x)
{
    write(x);
    putchar('\n');
}
T2 inline void write(A a, B b)
{
    write_(a);
    write(b);
}
T2 inline void writeln(A a, B b)
{
    write_(a);
    writeln(b);
}
T3 inline void writeln(A a, B b, C c)
{
    write_(a);
    write_(b);
    writeln(c);
}
T4 inline void writeln(A a, B b, C c, D d)
{
    write_(a);
    write_(b);
    write_(c);
    writeln(d);
}
#undef T1
#undef T2
#undef T3
#undef T4

const int P[] = {2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71};
const int PN = sizeof(P) >> 2;
const int full = (1 << PN) - 1;

int64 a, b;
int64 f[1 << PN | 5];

int main() {
	int64 i, ans;
	int j, x;

	read(a, b);

	f[0] = 1;
	For(i, a, b) {
		x = 0;
		For(j, 0, PN - 1)
			if(i % P[j] == 0)
				x |= 1 << j;
		Rof(j, full, 0)
			if(!(j & x))
				f[j | x] += f[j];
	}

	ans = 0;
	For(j, 0, full)
		ans += f[j];
	writeln(ans);
	return 0;
}

#include <bits/stdc++.h>
#define fast ios::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define ll long long int
#define ld long double
using namespace std;

ll mod = 1000000007;

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

  if (n == 1)
  {
    cout << 0 << endl;
    return;
  }

  cout << n - 1 << endl;

}

int main()
{

// #ifndef ONLINE_JUDGE

//   freopen("inputs.txt", "r", stdin);

//   freopen("outputs.txt", "w", stdout);
// #endif
  fast;
  ll t, n, a, b, c, e, f, g, temp, m;
// cin >> t;

  t = 1;

  for (int i = 0; i < t; i++)
    solve();

  return 0;
}


#include <bits/stdc++.h>
using Int = long long;  // clang-format off
#define REP_(i, a_, b_, a, b, ...) for (Int i = (a), lim##i = (b); i < lim##i; i++)
#define REP(i, ...) REP_(i, __VA_ARGS__, __VA_ARGS__, 0, __VA_ARGS__)
#define RREP_(i, a_, b_, a, b, ...) for (Int i = Int(b) - 1, low##i = (a); i >= low##i; i--)
#define RREP(i, ...) RREP_(i, __VA_ARGS__, __VA_ARGS__, 0, __VA_ARGS__)
#define ALL(v) std::begin(v), std::end(v)
struct SetupIO { SetupIO() { std::cin.tie(nullptr), std::ios::sync_with_stdio(false), std::cout << std::fixed << std::setprecision(13); } } setup_io;
#ifndef dump
#define dump(...)
#endif  // clang-format on
struct in {
    template <class T> operator T() {
        T t;
        std::cin >> t;
        return t;
    }
};
void out() { std::cout << "\n"; }
template <class Head, class... Tail> void out(Head&& h, Tail&&... t) {
    std::cout << h << (sizeof...(Tail) == 0 ? "" : " "), out(std::forward<Tail>(t)...);
}
template <class T> bool chmin(T& a, const T& b) { return a > b ? a = b, true : false; }
template <class T> bool chmax(T& a, const T& b) { return a < b ? a = b, true : false; }
template <class T> using V = std::vector<T>;

/**
 *    author:  knshnb
 *    created: Sat Dec  5 21:06:29 JST 2020
 **/

std::string t = "110";
signed main() {
    Int n = in();
    std::string s = in();
    Int ans = 0;
    REP(offset, 3) {
        bool ok = true;
        REP(i, n) {
            if (s[i] != t[(i + offset) % 3]) ok = false;
        }
        if (!ok) continue;
        ans += (Int)1e10 - (n + offset - 1) / 3;
    }
    out(ans);
}


#include <bits/stdc++.h>
typedef long long LL;
#define SZ(X) ((int)(X).size())
#define ALL(X) (X).begin(), (X).end()
#define RALL(X) (X).rbegin(), (X).rend()
#define REP(I, N) for (int I = 0; I < (N); ++I)
#define REPP(I, A, B) for (int I = (A); I < (B); ++I)
#define RI(X) scanf("%d", &(X))
#define RII(X, Y) scanf("%d%d", &(X), &(Y))
#define RIII(X, Y, Z) scanf("%d%d%d", &(X), &(Y), &(Z))
#define DRI(X) int (X); scanf("%d", &X)
#define DRII(X, Y) int X, Y; scanf("%d%d", &X, &Y)
#define DRIII(X, Y, Z) int X, Y, Z; scanf("%d%d%d", &X, &Y, &Z)
#define DRVI(N, X) VI X(N); for (int ___I=0; ___I<n; ___I++) scanf("%d", &(X[___I]))
#define RS(X) scanf("%s", (X))
#define CASET int ___T, case_n = 1; scanf("%d ", &___T); while (___T-- > 0)
#define MP make_pair
#define PB push_back
#define MS0(X) memset((X), 0, sizeof((X)))
#define MS1(X) memset((X), -1, sizeof((X)))
#define LEN(X) strlen(X)
#define PII pair<int,int>
#define VI vector<int>
#define VL vector<long long>
#define VPII vector<pair<int,int> >
#define PLL pair<long long,long long>
#define VPLL vector<pair<long long,long long> >
#define F first
#define S second

using namespace std;

int main(){
    DRI(n);
    DRI(g);
    REP(i,n-1){
        DRI(x);
        g=__gcd(x,g);
    }
    printf("%d\n",g);
}

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

ll gcd(ll x, ll y){
	if(x%y == 0){
		return y;
	}else{
		return gcd(y, x%y);
	}
}

int main(){
	int N; cin >> N;
	int ans;
	for(int i=0; i<N; i++){
		int a; cin >> a;
		if(i==0){
			ans = a;
		}else{
			ans = gcd(ans, a);
		}
	}
	cout << ans << endl;
	return 0;
}


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

#define ll long long int
#define f(i,l,n) for(int i=l;i<n;i++)
#define E "\n"
#define fast ios::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define F first
#define S second
#define all(c) (c).begin(),(c).end()
#define sz(v) (int)(v).size()
#define vi(typ) vector<typ>
#define ld long double

int main()
{

      #ifndef ONLINE_JUDGE
      freopen("input.txt","r",stdin);
      freopen("output.txt","w",stdout);
        #endif
      ll n,x;
      cin >> n >> x;
      f(i,0,n)
      {
          ll t;
          cin >> t;
          if(t!=x) cout<<t<<" ";
      }

       return 0;
}

#include <iostream>
#include <algorithm>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <numeric>
#include <bitset>
#include <cmath>

static const int MOD = 1000000007;
using ll = long long;
using u32 = unsigned;
using u64 = unsigned long long;
using namespace std;

template<class T> constexpr T INF = ::numeric_limits<T>::max() / 32 * 15 + 208;

template <class T, class U>
vector<T> make_v(U size, const T& init){ return vector<T>(static_cast<size_t>(size), init); }

template<class... Ts, class U>
auto make_v(U size, Ts... rest) { return vector<decltype(make_v(rest...))>(static_cast<size_t>(size), make_v(rest...)); }

template<class T> void chmin(T &a, const T &b){ a = (a < b ? a : b); }
template<class T> void chmax(T &a, const T &b){ a = (a > b ? a : b); }

int main() {
    int n;
    cin >> n;
    for (int i = 0; i < n; ++i) {
        cout << (i*2+1)%n+1 << " " << (i*2)%n+1 << "\n";
    }
    return 0;
}


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

#pragma region library
const int MOD = 998244353;
struct mint {
    ll x;  // typedef long long ll;
    mint(ll x = 0) : x((x % MOD + MOD) % MOD) {}
    mint operator-() const { return mint(-x); }
    mint& operator+=(const mint a) {
        if ((x += a.x) >= MOD) x -= MOD;
        return *this;
    }
    mint& operator-=(const mint a) {
        if ((x += MOD - a.x) >= MOD) x -= MOD;
        return *this;
    }
    mint& operator*=(const mint a) {
        (x *= a.x) %= MOD;
        return *this;
    }
    mint operator+(const mint a) const {
        mint res(*this);
        return res += a;
    }
    mint operator-(const mint a) const {
        mint res(*this);
        return res -= a;
    }
    mint operator*(const mint a) const {
        mint res(*this);
        return res *= a;
    }
    mint pow(ll t) const {
        if (!t) return 1;
        mint a = pow(t >> 1);
        a *= a;
        if (t & 1) a *= *this;
        return a;
    }
    // for prime MOD
    mint inv() const {
        return pow(MOD - 2);
    }
    mint& operator/=(const mint a) {
        return (*this) *= a.inv();
    }
    mint operator/(const mint a) const {
        mint res(*this);
        return res /= a;
    }
    bool operator==(const mint a) const {
        return x == a.x;
    }
    bool operator!=(const mint a) const {
        return x != a.x;
    }
    friend ostream& operator<<(ostream& os, const mint& value) {
        os << value.x;
        return os;
    }
    friend istream& operator>>(istream& is, mint& value) {
        ll t;
        is >> t;
        value = mint(t);
        return is;
    }
};

#pragma endregion library

int main() {
    int n, k;
    cin >> n >> k;
    vector<vector<mint>> dp(n + 1, vector<mint>(n + 1));
    vector<vector<mint>> pdp(n + 2, vector<mint>(n + 2));
    dp[k][k] = 1;
    rep(j, k + 1) {
        pdp[k][j] = 1;
    }
    repi(i, k + 1, n + 1) rrep(j, n + 1) {
        if (j % 2) {
            dp[i][j] = 0;
        } else {
            int pi = i - j / 2, pj = j / 2;
            if (pi >= 0)
                dp[i][j] += pdp[pi][pj];
        }
        pdp[i][j] += pdp[i][j + 1] + dp[i][j];
    }
    mint ans = 0;
    rep(i, n + 1) {
        ans += dp[n][i];
    }
    cout << ans << '\n';
}


#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using Graph = vector<vector<int>>;
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define rrep(i, n) for (int i = 1; i < (int)(n+1); ++i)
const long long INF = 1LL<<60;
const int MAX = 510000;
const long long MOD = 998244353;
const long long mod = 998244353;
#pragma GCC target("arch=skylake-avx512")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
int ri() {
	int n;
	scanf("%d", &n);
	return n;
}
typedef vector<vector<int>> Matrix;
Matrix d;
//d = Matrix(10, vector<int>(10, INF));
void warshall_floyd(int n) {            // nは頂点数
    for (int i = 0; i < n; i++)         // 経由する頂点
        for (int j = 0; j < n; j++)     // 開始頂点
            for (int k = 0; k < n; k++) // 終端
                d[j][k] = min(d[j][k], d[j][i] + d[i][k]);
}
template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
int main() {
    int N=ri();
    double a,b,c,d;
    cin>>a>>b>>c>>d;
    complex<double>ans,an;
    ans={a,b};
    an={c,d};
    auto ann=(ans+an)/2.0;
    auto anss=ann+(ans-ann)*polar(1.0,M_PI*2.0/N);
    cout<<setprecision(40)<<anss.real()<<" "<<anss.imag()<<endl;
}

// D - Opposite
#include <bits/stdc++.h>
using namespace std;
using C = complex<double>;
C in(){ double r,i; cin>>r>>i; return C(r,i); }

int main(){
	int n; cin>>n;
	C p0 = in(), ph = in();
	C o = (p0 + ph) / 2.0;
	double PI = acos(-1), t = PI*2/n;
	C r(cos(t), sin(t));
	C ans = (p0 - o)*r + o;
	cout<<setprecision(11)<<fixed;
	cout<< ans.real() <<" "<< ans.imag() <<endl;
}


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

int main() {
  string s;
  cin >> s;
  cout << s.at(1) << s.at(2) << s.at(0) << endl;
}

/*
このコード、と～おれ!
Be accepted!
∧＿∧
（｡･ω･｡)つ━☆・*。
⊂　　 ノ 　　　・゜+.
　しーＪ　　　°。+ *´¨)
 　　　　　　　　　.· ´¸.·*´¨) ¸.·*¨)
		  　　　　　　　　　　(¸.·´ (¸.·'* ☆
*/

#include <cstdio>
#include <algorithm>
#include <string>
#include <cmath>
#include <cstring>
#include <vector>
#include <numeric>
#include <iostream>
#include <random>
#include <map>
#include <unordered_map>
#include <queue>
#include <regex>
#include <functional>
#include <complex>
#include <list>
#include <cassert>
#include <iomanip>
#include <set>
#include <stack>
#include <bitset>

////多倍長整数, cpp_intで宣言
//#include <boost/multiprecision/cpp_int.hpp>
//using namespace boost::multiprecision;

//#pragma GCC target ("avx2")
//#pragma GCC optimization ("Ofast")
//#pragma GCC optimization ("unroll-loops")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#define repeat(i, n, m) for(int i = n; i < (m); ++i)
#define rep(i, n) for(int i = 0; i < (n); ++i)
#define printynl(a) printf(a ? "yes\n" : "no\n")
#define printyn(a) printf(a ? "Yes\n" : "No\n")
#define printYN(a) printf(a ? "YES\n" : "NO\n")
#define printim(a) printf(a ? "possible\n" : "imposible\n")
#define printdb(a) printf("%.50lf\n", a) //少数出力
#define printLdb(a) printf("%.50Lf\n", a) //少数出力
#define printdbd(a) printf("%.16lf\n", a) //少数出力(桁少なめ)
#define prints(s) printf("%s\n", s.c_str()) //string出力
#define all(x) (x).begin(), (x).end()
#define deg_to_rad(deg) (((deg)/360.0L)*2.0L*PI)
#define rad_to_deg(rad) (((rad)/2.0L/PI)*360.0L)
#define Please return
#define AC 0
#define manhattan_dist(a, b, c, d) (abs(a - c) + abs(b - d)) /*(a, b) から (c, d) のマンハッタン距離 */
#define inf numeric_limits<double>::infinity();
#define linf numeric_limits<long double>::infinity()

using ll = long long;
using ull = unsigned long long;

constexpr int INF = 1073741823;
constexpr int MINF = -1073741823;
constexpr ll LINF = ll(4661686018427387903);
constexpr ll MOD = 1e9 + 7;
constexpr ll mod = 998244353;
constexpr long double eps = 1e-6;
const long double PI = acos(-1.0L);

using namespace std;

void scans(string& str) {
	char c;
	str = "";
	scanf("%c", &c);
	if (c == '\n')scanf("%c", &c);
	while (c != '\n' && c != -1 && c != ' ') {
		str += c;
		scanf("%c", &c);
	}
}

void scanc(char& str) {
	char c;
	scanf("%c", &c);
	if (c == -1)return;
	while (c == '\n') {
		scanf("%c", &c);
	}
	str = c;
}

double acot(double x) {
	return PI / 2 - atan(x);
}

ll LSB(ll n) { return (n & (-n)); }

template<typename T>
inline T chmin(T& a, const T& b) {
	if (a > b)a = b;
	return a;
}

template<typename T>
inline T chmax(T& a, const T& b) {
	if (a < b)a = b;
	return a;
}

/*-----------------------------------------ここから
コード-----------------------------------------*/

int main() {

	string s;
	scans(s);
	for(int i = 1; i < s.size(); ++i)printf("%c", s[i]);
	printf("%c\n", s[0]);

	Please AC;
}


#include<bits/stdc++.h>
#define ll long long
#define dbg(x) cout<<#x<<": "<<x<<endl;
#define N 300005
#define M 1000000007
#define pii pair<ll,ll>
#define fast ios_base::sync_with_stdio(0);cin.tie(0);
using namespace std;
main()
{
    string s;
    cin>>s;
    bool f=1;
    for(int i=0;i<s.size();i++)
    {
        if(i%2==0&&(s[i]>='A'&&s[i]<='Z')) f=0;
        if(i%2==1&&(s[i]>='a'&&s[i]<='z')) f=0;
    }
    if(f) cout<<"Yes";
    else cout<<"No";
}

/**
*	created: 08.11.2020 21:02:19
**/
#ifdef _LOCAL_
#define _GLIBCXX_DEBUG
#endif
#include <bits/stdc++.h>
// #include <boost/multiprecision/cpp_int.hpp>
// #include <boost/math/tools/minima.hpp>
// #include <boost/range/irange.hpp>
using namespace std;
#define int long long
#define name(x) #x
#define dump(x) cout << name(x) << " = " << x << endl;
#define rep(i,n) for (int i = 0; i < (int)(n); i++)
#define rrep(i,n) for (int i = (int)(n - 1); i >= 0; i--)
#define rep2(i,s,n) for (int i = (s); i < (int)(n); i++)
#define For(i,x) for (auto &i : x)
#define len(x) ll(x.size())
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define pcnt(bit) ll(__builtin_popcountll(bit))
#define gcd(a,b) __gcd(a,b)
#define lcm(a,b) a * b / __gcd(a,b)
// using boost::math::tools::brent_find_minima;
// using boost::irange;
using ll = long long;
using P = pair<int,int>;
// using bint = boost::multiprecision::cpp_int;
const long double pi = acos(-1.0);
const int MAX = 1000010;
const int INF = 9000000000000000000ll;
const int MOD1 = 1000000007;
const int MOD2 = 998244353;
template<typename T> bool chmax(T &a, T b) {if (a < b) {a = b; return 1;} return 0;}
template<typename T> bool chmin(T &a, T b) {if (b < a) {a = b; return 1;} return 0;}
template<typename T> T bpow(T a, int n) {T r(1); while(n) {if (n & 1) r *= a; a *= a; n >>= 1;} return r;}
template<typename T> auto comp(vector<T> a) {sort(all(a)); a.erase(unique(all(a)),a.end()); return a;}
template<typename T,typename U> ostream &operator<<(ostream &os, const pair<T,U> &p) {os << p.first << " " << p.second; return os;}
template<typename T,typename U> ostream &operator<<(ostream &os, const map<T,U> &mp) {For(p,mp) {os << "[" << p << "]\n";} return os;}
template<typename T> ostream &operator<<(ostream &os, const vector<T> &v) {rep(i,len(v)) {if(i) os << " "; os << v[i];} return os;}
template<typename T> ostream &operator<<(ostream &os, const set<T> &st) {int c(0); For(x,st) {if (c) os << " "; os << x; c++;} return os;}

void solve() {
    int n; cin >> n;
    vector<int> a(n);
    rep(i,n) cin >> a[i];
    vector<P> v;
    rep2(i,2,1001) {
        int c = 0;
        rep(j,n) if (a[j] % i == 0) c++;
        v.emplace_back(c,i);
    }
    sort(rall(v));
    cout << v[0].second << endl;
    return;
}

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


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

int h, w, a, b;
//vector<vector<vector<int>>>dp;

int calc(int x, int y, int rem_a, int rem_b, int mask){
     if(x==h && y==0) return mask==0 && rem_a==0 && rem_b==0;
     if(y==w) return calc(x+1, 0, rem_a, rem_b, mask);

     //if(x==h) cout << y << endl;
     int tmp;
     int res=0;

     if(mask & (1<<y)){
          tmp=mask;
          tmp ^= (1<<y);
          res=calc(x, y+1, rem_a, rem_b, tmp);
          return res;
     }

     if(rem_b){
          //1*1
          tmp=mask;
          res+=calc(x, y+1, rem_a, rem_b-1, tmp);
     }

     if(rem_a){
          //2*1
          tmp=mask;
          tmp |= (1<<y);
          res+=calc(x, y+1, rem_a-1, rem_b, tmp);

          //1*2
          if(y+1<w && (mask & (1<<(y+1)))==0){
               tmp=mask;
               res+=calc(x, y+2, rem_a-1, rem_b, tmp);
          }
     }

     //cout << "For "<< x << " "  << y << " " << rem_a << " " << rem_b << ": " << mask << " " << res << endl;
     return res;
}

int main(){
     int i, j, k;
     cin >> h >> w >> a >> b;
     //if(h<w) swap(h, w);
     //memset(dp, -1, sizeof dp);
     cout << calc(0, 0, a, b, 0) << endl;
}

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

#define all(x) (x).begin(),(x).end()
#define pb push_back
#define pf push_front
#define sz(x) (int)(x).size()
#define lb lower_bound
#define ub upper_bound
#define mp make_pair
#define fi first
#define se second
#define setbits(x) __builtin_popcount(x)
#define zerobits(x) __builtin_ctz(x)
#define setbitsll(x) __builtin_popcountll(x)
#define zerobitsll(x) __builtin_ctzll(x)
#define ps(x,y) fixed<<setprecision(y)<<x

typedef vector<int> vi;
typedef long long ll;
typedef vector<ll> vl;
typedef pair<int,int> pii;
typedef unsigned long long ull;
typedef long double ld;
typedef map<int,int> mii;

const int MOD = 1e9+7;
const ld PI = acos((ld)-1);
const int maxN = 2e5+1;

int dp[maxN][7],n;
string str,turn;

int go (int idx,int rem) {
	if (idx == n) {
		if (rem == 0) {
			return 1;
		} else {
			return 0;
		}
	}
	int& ret = dp[idx][rem];
	if (ret != -1) return ret;
	ret = 0;
	int nextRem1 = (rem*10+0)%7;
	int nextRem2 = (rem*10+str[idx]-'0')%7;
	if (turn[idx] == 'T') {
		ret = (go(idx+1,nextRem1) || go(idx+1,nextRem2));
	} else {
		ret = (go(idx+1,nextRem1) && go(idx+1,nextRem2));
	}
	return ret;

}

//dp[idx][rem]= Takahashi wins if we are at position "idx" with remainder "rem"
void solve () {
	memset(dp,-1,sizeof(dp));
	cin >> n;
	cin >> str >> turn;
	if (go(0,0)) {
		cout << "Takahashi\n";
	} else {
		cout << "Aoki\n";
	}
}

int main () {

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

	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	solve();
	return 0;
}


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

int main() {
    ll n, m;
    cin >> n >> m;

    map<ll, vl> mp;
    rep(i, m) {
        ll x, y;
        cin >> x >> y;
        mp[x].pb(y);
    }

    set<ll> st;
    st.insert(n);
    for(auto p : mp) {
        vl vec;
        for(ll y : p.second) {
            if(st.count(y-1) || st.count(y+1)) {
                vec.pb(y);
            }
        }
        for(ll y : p.second) {
            st.erase(y);
        }
        for(ll y : vec) {
            st.insert(y);
        }
    }

    out(st.size());
    re0;
}

//                        YATIN KWATRA

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#pragma GCC optimize ("Ofast")

#define ll                      long long
#define ar                      array
#define sz(v)                   (int)(v.size())
#define inf                     1e18
#define int                     ll
#define FIO                     ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define ld                      long double
#define ull                     unsigned long long
#define endl                    "\n"
#define fo(i,a,b)               for(int i = a; i<=b ; i++)
#define rfo(i,a,b)              for(int i = a; i>=b ; i--)
#define vii                     vector<int>
#define pq                      priority_queue
#define uomii                   unordered_map<int,int,best_hash>
#define all(v)                  v.begin(),v.end()
#define mp                      make_pair
#define pb                      push_back
#define pob                     pop_back
#define ff                      first
#define ss                      second
#define pii                     pair<int,int>
#define mii                     map<int,int>
#define vvii                    vector<vii>
#define mod                     1000000007
#define MIN                     -1e9
#define pi                      3.1415926535897932384626433832795
#define cz(x)                   63 - __builtin_clzll(x)

using namespace std;
using namespace __gnu_pbds;
template<class T> using oset =  tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

struct best_hash {
	static uint64_t splitmix64(uint64_t x) {

		x += 0x9e3779b97f4a7c15;
		x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
		x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
		return x ^ (x >> 31);
	}

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

void solve()
{
	int n;
	cin >> n;
	int cnt = 0;
	int ans = 0;
	while (((cnt * (cnt + 1)) / 2LL) < n) {
		++ans;
		++cnt;
	}
	cout << ans;
}

signed main() {

	FIO
	int t;
	t = 1;
	//cin >> t;
	fo(i, 0, t - 1) {
		solve();
	}
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
int N, L, A[100010], B[100010];
long long ans;
vector<int> E;
bool seen[100010], added[100010];
int main(){
	ios::sync_with_stdio(0);
	cin.tie(0); cout.tie(0);
	cin >> N >> L;
	A[0] = 0; B[0] = 0;
	A[N+1] = L+1; B[N+1] = L+1;
	for(int i = 1; i <= N; i++) cin >> A[i];
	for(int i = 1; i <= N; i++) cin >> B[i];
	for(int i = 0; i <= N+1; i++){
		if(A[i] == B[i]) E.push_back(i);
	}
	for(int e : E){
		seen[e] = true;
		int l = e; int r = e;
		for(int i = e+1; i <= L+1; i++){
			if(A[i] <= B[i]) break;
			r = i; seen[i] = true;
		}
		for(int i = e-1; i >= 0; i--){
			if(A[i] >= B[i]) break;
			l = i; seen[i] = true;
		}
		int j = l;
		for(int i = l; i <= e; i++){
			while(A[j] - j + i != B[i]){
				j++;
				if(j > e){
					cout << -1 << "\n"; return 0;
				}
			}
			if(!added[j]) ans += j-i;
			added[j] = true;
		}
		for(int i = l; i <= e; i++) added[i] = false;
		j = r;
		for(int i = r; i >= e; i--){
			while(A[j] + i - j != B[i]){
				j--;
				if(j < e){
					cout << -1 << "\n"; return 0;
				}
			}
			if(!added[j]) ans += i-j;
			added[j] = true;
		}
		for(int i = r; i >= e; i--) added[i] = false;
	}
	for(int i = 0; i <= N+1; i++){
		if(!seen[i]){
			cout << -1 << "\n"; return 0;
		}
	}
	cout << ans << "\n";
}

#include <bits/stdc++.h>

using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
#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 REP(i, n) FOR(i, 0, (n)-1)
#define sqr(x) ((x) * (x))
#define all(x) (x).begin(), (x).end()
#define reset(x, y) memset(x, y, sizeof(x))
#define uni(x) (x).erase(unique(all(x)), (x).end())
#define BUG(x) cerr << #x << " = " << (x) << endl
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define _1 first
#define _2 second
#define chkmin(a, b) a = min(a, b)
#define chkmax(a, b) a = max(a, b)

const int maxn = 112345;

int n, L;
int a[maxn], b[maxn];
bool vis[maxn];

int main() {
  scanf("%d%d", &n, &L);
  FOR(i, 1, n) scanf("%d", a + i);
  FOR(i, 1, n) scanf("%d", b + i);
  a[n + 1] = b[n + 1] = L + 1;
  ll ans = 0;
  FOR(i, 1, n) if (a[i] == b[i]) vis[i] = true;
  map<int, int> occ;
  occ[0] = 0;
  FOR(i, 1, n) {
    occ[a[i] - i] = i;
    if (b[i] < a[i] && occ.count(b[i] - i)) {
      int hedge = i - occ[b[i] - i];
      if (hedge <= 1) ans += hedge;
      else if (b[i - 1] == b[i] - 1) ans++;
      else ans += hedge;
      vis[i] = true;
    }
  }
  occ.clear();
  occ[a[n + 1] - n - 1] = n + 1;
  ROF(i, n, 1) {
    occ[a[i] - i] = i;
    if (b[i] > a[i] && occ.count(b[i] - i)) {
      int hedge = occ[b[i] - i] - i;
      if (hedge <= 1) ans += hedge;
      else if (b[i + 1] == b[i] + 1) ans++;
      else ans += hedge;
      vis[i] = true;
    }
  }
  FOR(i, 1, n) if (!vis[i]) {
    puts("-1");
    return 0;
  }
  printf("%lld", ans);
}


#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <cmath>
#include <numeric>
#include <queue>
using namespace std;

int64_t min(int64_t a,int64_t b) {
    if (a > b)
    {
        return b ;
    }else
    {
        return a ;
    }
}

int64_t gcd(int64_t a,int64_t b){
    if(a < b)
    {
        int64_t temp = a;
        a = b ;
        b = temp;
    }
    int64_t copya = a;
    int64_t copyb = b;
    int64_t r = a%b ;
    while (r != 0)
    {
        a = b ;
        b = r ;
        r = a%b ;
    }
    return b ;

}
int solve(string s, int start){
    if (start >= s.size())
    {
        return 100000000 ;
    }

    string at = "atcoder" ;
    if (start >= at.size())
    {
        return 0 ;
    }

    int l = 100000000 ;
    int same = 100000000 ;
    for (int i = start; i < s.size(); i++)
    {
        if (l == 100000000)
        {
            if (s.at(i) > at.at(start))
            {
                l = i -start ;
                break ;
            }

        }
        if (same == 100000000)
        {
            if (s.at(i) == at.at(start))
            {
                same = i - start ;
            }

        }

    }
    if (same != 100000000)
    {
        for (int i = 0; i < same; i++)
        {
            swap(s.at(same+start -i),s.at(same+start -i-1)) ;
        }
    }

    if(l != 100000000 && same != 100000000)
    {
        return min(l,solve(s,start+1)+same) ;
    }else if (same == 100000000)
    {
        return l  ;
    }else
    {
        return solve(s,start+1)+same ;
    }

}

int main(){
    string at = "atcoder" ;
    int t ;
    cin >> t ;
    for (int cases = 0; cases < t; cases++)
    {
        string s ;
        cin >> s ;
        string copy = s ;
        sort(copy.begin(),copy.end()) ;
        reverse(copy.begin(),copy.end()) ;
        if (at >= copy)
        {
            cout << -1 << endl ;
            continue ;
        }
        int ans = solve(s,0) ;

        cout << ans << endl ;
    }

}

#include <iostream>
#include <iomanip>
#include <vector>
#include <cmath>
#include <algorithm>
#include <deque>
#include <set>
#include <limits>
#include <string>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <list>
#include <numeric>
#include <bitset>

using namespace std;
using ll = long long;

#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, a) for (int i = 0; i < (a); ++i)
#define OUT_PREC(a, n) cout << fixed << setprecision(n) << a << endl

class UnionFind
{
private:
    int n;
    struct NODE
    {
        ll val;
        int root = -1;
    };

    vector<NODE> nd;
    vector<int> size;

public:
    UnionFind(const int &n0)
    {
        n = n0;
        nd.resize(n);
        size.resize(n, 1);

        for (int i = 0; i < n; ++i)
        {
            nd[i] = NODE{i, -1};
        }
    }

    void merge(int a, int b)
    {
        int ra = find(a);
        int rb = find(b);

        if (ra == rb) return;

        if (size[ra] <= size[rb])
        {
            nd[ra].root = rb;
            size[rb] += size[ra];
        }
        else
        {
            nd[rb].root = ra;
            size[ra] += size[rb];
        }
    }

    int find(int a)
    {
        int r = nd[a].root;
        if (r == -1)
            return a;
        else
        {
            int t = find(r);
            nd[a].root = t;
            return t;
        }
    }

    bool same(int a, int b)
    {
        return find(a) == find(b);
    }
};

double solve()
{
    int n;
    cin >> n;
    vector<vector<ll>> d(n, vector<ll>(n + 2, -1LL));
    vector<ll> x(n), y(n);
    REP(i, n)
        cin >> x[i] >> y[i];

    FOR(i, 0, n)
    {
        FOR(j, i + 1, n)
        {
            d[i][j] = (x[i] - x[j]) * (x[i] - x[j]) + (y[i] - y[j]) * (y[i] - y[j]);
        }

        d[i][n] = (100 - y[i]) * (100 - y[i]);
        d[i][n + 1] = (100 + y[i]) * (100 + y[i]);
    }

    // 4r^2は整数
    ll ok = 0;
    ll ng = 40001;

    do
    {
        int m = (ok + ng) / 2;

        UnionFind uf = UnionFind(n + 2);
        // 要素n, n+1が壁
        FOR(i, 0, n){
            FOR(j, i + 1, n + 2){
                if (d[i][j] < m) uf.merge(i, j);
            }
        }

        (uf.same(n, n + 1) ? ng : ok) = m;

    } while (abs(ok - ng) > 1);

    return sqrt((double)ok) / (double)2.0;
}

int main()
{
    /* solve */
    cout << fixed << setprecision(15) << solve() << endl;
    // OUT((solve() ? "Yes" : "No"));
    system("pause");
}


#include<bits/stdc++.h>
using namespace std;
#define ll long long
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    string s;
    cin >> s;
    for(int i = (int)s.length() - 1;  i >= 0; i--)  {
        if(s[i] == '6') {
            cout << "9";
        }
        else if(s[i] == '9')        {
            cout << "6";
        }
        else    {
            cout << s[i];
        }
    }

}


#define _DEBUG
//ヘッダー
#include<bits/stdc++.h>
using namespace std;

//型定義
typedef long long ll;

//定数
const ll INF=1e+18;
const int MOD=1e+9+7;

//デバッグ
#define CHOOSE(a) CHOOSE2 a
#define CHOOSE2(a0,a1,a2,a3,a4,x,...) x
#define debug1(x1) cout<<#x1<<": "<<x1<<endl
#define debug2(x1,x2) cout<<#x1<<": "<<x1<<", "#x2<<": "<<x2<<endl
#define debug3(x1,x2,x3) cout<<#x1<<": "<<x1<<", "#x2<<": "<<x2<<", "#x3<<": "<<x3<<endl
#define debug4(x1,x2,x3,x4) cout<<#x1<<": "<<x1<<", "#x2<<": "<<x2<<", "#x3<<": "<<x3<<", "#x4<<": "<<x4<<endl
#define debug5(x1,x2,x3,x4,x5) cout<<#x1<<": "<<x1<<", "#x2<<": "<<x2<<", "#x3<<": "<<x3<<", "#x4<<": "<<x4<<", "#x5<<": "<<x5<<endl
#ifdef _DEBUG
#define debug(...) CHOOSE((__VA_ARGS__,debug5,debug4,debug3,debug2,debug1,~))(__VA_ARGS__)
#else
#define debug(...)
#endif

//REPマクロ
#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define REP2(i,a,b) for(ll i=a;i<(ll)(b);i++)
#define REPD2(i,a,b) for(ll i=a;i>(ll)(b);i--)

// 多次元 vector 生成
template<class T>
vector<T> make_vec(size_t a){
    return vector<T>(a);
}
template<class T, class... Ts>
auto make_vec(size_t a, Ts... ts){
  return vector<decltype(make_vec<T>(ts...))>(a, make_vec<T>(ts...));
}

//vectorの扱い
#define ALL(x) (x).begin(),(x).end() //sortなどの引数省略
#define SIZE(x) ((ll)(x).size()) //size
#define MAX(x) *max_element(ALL(x)) //最大値
#define MIN(x) *min_element(ALL(x)) //最小値

//省略
using vi  = vector<int>;
using vii = vector<vector<int>>;
using vl  = vector<ll>;
using vll = vector<vector<ll>>;
using pii = pair<int,int>;
using pll = pair<ll,ll>;

int main(){
    ll H,W;
    cin>>H>>W;
    vector<vector<char>> S(H+2,vector<char>(W+2,'#'));
    REP(i,H){
        REP(j,W){
            cin>>S[i+1][j+1];
        }
    }

    vll dp(H+2,vl(W+2,0)),L(H+2,vl(W+2,0)),U(H+2,vl(W+2,0)),naname(H+2,vl(W+2,0));

    dp[1][1]=1;
    L[1][1]=1;
    U[1][1]=1;
    naname[1][1]=1;
    REP2(i,1,H+1){
        REP2(j,1,W+1){
            if(S[i][j]=='#'){
                dp[i][j]=0;
                L[i][j]=0;
                U[i][j]=0;
                naname[i][j]=0;
            }else{
                dp[i][j]+=L[i][j-1];
                dp[i][j]%=MOD;
                dp[i][j]+=U[i-1][j];
                dp[i][j]%=MOD;
                dp[i][j]+=naname[i-1][j-1];
                dp[i][j]%=MOD;

                L[i][j]=L[i][j-1]+dp[i][j];
                L[i][j]%=MOD;
                U[i][j]=U[i-1][j]+dp[i][j];
                U[i][j]%=MOD;
                naname[i][j]=naname[i-1][j-1]+dp[i][j];
                naname[i][j]%=MOD;
            }
        }
    }
    cout<<dp[H][W]<<endl;

}

#include<bits/stdc++.h>
using namespace std;
using u64 = uint_fast64_t;
using u32 = uint_least32_t;
using u16 = uint_least16_t;
using u8 = uint_least8_t;

int main(void) {

	u32 mod = 1000000007;

	u16 H, W;
	cin >> H >> W;

	u32 dp;
	vector<u32> vdp(W);
	u32 hdp;
	vector<u32> ddp(W);

	for(u16 i=0; i<H; ++i) {
		u32 t_ddp = ddp[0];

		for(u16 j=0; j<W; ++j) {
			u8 c;
			cin >> c;

			if(c == '#') {
				dp = 0;
				vdp[j] = 0;
				hdp = 0;
				t_ddp = ddp[j];
				ddp[j] = 0;
			} else if(i == 0 && j == 0) {
				dp = 1;
				vdp[j] = 1;
				hdp = 1;
				t_ddp = ddp[j];
				ddp[j] = 1;
			} else if(i == 0) {
				dp = hdp;
				vdp[j] = dp;
				hdp = (hdp + dp) % mod;
				t_ddp = ddp[j];
				ddp[j] = dp;
			} else if(j == 0) {
				dp = vdp[j];
				vdp[j] = (vdp[j] + dp) % mod;
				hdp = dp;
				t_ddp = ddp[j];
				ddp[j] = dp;
			} else {
				dp = ((vdp[j] + hdp) % mod + t_ddp) % mod;
				vdp[j] = (vdp[j] + dp) % mod;
				hdp = (hdp + dp) % mod;
				u32 k_ddp = t_ddp;
				t_ddp = ddp[j];
				ddp[j] = (k_ddp + dp) % mod;
			}
		}
	}

	cout << dp << endl;
	return 0;
}


#include <bits/stdc++.h>
#define REP(i, n) for(ll i = 0; i < (n); i++)
#define REP1(i, n) for(ll i = 1; i <= (n); i++)
#define REPD(i,a,b) for (ll i=(a);i<=(b);i++)
#define ALL(v) (v).begin(), (v).end()
using namespace std;
typedef long long ll;
typedef double d;
typedef long double ld;
typedef vector<string> vs;
typedef vector<bool> vb;
typedef vector<vb> vvb;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<d> vd;
typedef vector<ld> vld;
typedef set<int> si;
typedef vector<si> vsi;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef pair<int, int> pi;
typedef queue<int> qi;
typedef queue<pi> qpi;
typedef pair<ll, ll> pll;
typedef queue<pll> qpll;
typedef vector<pi> vpi;
typedef vector<pll> vpll;
const int mod = 1000000007;
const int INF = 1001001001;
// 小数点 << fixed << setprecision(10) <<
// sort降順 sort(ALL(),greater<int>());
// 円周率 M_PI
// 文字判定 isupper islower
// 順列 do {} while(next_permutation(ALL(X)));
// 最大値 LLONG_MAX
// a内でx以上 auto iter = lower_bound(ALL(a), x);
// a内でxより大きい auto iter = upper_bound(ALL(a), x);
int dx[8] = {1, 0, -1, 0, 1, 1, -1, -1};
int dy[8] = {0, 1, 0, -1, 1, -1, 1, -1};
struct edge {
    int from; //出発点
    int to;   //到達点
    int cost; //移動コスト
};
typedef struct edge se;
typedef vector<edge> ve;

// 重複した要素を取り除いて返す
vll deleteDuplication(vll &numberlist) {
  sort(ALL(numberlist));
  numberlist.erase(unique(ALL(numberlist)),numberlist.end());
  return numberlist;
}

// 2つの数の最大公約数を求める
unsigned Euclidean_gcd(unsigned a, unsigned b) {
  if(a < b) return Euclidean_gcd(b, a);
  unsigned r;
  while ((r=a%b)) {
    a = b;
    b = r;
  }
  return b;
}

// 各桁の数を合計
int digit_sum(int n) {
  int sum=n%10;
  while(n!=0) {
    n/=10;
    sum+=n%10;
  }
  return sum;
}

// 素因数分解してペアのリストを返す
vpll PrimeFactorization(ll n) {
  vpll res;
  for (ll i=2; i*i<=n; i++) {
    if(n%i!=0) continue;
    ll ex=0;
    while(n%i==0) {
      ex++;
      n/=i;
    }
    res.push_back(pll(i,ex));
  }
  if(n!=1) res.push_back(pll(n,1));
  return res;
}

int main() {
  string s;
  cin >> s;
  int n=s.length();
  vi digit(n);
  vi ch(3,0);
  REP(i,n) {
    digit[i]=int(s[i])%3;
    ch[digit[i]]++;
  }
  int sum=accumulate(ALL(digit),0);
  if(sum%3==0) cout << 0 << endl;
  else if(sum%3==1) {
    if(ch[1]>0&&n!=1) cout << 1 << endl;
    else if(ch[2]>1&&n!=2) cout << 2 << endl;
    else cout << -1 << endl;
  }
  else if(sum%3==2) {
    if(ch[2]>0&&n!=1) cout << 1 << endl;
    else if(ch[1]>1&&n!=2) cout << 2 << endl;
    else cout << -1 << endl;
  }
  return 0;
}

#include<bits/stdc++.h>
using namespace std;
#define ll long long
int main()
{
    ll n; cin>>n;
    vector<ll>v1,v2;
    while(n)
    {
        v1.push_back(n%10);
        n/=10;
    }
    int n1=v1.size(); ll sum=0;
    for(auto it:v1)
    {
        sum+=it;
        if(it%3!=0)
            v2.push_back(it);
    }
    int ans=100;
    if(sum<3) ans=-1;
    else{
        ll sum1=0;
        for(auto it:v2)
            sum1+=it;
        if(sum1%3==0) ans=0;
        else{
                bool flag=0;
            for(auto it:v2){
                if((sum1-it)%3==0){
                    ans=1;
                    flag=1;
                    break;
                }
            }
            if(!flag){
                for(int i=0;i<v2.size();i++)
                {
                    for(int j=0;j<v2.size();j++)
                    {
                        if(j!=i&&(sum1-v2[i]-v2[j])%3==0)
                        {
                            ans=2;
                            flag=1;
                            break;
                        }
                    }
                }
                if(!flag) ans=-1;
            }
        }
        if(ans>n1-1) ans=-1;
    }
    cout<<ans<<endl;
}


#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<set>
using namespace std;
typedef long long ll;
#define rep(i,n) for(int i=0;i<n;i++)
#define chmin(a,b) a=min(a,b)
#define chmax(a,b) a=max(a,b)
#define mod 1000000007
#define ad(a,b) a=(a+b)%mod;
ll po(ll x,ll y){
	ll res=1;
	for(;y;y>>=1){
		if(y&1)res=res*x%mod;
		x=x*x%mod;
	}
	return res;
}
ll gcd(ll a,ll b){
	return (b?gcd(b,a%b):a);
}
#define X 200010
ll fac[X],ivf[X];
void initfac(){
	fac[0]=1;
	for(ll i=1;i<X;i++)fac[i]=fac[i-1]*i%mod;
	for(ll i=0;i<X;i++)ivf[i]=po(fac[i],mod-2);
}
ll C(ll n,ll k){
	return fac[n]*ivf[n-k]%mod*ivf[k]%mod;
}

ll n;
char c[2][2];
ll solve(){
	cin>>n;
	cin>>c[0][0]>>c[0][1]>>c[1][0]>>c[1][1];
	if(n==2)return 1;
	ll fib[1010];
	fib[0]=fib[1]=1;
	for(int i=2;i<=n;i++)fib[i]=(fib[i-2]+fib[i-1])%mod;

	if(c[0][1]=='A'){
		if(c[0][0]=='A'){
			return 1;
		}
		if(c[1][0]=='B')return po(2,n-3);
		return fib[n-2];
	}
	if(c[0][1]=='B'){
		if(c[1][1]=='B'){
			return 1;
		}
		if(c[1][0]=='A')return po(2,n-3);
		return fib[n-2];
	}
}
int main(){
	cin.tie(0);
	ios::sync_with_stdio(0);
	cout<<solve()<<endl;
}

#include<bits/stdc++.h>
using namespace std;
int main(){
  int n,p;
  string s;
  vector<char> v;
  char c;
  cin>>n>>s;
  for(int i=0;i<n;i++){
    v.push_back(s[i]);
    p=v.size();
    if(p>2){
      if(v[p-3]=='f'&&v[p-2]=='o'&&v[p-1]=='x'){
        for(int j=0;j<3;j++){
          v.pop_back();
        }
      }
    }
  }
  cout<<(v.size())<<endl;
}


#include <iostream>
#include <algorithm>
#include <queue>
#include <string>
#include <limits>
#include <cstring>
#define int long long

int const INF = std::numeric_limits<int>::max();
int const NINF = std::numeric_limits<int>::min();
int const N = 50;
int const M = N;

struct Obj {
	int weight;
	int value;
	bool operator<(const Obj& other) const {
		if (value == other.value) {
			return weight < other.weight;
		}
		else {
			return value > other.value;
		}
	}
};

int box[M + 1];
bool vis[M + 1];
Obj bag[N + 1];

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

	int n, m, q;
	std::cin >> n >> m >> q;

	for (int i = 1; i <= n; i++) {
		std::cin >> bag[i].weight >> bag[i].value;
	}
	std::sort(bag + 1, bag + 1 + n);

	for (int i = 1; i <= m; i++) {
		std::cin >> box[i];
	}

	for (int i = 1; i <= q; i++) {
		memset(vis, 0, sizeof vis);

		int l, r;
		std::cin >> l >> r;
		for (int j = l; j <= r; j++) {
			vis[j] = true;
		}

		int ans = 0;
		for (int j = 1; j <= n; j++) {
			int near = INF;
			int pos = 0;
			for (int k = 1; k <= m; k++) {
				if (!vis[k]) {
					if (box[k] >= bag[j].weight && box[k] < near) {
						near = box[k];
						pos = k;
					}
				}
			}

			if (near != INF) {
				vis[pos] = true;
				ans += bag[j].value;
			}
		}

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

	return 0;
}

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

typedef long long ll;
typedef unsigned int ui;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int, int> ii;
typedef vector<ii> vii;
const int INF = int (1e9) + int (1e5);
const ll INFL = ll(2e18) + ll(1e10);
const ui MOD = 1E9 + 7;
const double EPS = 1e-9;
#define FOR(i,n) for (int i=0;i<(n);++i)
#define MP make_pair
#define all(a) (a).begin(),(a).end()
#define ODD(x) ( ((x)&1)==0?0:1 )
#define SIGN(x) ( ((x) > 0) - ((x) < 0)  )
#define dbg(x) cerr << #x"= " << x << endl

std::mt19937_64  generator(std::chrono::system_clock::now().time_since_epoch().count());

inline ll powmod(ll a,ll b,ll mod) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
ll lcm(ll a, ll b) { return a / __gcd(a,b) * b; }

void READ(bool _local){
    ios_base::sync_with_stdio(false); cin.tie(0);
#ifdef _DEBUG
    if (_local)
        freopen ("in.txt", "r", stdin);
#endif
}

int main(){
    READ(1);
    int n,m,q;cin>>n>>m>>q;
    vii bag(n);
    FOR(i,n)cin>>bag[i].first>>bag[i].second;
    sort(all(bag),[](const ii a,const ii b){return a.second>b.second;});
    vii box(m);
    FOR(i,m) {cin>>box[i].first;box[i].second=i;}
    sort(all(box));
    vi used(m);
    while(q--){
        int l,r;cin>>l>>r;
        --l, --r;
        FOR(i,m)
            used[i]= (box[i].second>=l && box[i].second<=r);
        ll ret=0;
        FOR(i,n){
            FOR(j,m){
                if (!used[j] && box[j].first>=bag[i].first){
                    ret += bag[i].second;
                    used[j]=1;
                    break;
                }
            }
        }
        cout << ret << " ";
    }

}


#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define N 500005
#define INF 0x3f3f3f3f
int n,cs=0,ct=0,ps[N],pt[N];
char s[N],t[N];
ll ans=0;
int main(){
	//freopen("b.in","r",stdin);
	//freopen("b.out","w",stdout);
	scanf("%d%s%s",&n,s,t);
	for(int i=0;i<n;++i){
		if(s[i]=='1') ps[++cs]=i;
		if(t[i]=='1') pt[++ct]=i;
	}
	pt[ct+1]=INF;
	if(cs<ct||((cs-ct)&1)){
		puts("-1");
		return 0;
	}
	for(int i=1,j=1;;++i,++j){
		while(j<=cs&&pt[i]>ps[j]){
			ans+=ps[j+1]-ps[j];
			j+=2;
		}
		if(j>cs){
			if(i>ct)printf("%lld\n",ans);
			else puts("-1");
			return 0;
		}
		ans+=ps[j]-pt[i];
	}

	return 0;
}

#include <bits/stdc++.h>
#define LL long long

using namespace std;

int k, ans;
string s;

bool C(int x) {
  bool b[10] = {};
  b[x % 10] = b[x / 10 % 10] = b[x / 100 % 10] = b[x / 1000] = true;
  for (int i = 0; i <= 9; i++) {
    if (s[i] == 'o' && !b[i] || s[i] == 'x' && b[i]) {
      return false;
    }
  }
  return true;
}

int main() {
  cin.tie(0), cout.tie(0);
  ios::sync_with_stdio(false);
  cin >> s;
  for (int i = 0; i <= 9; i++) {
    k += s[i] == 'o';
  }
  for (int i = 0; i <= 9999; i++) {
    ans += C(i);
  }
  cout << ans;
  return 0;
}


#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef long double ld;
typedef vector<ll> vl;
typedef vector<bool> vb;
typedef vector<string> vs;
typedef vector<char> vc;
typedef queue<ll> ql;
typedef deque<ll> dql;
typedef priority_queue<ll> pql;
typedef set<ll> sl;
typedef pair<ll, ll> pl;
typedef map<ll, ll> ml;
typedef vector<vl> vvl;
typedef vector<pl> vpl;
#define rep(i, n) for(ll i = 0; i < ll(n); i++)
#define rep2(i, k, n) for(ll i = ll(k); i <= ll(n); i++)
#define rep3(i, n, k) for(ll i = ll(n); i >= ll(k); i--)
#define all(v) (v).begin(), (v).end()
ll mod(ll a, ll b) {return (a % b + b) % b;}
ll quo(ll a, ll b) {return (a - mod(a, b)) / b;}
template <typename T, typename U> bool chmin(T &a, const U b) {if(a > b) {a = b; return 1;} return 0;}
template <typename T, typename U> bool chmax(T &a, const U b) {if(a < b) {a = b; return 1;} return 0;}
const ll INF = 1LL << 60;
const ll MOD = 1e9 + 7;
//const ll MOD = 998244353;
const ll MAX = 2e5;
const ld eps = 1e-9;
const char newl = '\n';

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

  ll n;
  string ans;
  cin >> n;
  vl a(2*n);
  rep(i, 2*n) cin >> a[i];
  vpl vec(2*n);
  rep(i, 2*n) vec[i] = pl(a[i], i);
  sort(all(vec));
  vb plus(2*n, 1);
  rep(i, n) plus[vec[i].second] = 0;
  ll cnt = 0;
  rep(i, 2*n) {
    if(plus[i]) {
      if(cnt >= 0) ans += '(';
      else ans += ')';
      cnt++;
    }else {
      if(cnt <= 0) ans += '(';
      else ans += ')';
      cnt--;
    }
  }
  cout << ans << newl;
  return 0;
}

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

using namespace std;
using namespace __gnu_pbds;

#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define fbo find_by_order
#define ook order_of_key

typedef long long ll;
typedef pair<ll,ll> ii;
typedef vector<int> vi;
typedef long double ld;
typedef pair<ld,ld> state;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> pbds;

int co[666666];
char f[556555];

int main()
{
	ios_base::sync_with_stdio(0); cin.tie(0);
	int n; cin>>n; n*=2;
	vector<ii> vec;
	for(int i=0;i<n;i++)
	{
		int x; cin>>x; vec.pb({x,i});
	}
	sort(vec.begin(),vec.end());
	for(int i=0;i<n;i++)
	{
		if(i<n/2) co[vec[i].se]=1;
		else co[vec[i].se]=0;
	}
	stack<int> S;

	for(int i=0;i<n;i++)
	{
		if((!S.empty())&&(co[S.top()]!=co[i]))
		{
			f[S.top()]='(';
			S.pop();
			f[i]=')';
		}
		else S.push(i);
	}
	for(int i=0;i<n;i++)
	{
		cout<<f[i];
	}
	cout<<'\n';
}


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

int main() {

  int n;
  cin >> n;

  vector<vector<int>> data(n, vector<int>(3));

 for (int i = 0; i < n; i++) {
    for (int j = 0; j < 3; j++) {
      cin >> data.at(i).at(j);
    }
  }

  int res = -1;
  int price = data.at(0).at(1);
  for (int i =0; i < n; i++){
   if(data.at(i).at(2) - data.at(i).at(0) > 0){
     if(price > data.at(i).at(1)){
       price = data.at(i).at(1);
       res = data.at(i).at(1);
     }
   }
  }

  cout << res << endl;

}

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

int main(){
int N;
cin >>N;
vector<long long>A(N);
vector<long long>P(N);
vector<long long>X(N);
vector<long long>l(N);
for(int i = 0;i<N;i++){
  cin>>A[i]>>P[i]>>X[i];
}

for(int i = 0;i<N;i++){
  if(A[i] < X[i]){
    l[i] = P[i];
  }
  else{
    l[i] = 1000000001;
  }
}
long long m = 1000000001;

for(int i = 0;i<N;i++){
    m = min(l[i],m);
}

if(m == 1000000001){
  m = -1;
}

cout<<m<<endl;
}


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

int main(){
  	int V,T,S,D;
	cin >> V >> T >> S >> D;
  	if(D < V*T || D > V*S ){
    cout << "Yes" << endl;
    }
	else{
    cout << "No" << endl;
    }

}

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

template <typename T> using oset = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
#define oset_find(k) find_by_order(k)
#define oset_order(k) order_of_key(k)*/

using ll = long long;
using db = long double;
using vi = vector<int>;
using vl = vector<ll>;
using pi = pair<int, int>;
using pl = pair<ll, ll>;

#define FOR(i, a, n) for(ll i=(a);i<(n);++i)
#define ROF(i, a, n) for(ll i=(n)-1;i>=(a);--i)

#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define sz(x) int((x).size())
#define ins insert
#define pb push_back
#define fi first
#define se second
#define lb lower_bound
#define ub upper_bound
#define endl '\n'
constexpr int pct(int x) { return __builtin_popcount(x); }

template<typename T> bool ckmin(T& a, const T& b) { return b<a?a=b,1:0; }
template<typename T> bool ckmax(T& a, const T& b) { return a<b?a=b,1:0; }

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

#define ts to_string
string ts(char c) { return string(1, c); }
string ts(const char* s) { return (string)s; }
string ts(const string& s) { return '"' + s + '"'; }
string ts(bool b) { return (b ? "true" : "false"); }

string ts(vector<bool> v) {
    string res = "{";
    FOR(i, 0, sz(v))
        res += char('0' + v[i]);
    res += "}";
    return res;
}

template <size_t SZ> string ts(bitset<SZ> b) {
    string res;
    FOR(i, 0, SZ)
        res += char('0' + b[i]);
    return res;
}

template <typename A, typename B> string ts(pair<A, B> p);
template <typename A> string ts(A v) {
    bool first = 1; string res = "{";
    for (const auto& x: v) {
        if (!first) res += ", ";
        first = 0; res += ts(x);
    }
    res += "}"; return res;
}

template <typename A, typename B> string ts(pair<A, B> p) {
    return "(" + ts(p.fi) + ", " + ts(p.se) + ")";
}

void dbg_out() { cerr << "]" << endl; }
template <typename H, typename... T> void dbg_out(H h, T... t) {
    cerr << ts(h); if (sizeof...(t)) cerr << ", ";
    dbg_out(t...);
}

#ifdef LOCAL
    #define dbg(...) cerr << "Line(" << __LINE__ << ") -> [" << #__VA_ARGS__ << "]: [", dbg_out(__VA_ARGS__)
#else
    #define dbg(...) 0
#endif

//const int MOD = 1e9+7; //998244353;
//const ll INF = 1e18;
//const db PI = 3.14159265358979323846;

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

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

    #ifdef LOCAL
        auto begin = std::chrono::high_resolution_clock::now();
    #endif

    int tc = 1;
    //cin >> tc;
    FOR(tn, 0, tc) {
        //cout << "Case #" << tn+1 << ": ";
        solve();
    }

    #ifdef LOCAL
        auto end = std::chrono::high_resolution_clock::now();
        cerr << "\nExecution time: " << std::chrono::duration_cast<std::chrono::duration<double>> (end-begin).count() << " seconds\n";
    #endif
}


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

#define rng(x) x.begin(), x.end()
#define maxi(x, y) x = max(x, (y))
#define mini(x, y) x = min(x, (y))
#define pb push_back
#define F first
#define S second
#define el '\n'
#define int long long
#define SZ(x) ((int)(x).size())
template<typename T>
istream&operator>>(istream&is,vector<T>&v){for(auto&it:v)is>>it;return is;}
template<class L, class R> ostream& operator<<(ostream &os, pair<L,R> P) {
    return os << "(" << P.F << "," << P.S << ")"; }
template<class T> ostream& operator<<(ostream &os, vector<T> V) {
    os << "[ "; for(auto v : V) os << v << " "; return os << "]"; }
template<class T> ostream& operator<<(ostream &os, set<T> S){
    os << "{ "; for(auto s:S) os<<s<<" "; return os<<"}"; }
#ifndef ONLINE_JUDGE
#define db(...) __f(#__VA_ARGS__, __VA_ARGS__)
#else
#define db(...)
#endif
template <typename Arg1>
void __f(const char* name, Arg1&& arg1) { cerr<<name<<" : "<<arg1<<'\n';}
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...);}
typedef pair<int,int> pi; typedef vector<int> vi; typedef vector<vi> vvi;

/*-----------------------------Code Begins--------------------------------*/

void solve(){
    int n; cin >> n;
    vvi xy(n, vi(2)); cin >> xy;
    int m; cin >> m;
    vi op(m + 1), op1(m + 1);
    for(int i = 1; i <= m; ++i){
    	cin >> op[i];
    	if(op[i] > 2){
    		cin >> op1[i];
    	}
    }
    int q; cin >> q;
    vector <pi> queries[m + 1];
    for(int i = 0; i < q; ++i){
     	int j, t; cin >> t >> j;
     	j--;
     	queries[t].pb({j, i});
    }
    vector <pi> ans(q);
    array <int, 3> x{1, 0, 0}, y{1, 1, 0};

    auto rotate = [&](){
    	swap(x, y);
    	x[0] *= -1;
    	x[2] *= -1;
    };

    for(int i = 0; i <= m; ++i){
    	if(i){
    		if(op[i] == 1){
    			rotate();
    			rotate();
    			rotate();
    		}
    		else if(op[i] == 2){
    			rotate();
    		}
    		else if(op[i] == 3){
    			x[0] *= -1;
    			x[2] = 2 * op1[i] - x[2];
    		}
    		else{
    			y[0] *= -1;
    			y[2] = 2 * op1[i] - y[2];
    		}
    	}
    	for(auto [j , ai] : queries[i]){
    		ans[ai] = {x[0] * xy[j][x[1]] + x[2], y[0] * xy[j][y[1]] + y[2]};
    	}
    }
    for(int i = 0; i < q; ++i){
    	cout << ans[i].F << " " << ans[i].S << el;
    }
}

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

#include <iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<iomanip>
#include<map>
#include<queue>
#include<set>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define req(i,n) for(int i = 1;i <=  n; i++)
#define rrep(i,n) for(ll i = n-1;i >= 0;i--)
#define ALL(obj) begin(obj), end(obj)
#define RALL(a) rbegin(a),rend(a)
typedef long long ll;
typedef long double ld;
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 ll INF = 1e18;
ll mod = 1e9 + 7;
using vec =vector<ll>;
using mat = vector<vec>;
mat mul(mat& a, mat& b) {
	mat c(a.size(), vec(b[0].size(), 0));
	rep(i, a.size()) {
		rep(k, b.size()) {
			rep(j, b[0].size()) {
				c[i][j] += a[i][k] * b[k][j];
			}
		}
	}return c;
}
int main() {
	int n, m, q,x,y; cin >> n; vector<pair<ll,ll>> p(n);
	rep(i, n) cin >> p[i].first >> p[i].second;
	cin >> m; vector<mat> res(m + 10);
	res[0] = { {1,0,0},{0,1,0},{0,0,1} };
	rep(i, m) {
		cin >> x;
		if (x == 1) res[i + 1] = { {0,1,0},{-1,0,0},{0,0,1} };
		else if (x == 2) res[i + 1] = { {0,-1,0} ,{1,0,0},{0,0,1} };
		else if (x == 3) {
			cin >> y; res[i + 1] = { {-1,0,2 * y},{0,1,0},{0,0,1} };
		}
		else {
			cin >> y; res[i + 1] = { {1,0,0},{0,-1,2 * y},{0,0,1} };
		}res[i+1] = mul(res[i + 1], res[i]);
	}cin >> q;
	rep(i, q) {
		cin >> x >> y; y--;
		ll X = p[y].first, Y = p[y].second;
		cout << X * res[x][0][0] + Y * res[x][0][1] + res[x][0][2] << " ";
		cout << X * res[x][1][0] + Y * res[x][1][1] + res[x][1][2] << endl;
	}
}


#include <iostream>
#include <cstring>
#include <vector>
#include <algorithm>
#include <map>
#define endl '\n'
using namespace std;

typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
const ll INF=1e10+1;

int main(){
    ios::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
    //freopen("input.txt","r",stdin);
    ll n;
    cin>>n;
    ll i=1;
    while(1) {
        ll res=i*(i+1)/2;
        if(res>=n) {
            cout<<i;
            return 0;
        }
        i++;
    }
    return 0;
}

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

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

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

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

int main(){
    ll n;
    cin >> n;
    set<ll> st;
    for(ll i=2;i<=sqrt(n)+10;i++){
        ll k = i*i;
        while(k<=n){
            st.insert(k);
            k *= i;
        }
    }
    cout << n-st.size() << endl;
    return 0;
}


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

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

    int cnt = 0;
    ll miz = a, red = 0;

    while (miz > red * d && cnt <= 1e9) {
        miz += b;
        red += c;
        cnt++;
    }

    if (cnt == 1e9+1)
        cout << -1 << endl;
    else
        cout << cnt << endl;

    return 0;
}

#include <bits/stdc++.h>
#define int long long
#define Nanase_Kurumi_aka_menhera_chan_is_mine ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define pb push_back
#define pi pair<int, int>
#define BE(i) i.begin(),i.end()
#define fi first
#define se second
#define INF 2147483647
#define mkp make_pair
#define ist insert
#define mod 1000000007
//#pragma GCC optimize("Ofast,unroll-loops,no-stack-protector,fast-math")
//#pragma GCC optimize("O2")
using namespace std;
int min(int a, int b){return a < b ? a : b;}
int max(int a, int b){return a > b ? a : b;}
bool isprime(int k){bool is=1 ; for ( int i = 2 ; i*i <= k ; i++ ) if ( k % i == 0 ) is = 0 ; return k>1?is:0;}
const double PI=acos(-1);
int a,b,c,d;
void sol(){
    cin >>a>>b>>c>>d;
    if (c*d-b<=0) cout <<"-1";
    else cout <<a/(c*d-b)+(a%(c*d-b)!=0);
}
signed main(){
    Nanase_Kurumi_aka_menhera_chan_is_mine
    int _=1;
    //cin >>_;
    while (_--) sol();
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MOD=1000000007;
#define INF 1LL<<30
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define all(x) (x).begin(),(x).end()

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

    int sa=0,sb=0;
    rep(i,a.size()) sa+=a[i]-'0';
    rep(i,b.size()) sb+=b[i]-'0';

    cout<<max(sa,sb)<<endl;
}

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

int main(){
  int a, b;
  cin >> a >> b;
  int ans = 4;
  a += b;
  if(15 <= a && 8 <= b)ans = 1;
  else if(10 <= a && 3 <= b)ans = 2;
  else if(3 <= a)ans = 3;
  cout << ans << endl;
}


#include <bits/stdc++.h>
using namespace std;
using P = pair<int, int>;
using ll = long long;
template<typename T> bool chmax(T &a, const T b) {
    if (a < b) {a = b; return true;} else return false; }

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

int main() {
  ll n;
  cin >> n;
  if (n == 1) {
    cout << 2 << endl;
    return 0;
  }
  if (n == 2) {
    cout << 2 << endl;
    return 0;
  }
  ll cnt = 0LL;

  for (int m = 1; m < 1500000; m++) {
    if (m*(m+1) <= 2*n) {
      if ((m%2 == 1) && (n%m == 0) && ((n/m)-((m-1)/2) > 0)) {
        cnt += 2LL;

      }
      if ((m%2 == 0) && (n%(m/2) == 0) && (n%m == m/2) && (2*n - pow(m, 2) + m > 0)) {

        cnt += 2LL;

      }
    }

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

}

#include <bits/stdc++.h>

using namespace std;
typedef long long ll;
#define inf 1e9
#define linf 1e18
#define BASE 1000000
#define EPS 1e-10
#define PI acos(-1)
#define pii pair<int,int>
#define piii pair<int, pair<int,int>>
#define pli pair<long long, int>
#define pll pair<long long, long long>
#define pdi pair<double,int>
#define vi vector<int>
#define fi first
#define se second
#define ALL(x) (x).begin(), (x).end()
#define ms(x,val_add) memset(x, val_add, sizeof(x))
#define pb(x) push_back(x)
#define make_unique(x) sort(ALL(x)) ; x.erase( unique(ALL(x)), x.end()) ;
#define dbg(x) do { cout << #x << " = " << x << endl; } while(0)
#define mp(x, y) make_pair(x, y)
#define minimize(x, y) x = min(x, y)
#define maximize(x, y) x = max(x, y)

/*** IMPLEMENTATION ***/
bool exitInput = false;
int ntest = 1, itest = 1 ;

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

const ll Mod = 1000000007LL;
const int maxn = 100000 + 5;
const int maxv = 500 + 5;
const int maxe = 10000 + 5;

void addMod(ll &x, ll y)
{
    x = (x + y) % Mod;
}
ll modPow(ll x, ll p)
{
    if(p == 0)
        return 1;
    ll r = modPow(x, p / 2);
    r = (r * r) % Mod;
    if(p & 1)
        r = (r * x) % Mod;
    return r;
}

int main()
{
    #ifdef HOME
    freopen( "input.txt", "r", stdin );
    freopen( "output.txt", "w", stdout );
    #endif // HOME
    #ifdef HOME // Copied from Um_nik
	#   define eprintf(...) fprintf(stdout, __VA_ARGS__);fflush(stdout);
    #else
        #define eprintf(...) 42
    #endif

    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout << setprecision(10);
    cout << fixed;

    //cin >> ntest;
    for(itest = 1; itest <= ntest; ++itest)
    {
        //cout << "Case #" << itest << ": ";
        ll n;
        cin >> n;
        n = 2 * n;
        int cnt = 0;
        for(ll x = 1; x * x <= n; ++x)
        {
            if(n % x == 0)
            {
                ll h = n / x;
                ll a2 = h - x - 1;
                cnt += abs(a2) % 2 == 0;

                if(h != x)
                {
                    a2 = x - h - 1;
                    cnt += abs(a2) % 2 == 0;
                }
            }
        }
        cout << cnt << endl;
    }

    return 0;
}


#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(a) a.begin(),a.end()
#define rrng(a) a.rbegin(),a.rend()
#define isin(x,l,r) ((l) <= (x) && (x) < (r))
#define pb push_back
#define eb emplace_back
#define sz(x) (int)(x).size()
#define pcnt __builtin_popcountll
#define uni(x) x.erase(unique(rng(x)),x.end())
#define snuke srand((unsigned)clock()+(unsigned)time(NULL));
#define show(x) cerr<<#x<<" = "<<x<<endl;
#define PQ(T) priority_queue<T,v(T),greater<T> >
#define bn(x) ((1<<x)-1)
#define dup(x,y) (((x)+(y)-1)/(y))
#define newline puts("")
using namespace std;
typedef long long int ll;
typedef unsigned uint;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef tuple<int,int,int> T;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
typedef vector<T> vt;
const double eps = 1e-10;
const ll LINF = 1001002003004005006ll;
const int INF = 1001001001;
#define dame { puts("-1"); return 0;}
#define yn {puts("Yes");}else{puts("No");}
const int MX = 200005;

// Unionfind
struct uf{
  vi d;
  uf() {};
  uf(int mx) : d(mx,-1) {};
  int root(int x){
    if(d[x]<0) return x;
    return d[x] = root(d[x]);
  }
  bool unite(int x, int y){
    x = root(x); y = root(y);
    if(x == y) return false;
    if(d[x] > d[y]) swap(x,y);
    d[x] += d[y]; d[y] = x;
    return true;
  }
  bool same(int x, int y) { return root(x) == root(y);}
  int size(int x){ return -d[root(x)];}
  int operator[] (int x) {return root(x);}
  int operator() (int x) {return size(x);}
};

const int MAX_N = 200100;

int n;
vp d[MAX_N];
int label[MAX_N];

void init(){
  rep(i,MAX_N) label[i] = -1;
}

void dfs(int u, int c){
  label[u] = c;
  for(auto dp: d[u]){
    int v = dp.first, vc = dp.second;
    if(label[v]>=0) continue;
    if(c == vc){
      if(c == 1) dfs(v,2);
      else dfs(v,1);
    }else{
      dfs(v,vc);
    }
  }
}

int main() {
  int m; cin >> n >> m;
  uf dis(n);
  rep(i,m){
    int u,v,c; cin >> u >> v >> c;
    --u,--v;
    d[u].push_back(make_pair(v,c));
    d[v].push_back(make_pair(u,c));
    dis.unite(u,v);
  }

  set<int> s;
  rep(i,n) s.insert(dis.root(i));
  if(s.size()>1){
    cout << "No" << endl;
    return 0;
  }

  init();
  dfs(0,1);

  rep(i,n) cout << label[i] << endl;

  return 0;
}

#include <iostream>
#include <vector>
//#include <string>
//#include <algorithm>
//#include <math.h>
//#include <queue>
//#include <stack>
//#include <iomanip>

// sometimes used
//#include <set>
//#include <map>
//#include <numeric>
//#include <list>
//#include <deque>
//#include <unordered_map>

typedef long long LL;
//typedef long double LD;
using namespace std;

//#define MOD 1000000007
//#define MOD 998244353
#define MAX 200100
//#define NIL -1
//#define INF 2000000000000000000
//const LL SEG_VAL = 1 << 19;

vector<vector<pair<LL, LL>>> g(MAX);

vector<LL> used(MAX);
vector<LL> ans(MAX);

void dfs(int v, int c) {
  used[v] = 1;
  ans[v] = c;
  for (LL i=0; i<g[v].size(); i++) {
    if (used[g[v][i].first]==0) {
      if (c == g[v][i].second) {
        LL newc = 0;
        if (c == newc) newc++;
        dfs(g[v][i].first, newc);
      } else {
        dfs(g[v][i].first, g[v][i].second);
      }
    }
  }
}

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

    LL n;
    LL m;
    cin >> n >> m;
    LL u;
    LL v;
    LL c;
    for(LL i=0; i<m; i++){
        cin >> u >> v >> c;
        u--;
        v--;
        c--;
        g[u].push_back(make_pair(v,c));
        g[v].push_back(make_pair(u,c));
    }

    dfs(0, 0);
    for(LL i=0; i<n; i++){
        cout << ans[i]+1 << endl;
    }

    return 0;
}


#include <bits/stdc++.h>
#define ll  long long
#define ull unsigned long long
using namespace std;
#define  inf 1e9+18
#define fastio ios_base::sync_with_stdio(false); cin.tie(NULL)
#define mod 998244353
#define  f1(i,n) for(i=1;i<=n;i++)
#define f0(i,n)  for(i=0;i<n;i++)
#define w(x)   while(x--)
const int maxn=200003;
#define  pq priority_queue
#define  ff first
#define  ss second
#define pb  push_back
#define lb lower_bound
#define ub upper_bound
#define  pq priority_queue
ll nck[302][302];
ll pre_c[maxn][301];
ll pow1[maxn][301];
ll n,k;
ll a[maxn];
void pre()
{
  ll i,j;
  for(i=0;i<=300;i++)
  {
    for(j=0;j<=i;j++)
    {
      if(j==0||i==0)
        nck[i][j]=1;
      else
        nck[i][j]=(nck[i-1][j-1]+nck[i-1][j])%mod;
    }
  }

}
void pre1()
{
  ll i,j;
  for(i=1;i<=n;i++)
  {
    for(j=0;j<=k;j++)
    {
      if(j==0)
        pow1[i][j]=1;
      else
        pow1[i][j]=(pow1[i][j-1]*a[i])%mod;
    }
  }
  for(j=0;j<=k;j++)
  {
    for(i=1;i<=n;i++)
    {
      pow1[i][j]=(pow1[i-1][j]+pow1[i][j])%mod;
    }
  }
}
ll power(ll n,ll p)
{
  ll r=1;
  while(p>0)
  {
    if(p%2)
    {
      r=(r*n)%mod;
      p--;
    }
    p=p/2;
    n=(n*n)%mod;
  }
  return r;
}
int main()
{
  fastio;
  int t;
  ll i,j,l,m;
  cin>>n>>k;
  for(i=1;i<=n;i++)
  {
    cin >> a[i];
  }
pre();
pre1();
for(i=1;i<=k;i++)
{
  ll ans=0;
  for(j=0;j<=i;j++)
  {
    ans=(ans+((nck[i][j]*pow1[n][j])%mod*pow1[n][i-j])%mod)%mod;
  }
  ans=(ans-power(2,i)*pow1[n][i]%mod+mod)%mod;
  ans=(ans*power(2,mod-2))%mod;
  cout<<ans<<"\n";
}

}

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

#pragma GCC target ("avx2")
#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")

/* // Ordered Set
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
template<typename T>
typedef tree<T, null_type,less<T>, rb_tree_tag,tree_order_statistics_node_update> ordered_set;
#define os_find(k) find_by_order(k)
#define os_order(k) order_of_key(k)
*/

typedef long long int ll;
typedef unsigned long long int ull;
typedef long double ld;
typedef vector<int> vi;
typedef vector<long long> vll;
#define f0(i,a,b) for(int i=a;i<b;i++)
#define f1(i,a,b) for(int i=a;i<=b;i++)
#define f2(i,a,b) for(int i=a;i>b;i--)
#define f3(i,a,b) for(int i=a;i>=b;i--)
#define all(a) a.begin(),a.end()
#define cntleadz(x) __builtin_clz(x) // or add ll at the end for long long
#define cnttrailz(x) __builtin_ctx(x)
#define cntpop(x) __builtin_popcount(x)
#define binparity(x) __builtin_parity(x)
#define pb push_back
#define pii pair<int,int>
#define int long long
#define fi first
#define se second
#define mod 998244353
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define make_graph(k) int x,y; f0(i,0,k){cin>>x>>y; adj[x].pb(y); adj[y].pb(x);}
#define test int t;cin>>t;while(t--)

int binExp(int x,int n)
{
    int res=1;
    while(n)
    {
        if(n&1) res=(res*x)%mod;
        x=(x*x)%mod;
        n>>=1;
    }
    return res;
}

int fact[301];
int modInv(int i) {return binExp(i,mod-2);}
int ncr(int n,int r) {return (n>=r?(fact[n]*modInv(fact[r]))%mod*modInv(fact[n-r])%mod:0);}

int powers[301][200001];
int sums[301];
int fin[301][200001];

signed main()
{
    fast

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

    fact[0] = 1;
    f1(i,1,300) fact[i] = (fact[i-1] * i)%mod;

    int nn,k;
    cin>>nn>>k;

    int a[nn];
    f0(i,0,nn) cin>>a[i];

    f0(i,0,nn) powers[0][i] = 1;
    f1(i,1,k)
    {
        f0(j,0,nn)
        {
            powers[i][j] = (powers[i-1][j] * a[j])%mod;
        }
    }

    f1(i,0,k)
    {
        f0(j,0,nn)
        {
            sums[i] = (sums[i] + powers[i][j])%mod;
        }
    }

    // f1(i,0,k)
    // {
    //     cout<<sums[i]<<' ';
    // }
    // cout<<'\n';

    f1(i,1,k)
    {
        int ans = 0;
        f1(j,0,i/2)
        {
            ans = (ans + ncr(i,j) * ((sums[j] * sums[i-j] % mod - sums[i] + mod)%mod) % mod) % mod;
        }
        if((i&1) == 0)
        {
            int j = i/2;
            ans = (ans - ncr(i,j) * ((sums[j] * sums[i-j] % mod - sums[i] + mod)%mod * modInv(2) % mod) % mod + mod) % mod;
        }
        cout<<ans<<'\n';
    }
}


// clang-format off
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

#define mp make_pair
#define fst first
#define snd second
#define forn(i,n) for (int i = 0; i < int(n); i++)
#define forn1(i,n) for (int i = 1; i <= int(n); i++)
#define popcnt __builtin_popcountll
#define ffs __builtin_ffsll
#define ctz __builtin_ctzll
#define clz __builtin_clz
#define clzll __builtin_clzll
#define all(a) (a).begin(), (a).end()

using namespace std;
using namespace __gnu_pbds;

using uint = unsigned int;
using ll = long long;
using ull = unsigned long long;
using pii = pair<int,int>;
using pli = pair<ll,int>;
using pil = pair<int,ll>;
using pll = pair<ll,ll>;
template <typename T> using vec = vector<T>;
using vi = vec<int>;
using vl = vec<ll>;
template <typename T> using que = queue<T>;
template <typename T> using deq = deque<T>;

template <typename T> T id(T b) {return b;};
template <typename T> void chmax(T &x, T y) {if (x < y) x = y;}
template <typename T> void chmin(T &x, T y) {if (x > y) x = y;}
template <typename S, typename K> bool contains(S &s, K k) { return s.find(k) != s.end(); }
void fastio() { ios_base::sync_with_stdio(false); cin.tie(nullptr); }
constexpr ll TEN(int n) { if (n == 0) return 1LL; else return 10LL*TEN(n-1); }
template <typename T> using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
template <typename K, typename V> using ordered_map = tree<K, V, less<K>, rb_tree_tag, tree_order_statistics_node_update>;
// clang-format on

int main() {
    fastio();

    int n, m, k;
    cin >> n >> m >> k;
    vec<bool> r(n + 1, false);
    forn(i, k) {
        int x;
        cin >> x;
        r[x] = true;
    }

    vec<pair<double, double>> dp(n + m);

    pair<double, double> s = { 0.0, 0.0 };
    for (int i = n - 1; i >= 0; i--) {
        if (r[i])
            dp[i] = mp(1.0, 0.0);
        else {
            dp[i].fst += s.fst / m;
            dp[i].snd += s.snd / m;
            dp[i].snd += 1;
        }

        if (i + m <= n) {
            s.fst -= dp[i + m].fst;
            s.snd -= dp[i + m].snd;
        }
        s.fst += dp[i].fst;
        s.snd += dp[i].snd;
    }

    auto [a, b] = dp[0];

    if (abs(a - 1.0) <= 1e-6) {
        cout << "-1\n";
    } else {
        cout << fixed << setprecision(10) << b / (1.0 - a) << endl;
    }

    return 0;
}

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

int n, m, k;
vector<long long> a, nxt;

long double solve();
bool check(long double e);

int main() {
  cin >> n >> m >> k;
  a.resize(k);
  for (auto &p : a) cin >> p;
  cout << fixed << setprecision(10);
  auto res = solve();
  if (res < 0)
    cout << "-1" << endl;
  else
    cout << solve() << endl;
  return 0;
}

long double solve() {
  nxt.resize(n + m + 1);
  for (int i = 0; i < n + m + 1; ++i) {
    nxt[i] = i + m;
    for (int j = 0; j < k; ++j)
      if (i <= a[j]) nxt[i] = min(nxt[i], a[j]);
  }
  for (int i = 0; i < k;) {
    int now = a[i], cnt = 0;
    while (i < k && now == a[i]) ++i, ++now, ++cnt;
    if (cnt >= m) return -1;
  }
  long double l = 0, r = 1e18;
  for (int t = 0; t < 200; ++t) {
    long double mid = (l + r) / 2;
    if (check(mid))
      r = mid;
    else
      l = mid;
  }
  return r;
}

bool check(long double e) {
  vector<long double> dp(n + m, 0);
  long double now = 0;
  for (int i = n - 1; i >= 0; --i) {
    if (nxt[i] == i)
      dp[i] = e;
    else
      dp[i] = 1 + now / m;
    now += dp[i];
    now -= dp[i + m];
  }
  return dp[0] <= e;
}


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

int main(){
    double X,Y,Z,ans;
    double price_per_gram;
    cin >> X >> Y >> Z;
    ans = 1000001.0;
    price_per_gram = (double) (Y/X);
    while (1){
        if((double)(ans/Z)>=price_per_gram){
            ans-=1.0;
        }
        else{
            break;
        }
    }
    cout << ans << endl;
}

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

ll func(int n, int k){
    return max(0, min(k - 1, 2*n + 1 - k));
}

int main(){
    int n,k;
    cin >> n >> k;
    ll ans = 0;
    rep(i,2,2*n+1){
        ans += func(n, k + i) * func(n, i);
    }
    cout << ans << endl;
}


#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{
	int x,y;
	cin>>x>>y;
	cout<<(x+y)/2<<' '<<(x-y)/2<<endl;
	return 0;
}

#include <bits/stdc++.h>
using namespace std;
#define MOD 1000000007
#include <map>
typedef long long ll;
#define REP(i, n) for(ll i = 0; i < n; i++)
#define REPR(i, n) for(ll i = n; i >= 0; i--)
#define FOR(i, m, n) for(ll i = m; i < n; i++)
#define INF 2e9
#define ALL(v) v.begin(), v.end()
using Graph = vector<vector<int>>;

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;
}
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;
    //cout << u << endl;
    return u;
}

ll paty_counter(ll level, ll x){
    ll size = pow(2, level+2) - 3;
    ll pmi = pow(2, level) - 1;
    if(x == 0){
        return 0;
    }else if(level == 0){
        return 1;
    }else{
        if(x <= (size - 1)/2){
            return paty_counter(level-1, x-1);
        }else{
            return pmi + 1 + paty_counter(level-1, x - pow(2, level+1) + 3 - 2);
        }
    }

}

using namespace std;
using Graph = vector<vector<int>>;

// 深さ優先探索
vector<bool> seen;
static ll x;
void dfs(const Graph &G, int v) {
    seen[v] = true;
    for (auto next_v : G[v]) {
        if (seen[next_v]) continue;
        dfs(G, next_v); // 再帰的に探索
        x ++;
    }
}

ll fr(ll n){
    ll ans = 1;
    REP(i, n){
        ans *= i+1;
        ans %= MOD;
    }
    return ans;
}

ll conb(ll n, ll k){
    return fr(n)% MOD * modinv(fr(k) * fr(n-k) % MOD, MOD) % MOD;
}

//bfs

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

}


#pragma region
#include <algorithm>
#include <iostream>
#include <math.h>
#include <string>
#include <vector>
using namespace std;
#define FOR(i, l, r) for(size_t i = (l); i < (r); ++i)
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define rrep(i, n) for(int i = (n)-1; i >= 0; --i)
#define ull unsigned long long
#define ll long long
#define ul unsigned long
template < class T > using vec2d = vector< vector< T > >;
#pragma endregion
ll k_num(int num) {
    vector< int > nums;
    while(num != 0) {
        nums.push_back(num % 10);
        num /= 10;
    }
    sort(nums.begin(), nums.end());
    int n = nums.size();
    ll res = 0;
    ll l = 1;
    ll r = pow(10, n - 1);
    rep(i, n) {
        res += (l - r) * nums[i];
        l *= 10;
        r /= 10;
    }
    return res;
}
ll k_num(vector< int > nums) {
    sort(nums.begin(), nums.end());
    int n = nums.size();
    ll res = 0;
    ll l = 1;
    ll r = pow(10, n - 1);
    rep(i, n) {
        res += (l - r) * nums[i];
        l *= 10;
        r /= 10;
    }
    return res;
}
int main() {
    string S;
    cin >> S;
    vector< int > nums(S.size());
    rep(i, S.size()) { nums[i] = S[i] - '0'; }

    ul K;
    cin >> K;
    if(K == 0) {
        cout << S << endl;
        return 0;
    }
    ull num = k_num(nums);
    FOR(i, 1, K) { num = k_num(num); }
    cout << num << endl;
    return 0;
}

#include<bits/stdc++.h>
using namespace std;
int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);

    string n;
    int k;
    cin>>n>>k;
    string s{n},r{};
    for(int i=0;i<k;i++)
    {

        sort(s.begin(),s.end());
        r=s;
        reverse(r.begin(),r.end());
        s=to_string(stoi(r)-stoi(s));
    }
    cout<<s<<endl;
     return 0;
}


#include "iostream"
#include "climits"
#include "list"
#include "queue"
#include "stack"
#include "set"
#include "functional"
#include "algorithm"
#include "string"
#include "map"
#include "unordered_map"
#include "unordered_set"
#include "iomanip"
#include "cmath"
#include "random"
#include "bitset"
#include "cstdio"
#include "numeric"
#include "cassert"
#include "ctime"

using namespace std;

//constexpr long long int MOD = 1000000007;
//constexpr int MOD = 1000000007;
//constexpr int MOD = 998244353;
constexpr long long int MOD = 998244353;
constexpr double EPS = 1e-12;

//int N, M, K, T, H, W, L, R;
long long int N, M, K, T, H, W, L, R;

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

	cin >> N >> M;
	while (N) {
		L += N % 10;
		N /= 10;
	}
	while (M) {
		R += M % 10;
		M /= 10;
	}
	cout << max(L, R) << endl;
}

#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define chmin(x,y) x = min((x),(y))
#define chmax(x,y) x = max((x),(y))
#define popcount(x) __builtin_popcount(x)
using namespace std;
using ll = long long ;
using P = pair<int,int> ;
using pll = pair<long long,long long>;
const int INF = 1e9;
const long long LINF = 1e17;
//const int MOD = 1000000007;
const int MOD = 998244353;
const double PI = 3.14159265358979323846;

template<int mod> struct ModInt{
    long long x=0;
    constexpr ModInt(long long x=0):x((x%mod+mod)%mod){}
    constexpr ModInt operator+(const ModInt& r)const{return ModInt(*this)+=r;}
    constexpr ModInt operator-(const ModInt& r)const{return ModInt(*this)-=r;}
    constexpr ModInt operator*(const ModInt& r)const{return ModInt(*this)*=r;}
    constexpr ModInt operator/(const ModInt& r)const{return ModInt(*this)/=r;}
    constexpr ModInt& operator+=(const ModInt& r){ if((x+=r.x)>=mod) x-=mod; return *this;}
    constexpr ModInt& operator-=(const ModInt& r){ if((x-=r.x)<0) x+=mod; return *this;}
    constexpr ModInt& operator*=(const ModInt& r){ if((x*=r.x)>=mod) x%=mod; return *this;}
    constexpr ModInt& operator/=(const ModInt& r){ return *this*=r.inv();}
    constexpr bool operator==(const ModInt& r){ return x == r.x;}
    constexpr bool operator!=(const ModInt& r){ return x != r.x;}
    ModInt inv() const {
        long long s=x,sx=1,sy=0,t=mod,tx=0,ty=1;
        while(s%t!=0){
            long long temp=s/t,u=s-t*temp,ux=sx-temp*tx,uy=sy-temp*ty;
            s=t;sx=tx;sy=ty;
            t=u;tx=ux;ty=uy;
        }
        return ModInt(tx);
    }
    ModInt pow(long long n) const {
        ModInt a=1;
        ModInt b=*this;
        while(n>0){
            if(n&1) a*=b;
            b*=b;
            n>>=1;
        }
        return a;
    }
    friend constexpr ostream& operator<<(ostream& os,const ModInt<mod>& a) {return os << a.x;}
    friend constexpr istream& operator>>(istream& is,ModInt<mod>& a) {return is >> a.x;}
};
using mint = ModInt<MOD>;

struct combination{
    int N;
    vector<mint> fac,finv,inverse;
    combination(int N):N(N){
        fac.resize(N+1);finv.resize(N+1);
        fac[0]=1;
        for(int i=1;i<=N;++i){fac[i]=fac[i-1]*i;}
        finv[N]=fac[N].inv();
        for(int i=N-1;i>=0;--i){finv[i]=finv[i+1]*(i+1);}
    }
    void inverse_build(){
        inverse.resize(N+1);
        inverse[1]=1;
        for(int i=2;i<=N;++i){inverse[i]=finv[i]*fac[i-1];}
    }
    mint c(int n,int k){
        if(n<k||n<0||k<0) return 0;
        return fac[n]*finv[n-k]*finv[k];
    }
    mint p(int n,int k){
        if(n<k||n<0||k<0) return 0;
        return fac[n]*finv[n-k];
    }
};

mint p[5005][5005]; // pp[i][j] = i^j

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

    for(int i=0;i<5005;i++){
        p[i][0] = 1;
        for(int j=1;j<5005;j++){
            p[i][j] = p[i][j-1] * i;
        }
    }

    mint ans = mint(m).pow(n);
    for(int i=1;i<n;i++){
        mint res = 0;
        for(int j=1;j<=m;j++){
            // j ... j
            int k = n-(i+1);
            res += (p[m-j+1][i] - p[m-j][i]) * (j-1) * p[m][k] * 2;
            k --;
            k = max(k,0);
            res += (p[m-j+1][i] - p[m-j][i]) * (j-1) * (j-1) * p[m][k] * (n-i-1);
        }
        ans += res;
    }
    cout << ans << endl;
    return 0;
}


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

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

    long double X,Y,R; cin >> X >> Y >> R;
    R = nextafter(R, INFINITY);
    ll ans = 0;
    for(ll x = ceil(X - R); x <= floor(X + R); x++){
        long double dist = sqrt(R * R - (X - x) * (X - x));
        ans += floor(Y + dist) - ceil(Y - dist) + 1;
    }
    cout << ans << endl;
}

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

typedef tree<int, null_type, less<int>, rb_tree_tag,
             tree_order_statistics_node_update>
    ordered_set;
#define pf                  printf
#define sf(a)               scanf("%d",&a)
#define sfl(a)              scanf("%lld",&a)
#define sff(a,b)            scanf("%d %d",&a,&b)
#define sffl(a,b)           scanf("%lld %lld",&a,&b)
#define sfff(a,b,c)         scanf("%d %d %d",&a,&b,&c)
#define sfffl(a,b,c)        scanf("%lld %lld %lld",&a,&b,&c)
#define sffff(a,b,c,d)      scanf("%d %d %d %d",&a,&b,&c,&d)
#define sffffl(a,b,c,d)     scanf("%lld %lld %lld %lld",&a,&b,&c,&d)
#define sfffff(a,b,c,d,e)   scanf("%d %d %d %d %d",&a,&b,&c,&d,&e)
#define sfffffl(a,b,c,d,e)  scanf("%lld %lld %lld %lld %lld",&a,&b,&c,&d,&e)
#define sfc(a)              scanf("%c",&a)
#define pii                 pair<int,int>
#define ms(a,b)             memset(a,b,sizeof(a))
#define pb(a)               push_back(a)
#define pbp(a,b)            push_back({a,b})
#define db                  double
#define ft                  float
#define ll                  long long
#define ull                 unsigned long long
#define pii                 pair<int,int>
#define ff                  first
#define ss                  second
#define sz(x)               x.size()
#define all(x)              x.begin(),x.end()
#define CIN                 ios_base::sync_with_stdio(0); cin.tie(0)
#define max3(a, b, c)       max(a, b) > max(b, c) ? max(a, b) : max(b, c)
#define min3(a, b, c)       min(a, b) < min(b, c) ? min(a, b) : min(b, c)
#define for0(i,n)           for(int i=0;i<n;i++)
#define for1(i,n)           for(int i=1;i<=n;i++)
#define forrev(i,n)         for(int i=n-1; i>=0; i--)
#define forab(i,a,b)        for(int i=a;i<=b;i++)
#define forba(i,b,a)        for(int i=b;i>=a;i--)
#define stlloop(x)          for(__typeof(x.begin()) it=x.begin();it!=x.end();it++)
#define gcd(a, b)           __gcd(a, b)
#define lcm(a, b)           ((a)*((b)/gcd(a,b)))
#define case1(z)            cout<<"Case "<<z<<": "
#define case2(z)            printf("Case %d: ",z)
#define PI                  acos(-1) //3.14159265358979323846264338328
#define valid(tx,ty)        tx>=0 && tx<row && ty>=0 && ty<col
#define intlim              2147483648
#define N                   200005
#define inf                 100000000008
#define mod                 1000000007

/*------------------------------Graph Moves----------------------------*/
//const int fx[]={+1,-1,+0,+0};
//const int fy[]={+0,+0,+1,-1};
//const int fx[]={+0,+0,+1,-1,-1,+1,-1,+1};   // Kings Move
//const int fy[]={-1,+1,+0,+0,+1,+1,-1,-1};  // Kings Move
//const int fx[]={-2, -2, -1, -1,  1,  1,  2,  2};  // Knights Move
//const int fy[]={-1,  1, -2,  a2, -2,  2, -1,  1}; // Knights Move
/*---------------------------------------------------------------------*/

ll a[105][105];

int main()
{
    ll h,w,mn = inf,ans = 0;
    cin>>h>>w;
    for1(i,h)
    {
        for1(j,w)
        {
            cin>>a[i][j];
            mn = min(a[i][j],mn);
        }
    }
    for1(i,h)
    {
        for1(j,w)
        {
            ans += (abs(mn-a[i][j]));
        }
    }
    cout<<ans<<endl;
    return 0;
}