#include<bits/stdc++.h>
using namespace std;
#define pb emplace_back
#define pf first
#define ps second
#define all(x) x.begin(),x.end()
#define allr(x) x.rbegin(),x.rend()
#define Endl '\n'
#define codejam cout<<"Case #"<<t<<": ";
#define PI 3.141592653589793238462
#define sz(x) ((int)(x).size())
#define mod 1000000007
#define forn(i,n) for(ll i=0;i<n;i++)
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);
typedef long long int ll;
typedef unsigned long long int ull;
typedef long double lld;

//////////////////////////////////// DEBUGGER ///////////////////////////////////////////
#ifndef ONLINE_JUDGE
#define debug(x) cerr << #x <<" "; debugger(x); cerr << endl;
#else
#define debug(x)
#endif
void debugger(ll t) {cerr << t;}void debugger(int t) {cerr << t;}void debugger(string t) {cerr << t;}void debugger(char t) {cerr << t;}void debugger(lld t) {cerr << t;}void debugger(double t) {cerr << t;}void debugger(ull t) {cerr << t;}template <class T, class V> void debugger(pair <T, V> p);template <class T> void debugger(vector <T> v);template <class T> void debugger(set <T> v);template <class T, class V> void debugger(map <T, V> v);template <class T> void debugger(multiset <T> v);template <class T, class V> void debugger(pair <T, V> p) {cerr << "{"; debugger(p.pf); cerr << ","; debugger(p.ps); cerr << "}";}template <class T> void debugger(vector <T> v) {cerr << "[ "; for (T i : v) {debugger(i); cerr << " ";} cerr << "]";}template <class T> void debugger(set <T> v) {cerr << "[ "; for (T i : v) {debugger(i); cerr << " ";} cerr << "]";}template <class T> void debugger(multiset <T> v) {cerr << "[ "; for (T i : v) {debugger(i); cerr << " ";} cerr << "]";}template <class T, class V> void debugger(map <T, V> v) {cerr << "[ "; for (auto i : v) {debugger(i); cerr << " ";} cerr << "]";}
ll gcd(ll a,ll b) {if(b==0 || a==0) return max(a,b);return gcd(b,a%b);}

//////////////////////////////////// JAI SHREE RAM /////////////////////////////////////
const ll N=1e5+5;

void JAISHREERAM()
{
    ll n,ans=0;
    cin>>n;
    vector<pair<double,double>> a(n);
    forn(i,n)
    {
        ll x;
        cin>>x>>a[i].pf>>a[i].ps;
        if(x==2)  a[i].ps-=0.000001;
        else if(x==3) a[i].pf+=0.000001;
        else if(x==4) a[i].pf+=0.000001,a[i].ps-=0.000001;
    }
    n=sz(a);
    sort(all(a));
    forn(i,n)
    {
        for(int j=i+1;j<n;j++)
        {
            if(a[j].pf>a[i].ps) continue;
            ans++;
        }
    }
    cout<<ans;
}
int main()
{
    fast;
    int T=1;
    // cin>>T;
    for(int t=1;t<=T;t++)
    {
        // codejam
        JAISHREERAM();
    }
    return 0;
}

#include<iostream>
#include<iomanip>
#include<cstdio>
#include<cstring>
#include<cmath>
#include<cinttypes>
#include<vector>
#include<algorithm>
#include<map>
#include<set>
#include<queue>
#include<string>
#include<stack>

#define FSCNd64 "%" SCNd64
#define FPRId64 "%" PRId64

using namespace std;

using ll=long long;
using vi=vector<int>;
using vvi=vector<vi>;
using pii=pair<int,int>;
using vll=vector<ll>;
using vvll=vector<vll>;
using vpii=vector<pii>;

#define PI 3.1415926535897932384626433832795

template<typename X>
bool max_u(X&m, X v)
{
	if(m<v)
	{
		m=v;
		return true;
	}
	return false;
}

template<typename X>
bool min_u(X&m, X v)
{
	if(m>v)
	{
		m=v;
		return true;
	}
	return false;
}

struct solve
{
	solve(){}
	ll operator()() {
		return 0;
	}
};

struct range_t
{
	int l, r;
};

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

	int n;

	for(;;)
	{
		cin >> n;
		if(cin.fail()) break;
		vpii range(n);
		for(int i=0;i<n;i++)
		{
			int t, l, r;
			cin >> t >> l >> r;
			l*=2;
			r*=2;
			switch(t)
			{
				case 1: break;
				case 2: r--; break;
				case 3: l++; break;
				case 4: l++; r--; break;
			}
			range[i]=make_pair(l, r);
		}
		sort(range.begin(), range.end());

		int ans=0;
		for(int i=0;i<n;i++)
		{
			for(int j=i+1;j<n;j++)
			{
				if(range[i].second>=range[j].first) ans++;
			}
		}
		cout << ans << "\n";
	}
	return 0;
}


// Enjoy your stay. Code by evima

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

using ld = long double;
using ll = long long;
using lll = __int128;
using vl = vector<ll>;
using LOOPVAR_TYPE = ll;

#define all(x) (x).begin(), (x).end()
#define sq(x) ((x) * (x))
#define sz(x) ll((x).size())
#define GET_MACRO(_1, _2, _3, NAME, ...) NAME
#define rep1(i, n) rep2(i, 0, n)
#define rep2(i, a, b) for(LOOPVAR_TYPE i = LOOPVAR_TYPE(a); i < LOOPVAR_TYPE(b); i++)
#define rep(...) GET_MACRO(__VA_ARGS__, rep2, rep1)(__VA_ARGS__)

#define eb emplace_back
#define fir first
#define sec second
#define mp make_pair
#define mt make_tuple

const ld EPS = 1e-9;
const ld PI = 3.14159265358979323846L;
const ll INF = 1070000000LL;
const ll MOD = 998244353LL;// 1000000007LL;

void fast_io() { cin.tie(NULL); ios_base::sync_with_stdio(false); }
ll lin() { ll x; cin >> x; return x; }
string input() { string s; cin >> s; return s; }
vl vin(int n) { vector<ll> v(n); rep(i, n) cin >> v[i]; return v; }
template<class T> bool chmin(T& a, const T& b) { return (b < a) ? (a = b, true) : false; }
template<class T> bool chmax(T& a, const T& b) { return (a < b) ? (a = b, true) : false; }
template<class T> map<T, ll> freq(const vector<T>& v){ map<T, ll> ret; for(T x: v) ++ret[x]; return ret; }
template<class T> vector<T> reversed(vector<T> v) { reverse(all(v)); return v; }
template<class T> vector<T> sorted(vector<T> v) { sort(all(v)); return v; }
template<class T> vector<T> sub(const vector<T>& v, int from, int to) { vector<T> ret; copy(&v[from], &v[to], back_inserter(ret)); return ret; }
template<class T> string str(const T& x, int prec = 20) { stringstream ss; ss << setprecision(prec) << x; return ss.str(); }
template<class T> string str(const vector<T>& v, int prec = 20) { stringstream ss; ss << setprecision(prec); rep(i, sz(v)) ss << v[i] << (i < sz(v) - 1 ? " " : ""); return ss.str(); }
template<class T> void print1(T&& x, const string& end) { cout << str(x) << end; }
void print() { print1("", "\n"); }
template<class T, class... U> void print(T&& head, U&&... tail) { print1(head, " "); print(forward<U>(tail)...); }
template<class T> void eprint1(T&& x, const string& end) { cout << str(x) << end; }
void eprint() { eprint1("", "\n"); }
template<class T, class... U> void eprint(T&& head, U&&... tail) { eprint1(head, " "); eprint(forward<U>(tail)...); }
template<class... T> void quit(T&&... x) { print(forward<T>(x)...); exit(0); }
void yn(bool cnd, const string& yes = "Yes", const string& no = "No") { if(cnd) print(yes); else print(no); }
void zip(vl& v) { vl w = v; sort(all(w)); int n = unique(all(w)) - w.begin(); for(ll& x: v) x = lower_bound(&w[0], &w[n], x) - &w[0]; }
vl zipped(vl v) { zip(v); return v; }
map<ll, ll> zipmap(vl v) { map<ll, ll> ret; sort(all(v)); v.erase(unique(all(v)), v.end()); rep(i, sz(v)) ret[v[i]] = i; return ret; }

ll N, M, w[8], l[100010], v[100010];
pair<ll, ll> p[100010];

ll dp[8];
ll solve(vl u){
    fill(dp, dp + N, 0);
    rep(i, N){
        ll sum = u[i];
        rep(j, i + 1, N){
            sum += u[j];
            int pos = lower_bound(v, v + M + 1, sum) - v - 1;
            chmax(dp[j], dp[i] + l[pos]);
        }
    }
    return dp[N - 1];
}

void solveOne(){
    cin >> N >> M;
    rep(i, N) cin >> w[i];
    ll maxw = *max_element(w, w + N);
    rep(i, M){
        cin >> l[i] >> v[i];
        if(v[i] < maxw) quit(-1);
    }

    rep(i, M) p[i] = {v[i], l[i]};
    sort(p, p + M + 1);
    rep(i, M) chmax(p[i + 1].sec, p[i].sec);
    rep(i, M + 1) v[i] = p[i].fir, l[i] = p[i].sec;
    ll ans = INF;
    vl perm(N);
    rep(i, N) perm[i] = i;
    do{
        vl u(N);
        rep(i, N) u[i] = w[perm[i]];
        chmin(ans, solve(u));
    }while(next_permutation(all(perm)));
    print(ans);
}

int main(){
    fast_io();

    int num_tc = 1;
    // cin >> num_tc;

    rep(tc, 1, num_tc + 1){
        // cout << "Case #" << tc << ": " ;// << endl;
        solveOne();
    }
}

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

using namespace std;
// using namespace atcoder;

using ll = long long;
using ld = long double;
using P = pair<int, int>;
constexpr ld eps = 1e-12;
constexpr int inf = numeric_limits<int>::max() / 2;
constexpr ll mod = 1e9 + 7;
mt19937_64 rnd{random_device()()};

template <typename T>
void printv(const vector<T> &v) {
  int sz = v.size();
  for (int i = 0; i < sz; i++) {
    cout << v[i] << " \n"[i == sz - 1];
  }
}

const int MAX_L = 100000010;
vector<int> cap(MAX_L, inf);

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

  int n, m;
  cin >> n >> m;
  vector<int> w(n);
  for (int i = 0; i < n; i++) {
    cin >> w[i];
  }
  sort(w.begin(), w.end());
  for (int i = 0; i < m; i++) {
    int l, v;
    cin >> l >> v;
    cap[l - 1] = min(cap[l - 1], v);
  }
  for (int i = MAX_L - 2; i >= 0; i--) {
    cap[i] = min(cap[i], cap[i + 1]);
  }
  {
    auto ma = *max_element(w.begin(), w.end());
    if (cap[0] < ma) {
      cout << -1 << endl;
      return 0;
    }
  }
  ll ans = 1e15;
  do {
    vector<vector<ll>> sum(n, vector<ll>(n));
    for (int i = 0; i < n; i++) {
      for (int j = i; j < n; j++) {
        for (int k = i; k <= j; k++) sum[i][j] += w[k];
      }
    }
    vector<vector<ll>> dp(n, vector<ll>(n, 0));
    for (int len = 1; len <= n - 1; len++) {
      for (int x = 0; x + len < n; x++) {
        int y = x + len;
        ll mi = 0;
        for (int k = x + 1; k < y; k++) {
          mi = max(mi, dp[x][k] + dp[k][y]);
        }
        auto itr = lower_bound(cap.begin(), cap.end(), sum[x][y]);
        int pos = distance(cap.begin(), itr);
        dp[x][y] = max(mi, ll(pos));
      }
    }
    ans = min(ans, dp[0][n - 1]);
  } while (next_permutation(w.begin(), w.end()));
  cout << ans << endl;
}


//Har Har Mahadev
using namespace std;
#include <bits/stdc++.h>
#define booga cerr << "booga" << endl
#define int long long
#define ld long double
#define pb push_back
#define mp make_pair
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#define safai(...) Clearing_out(__VA_ARGS__)

template <typename A, typename B>
	string to_string(pair<A, B> p);

template <typename A, typename B, typename C>
	string to_string(tuple<A, B, C> p);

template <typename A, typename B, typename C, typename D>
	string to_string(tuple<A, B, C, D> p);

string to_string(const string& s) {
	return '"' + s + '"';
}

string to_string(char c) {
	string s;
	s += c;
	return s;
}

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

string to_string(bool b) {
	return (b ? "1" : "0");
}

string to_string(vector<bool> v) {
	bool first = true;
	string res = "{";
	for (int i = 0; i < static_cast<int>(v.size()); i++) {
	if (!first) {
		res += ", ";
	}
	first = false;
	res += to_string(v[i]);
	}
	res += "}";
	return res;
}

template <size_t N>
string to_string(bitset<N> v) {
	string res = "";
	for (size_t i = 0; i < N; i++) {
		res += static_cast<char>('0' + v[i]);
	}
	return res;
}

template <typename A>
string to_string(A v) {
	bool first = true;
	string res = "{";
	for (const auto &x : v) {
		if (!first) {
			res += ", ";
		}
		first = false;
		res += to_string(x);
	}
	res += "}";
	return res;
}

template <typename A, typename B>
string to_string(pair<A, B> p) {
	return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";
}

template <typename A, typename B, typename C>
string to_string(tuple<A, B, C> p) {
	return "(" + to_string(get<0>(p)) + ", " + to_string(get<1>(p)) + ", " + to_string(get<2>(p)) + ")";
}

template <typename A, typename B, typename C, typename D>
string to_string(tuple<A, B, C, D> p) {
	return "(" + to_string(get<0>(p)) + ", " + to_string(get<1>(p)) + ", " + to_string(get<2>(p)) + ", " + to_string(get<3>(p)) + ")";
}

void debug_out() { cerr << endl; }

template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
	cerr << " " << to_string(H);
	debug_out(T...);
}

void Clearing_out() { return; }

template <typename Head, typename... Tail>
void Clearing_out(Head &H, Tail & ... T) {
	H.clear();
	Clearing_out(T...);
}
int dp[61][61];
int NCR(int n, int r)
{
	if(dp[n][r] != -1) return dp[n][r];
    if (r == 0) return dp[n][r] = 1;

    /*
     Extra computation saving for large R,
     using property:
     N choose R = N choose (N-R)
    */
    if (r > n / 2) return dp[n][r] = NCR(n, n - r);

    int res = 1;

    for (int k = 1; k <= r; ++k)
    {
        res *= n - k + 1;
        res /= k;
    }

    return dp[n][r] = res;
}

void testcase(){
	memset(dp, -1, sizeof(dp));
	for(int i = 1; i <= 60; i++){
		for(int j = 1; j <= i; j++){
			NCR(i, j);
		}
	}
	//cout << NCR(3, 2);
	dp[0][0] = 1;
	int a, b, k;
	cin >> a >> b >> k;
	string ans;
	int sz = a+b;
	function<void()> solve = [&](){
		if(sz == ans.size()) return;
		int sub = 0;
		int i = 0;
		for(i = 1; i <= a; i++){
			if(sz == ans.size()) return;
			int lol = dp[a+b-i][b];
			if(i == 30) debug(k, lol, a+b-i, b);
		//	debug(lol, k, a+b-i, b);
			if(k <= lol) ans.push_back('a');
			else{
				sub = lol;
				break;
			}
		}

		a -= (i-1);
		k -= sub;
		if(ans.size() == sz) return;
		ans.push_back('b'), b--;
		//debug(a, b);
		solve();
	};
	solve();

	//debug(nb, ans.size());
	cout << ans << '\n';
}

int32_t main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	int tt = 1;
//	cin >> tt;
	while(tt--){
		testcase();
	}
	return 0;
}

#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2,fma,avx512f,avx512bw,avx512bitalg")
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")

//雪花飄飄北風嘯嘯
//天地一片蒼茫

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/rope>
using namespace std;
using namespace __gnu_pbds;
using namespace __gnu_cxx;
#define ll long long
#define ii pair<ll,ll>
#define iii pair<ii,ll>
#define fi first
#define se second
#define endl '\n'
#define debug(x) cout << #x << " is " << x << endl

#define pub push_back
#define pob pop_back
#define puf push_front
#define pof pop_front
#define lb lower_bound
#define ub upper_bound

#define rep(x,start,end) for(int x=start;x!=end;x++)
#define all(x) (x).begin(),(x).end()
#define sz(x) (int)(x).size()

#define indexed_set tree<ll,null_type,less<ll>,rb_tree_tag,tree_order_statistics_node_update>
//change less to less_equal for non distinct pbds, but erase will bug

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

int B,m;
bool bad[25][25];

int ind[1050000];

int ahat[1050000][21];
int bhat[1050000][21];
ll hat[1050000][21];

void conv(){
	for (int x=0;x<1048576;x++) {
		ahat[x][__builtin_popcount(x)]=ind[x];
		bhat[x][__builtin_popcount(x)]=ind[x];
	}

	rep(bit,0,20){
		for (int x=0;x<1048576;x++) if (x&(1<<bit)){
			rep(cnt,0,21){
				ahat[x][cnt]+=ahat[x^(1<<bit)][cnt];
				bhat[x][cnt]+=bhat[x^(1<<bit)][cnt];
			}
		}
	}

	for (int x=0;x<1048576;x++){
		rep(cnt,0,21){
			rep(cnt2,0,cnt+1){
				hat[x][cnt]+=(ll)ahat[x][cnt2]*bhat[x][cnt-cnt2];
			}
		}
	}

	rep(bit,0,20){
		for (int x=0;x<1048576;x++) if (x&(1<<bit)){
			rep(cnt,0,21){
				hat[x][cnt]-=hat[x^(1<<bit)][cnt];
			}
		}
	}

    memset(ahat,0,sizeof(ahat));
	memset(bhat,0,sizeof(bhat));

	for (int x=0;x<1048576;x++){
		ahat[x][__builtin_popcount(x)]=ind[x];
		bhat[x][__builtin_popcount(x)]=hat[x][__builtin_popcount(x)];
	}

	memset(hat,0,sizeof(hat));

	rep(bit,0,20){
		for (int x=0;x<1048576;x++) if (x&(1<<bit)){
			rep(cnt,0,21){
				ahat[x][cnt]+=ahat[x^(1<<bit)][cnt];
				bhat[x][cnt]+=bhat[x^(1<<bit)][cnt];
			}
		}
	}

	for (int x=0;x<1048576;x++){
		rep(cnt,0,21){
			rep(cnt2,0,cnt+1){
				hat[x][cnt]+=(ll)ahat[x][cnt2]*bhat[x][cnt-cnt2];
			}
		}
	}

	rep(bit,0,20){
		for (int x=0;x<1048576;x++) if (x&(1<<bit)){
			rep(cnt,0,21){
				hat[x][cnt]-=hat[x^(1<<bit)][cnt];
			}
		}
	}
}

int main(){
	ios::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	cin.exceptions(ios::badbit | ios::failbit);

	cin>>B>>m;

	int a,b;
	rep(x,0,m){
		cin>>a>>b;
		a--,b--;
		bad[a][b]=bad[b][a]=true;
	}

	ind[0]=1;
	rep(x,1,1<<B){
		int temp=__builtin_ctz(x);
		int nx=x^(1<<temp);

		ind[x]=ind[nx];

		rep(bit,0,B) if (nx&(1<<bit) && bad[temp][bit]){
			ind[x]=0;
		}
	}

	conv();

	cout<<hat[(1<<B)-1][B]<<endl;
}


#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 ROF(i,x) for(int i = (x) ; i >= 0 ; --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(...) cerr << #__VA_ARGS__ << ": " << (__VA_ARGS__) << 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
}

#define SI() (cout << "Yes\n")
#define NO() (cout << "No\n")

void solve(){

}

int main() {
    READ(0);
    int n,k;cin>>n>>k;
    vvi a(n,vi(n));
    vi b(n*n);
    FOR(i,n){
        FOR(j,n) {
            cin>>a[i][j];
            b[i*n+j]=a[i][j];
        }
    }
    sort(all(b));
    int lo=0,hi=n*n-1;
    const int A=(k*k+1)/2;
    while(lo<hi){
        int mid=(lo+hi)/2;
        vvi x(n,vi(n));
        FOR(i,n)FOR(j,n) x[i][j]=a[i][j]<=b[mid];
        for(int j=1;j<n;++j) x[0][j] += x[0][j-1];
        for(int i=1;i<n;++i) x[i][0] += x[i-1][0];
        for(int i=1;i<n;++i){
            for(int j=1;j<n;++j){
                x[i][j] += x[i-1][j] + x[i][j-1] - x[i-1][j-1];
            }
        }
        int cnt=-1;
        for(int i=k-1;i<n && cnt<A;++i){
            for(int j=k-1;j<n;++j){
                cnt = x[i][j];
                if (i-k>=0) cnt -= x[i-k][j];
                if (j-k>=0) cnt -= x[i][j-k];
                if (i-k>=0 && j-k>=0) cnt += x[i-k][j-k];
                if (cnt>=A) break;
            }
        }
        if (cnt>=A) hi=mid;
        else lo=mid+1;
    }
    cout << b[lo];

    return 0;
}

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

using namespace std;

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

	vector <vector <int> > a(n, vector <int> (n));

	for (int i = 0; i < n; i++)
		for (int j = 0; j < n; j++)
			cin >> a[i][j];

	int left = -1, right = 1000000000, mid;

	while (left < right - 1)
	{
		mid = (left + right) / 2;

		vector <vector <int> > b(n, vector <int> (n));

		for (int i = 0; i < n; i++)
			for (int j = 0; j < n; j++)
				b[i][j] = a[i][j] <= mid;

		vector <vector <int> > pref_sum(n, vector <int> (n));

		for (int i = 0; i < n; i++)
			for (int j = 0; j < n; j++)
				if (i == 0 && j == 0)
					pref_sum[0][0] = b[0][0];
				else if (i == 0)
					pref_sum[i][j] = pref_sum[i][j - 1] + b[i][j];
				else if (j == 0)
					pref_sum[i][j] = pref_sum[i - 1][j] + b[i][j];
				else
					pref_sum[i][j] = pref_sum[i - 1][j] + pref_sum[i][j - 1] - pref_sum[i - 1][j - 1] + b[i][j];

		int flag = 0;

		for (int i = 0; i + k <= n; i++)
			for (int j = 0; j + k <= n; j++)
			{
				int cur_sum;

				if (i == 0 && j == 0)
					cur_sum = pref_sum[k - 1][k - 1];
				else if (i == 0)
					cur_sum = pref_sum[k - 1][j + k - 1] - pref_sum[k - 1][j - 1];
				else if (j == 0)
					cur_sum = pref_sum[i + k - 1][k - 1] - pref_sum[i - 1][k - 1];
				else
					cur_sum = pref_sum[i + k - 1][j + k - 1] - pref_sum[i - 1][j + k - 1] - pref_sum[i + k - 1][j - 1] + pref_sum[i - 1][j - 1];

				if (cur_sum >= (k * k + 1) / 2)
					flag = 1;
			}

		if (flag)
			right = mid;
		else
			left = mid;
	}

	cout << right;
}


#include <bits/stdc++.h>

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

class rep {
    struct Iter {
        usize itr;
        constexpr Iter(const usize pos) noexcept : itr(pos) {}
        constexpr void operator++() noexcept { ++itr; }
        constexpr bool operator!=(const Iter& other) const noexcept { return itr != other.itr; }
        constexpr usize operator*() const noexcept { return itr; }
    };
    const Iter first, last;

  public:
    explicit constexpr rep(const usize first, const usize last) noexcept : first(first), last(std::max(first, last)) {}
    constexpr Iter begin() const noexcept { return first; }
    constexpr Iter end() const noexcept { return last; }
};

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

void main_() {
    usize N;
    std::cin >> N;
    Vec<usize> P(N);
    for (auto& x : P) {
        std::cin >> x;
        x -= 1;
    }
    if (std::is_sorted(P.begin(), P.end())) {
        std::cout << 0 << '\n';
        std::cout << '\n';
        return;
    }
    if (N == 2) {
        std::cout << 1 << '\n';
        std::cout << 1 << '\n';
        return;
    }
    Vec<usize> ans;
    ans.reserve(N * N);
    const auto add = [&](const usize i) {
        assert(ans.size() % 2 == i % 2);
        assert(i + 1 < N);
        ans.push_back(i);
        std::swap(P[i], P[i + 1]);
    };
    for (const auto i : rep(0, N - 3)) {
        usize k = 0;
        while (P[k] != i) {
            k += 1;
        }
        if (k == i) {
            continue;
        }
        std::cerr << k << std::endl;
        if (ans.size() % 2 != (k - 1) % 2) {
            if (k == N - 1) {
                add(k - 2);
            } else {
                add(k);
                add(k - 1);
                k += 1;
            }
        }
        while (k != i) {
            add(k - 1);
            k -= 1;
        }
    }
    std::array<usize, 2> idx;
    idx[0] = N - 3;
    idx[1] = N - 2;
    if (idx[0] % 2 != ans.size() % 2) {
        std::swap(idx[0], idx[1]);
    }
    while (!std::is_sorted(P.begin(), P.end())) {
        add(idx[0]);
        std::swap(idx[0], idx[1]);
    }
    assert(std::is_sorted(P.begin(), P.end()));
    assert(ans.size() <= N * N);
    std::cout << ans.size() << '\n';
    for (const auto i : rep(0, ans.size())) {
        if (i > 0) {
            std::cout << ' ';
        }
        std::cout << ans[i] + 1;
        assert(ans[i] % 2 == i % 2);
    }
    std::cout << '\n';
}

int main() {
    std::ios_base::sync_with_stdio(false);
    std::cin.tie(nullptr);
    usize cases;
    std::cin >> cases;
    while (cases--) main_();
    return 0;
}

#include<bits/stdc++.h>
#define LL long long
#define DB double
#define pb push_back
#define mkp make_pair
#define LB lower_bound
#define UB upper_bound
#define rint register int
#define MS(x,y) memset(x,y,sizeof(x))
#define rep(i,a,b) for(rint i=a,i##end=b;i<=i##end;++i)
#define drep(i,a,b) for(rint i=a,i##end=b;i>=i##end;--i)
#define cms printf("%.2lf\n",(&o2-&o1)/1024.0/1024)
using namespace std;bool o1;
char IO;
inline int Rd(){
	int _s_=0;
	bool _f_=0;
	while(!isdigit(IO=getchar()))
		IO=='-'&&(_f_=1);
	do _s_=(_s_<<1)+(_s_<<3)+(IO^48);
	while(isdigit(IO=getchar()));
	return _f_?-_s_:_s_;
}
int n,p,o,ans[250004],a[505],t,tt;
void DO(int x){
	ans[++o]=x;
	swap(a[x],a[x+1]);
	p^=1;
}
bool o2;int main(){
	rep(T,1,Rd()){
		n=Rd();
		rep(i,1,n)
			a[i]=Rd();
		if(n==2){
			if(a[1]==1)
				printf("0\n\n");
			else printf("1\n1\n");
			continue;
		}
		p=1;
		o=0;
		rep(i,1,n-2){
			if(a[i]==i)
				continue;
			rep(j,i+1,n)
				if(a[j]==i)
					t=j;
			if(t%2==p){
				if(t>i+1)
					DO(t-2);
				else {
					DO(t),DO(t-1);
					t++;
				}
			}
			drep(j,t-1,i)
				DO(j);
		}
		if(a[n]!=n){
			if(n%2==p){
				DO(n-2);
				DO(n-1);
				DO(n-2);
				DO(n-1);
				DO(n-2);
			}
			else DO(n-1);
		}
		printf("%d\n",o);
		rep(i,1,o)
			printf("%d ",ans[i]);
		puts("");
	}
	return 0;
}


/*
Author : Ritesh Singh
*/
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;
#define ll long long
#define ff first
#define ss second
#define f(i,n) for (int i=0;i<n;i++)
#define fa(i,a,b) for (int i=a;i<b;i++)
#define pb push_back
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define vi vector<int>
#define vll vector<long long>
#define pi pair<int,int>
#define all(x) x.begin(),x.end()
const ll inf = 1e9;
const ll mod = 1000000007;
typedef tree<pair<ll, int>, null_type, less<pair<ll, int>>, rb_tree_tag, tree_order_statistics_node_update> pbds;
//Ordered set
//pbds s1
int32_t main()
{
    fast;
    ll T;
    T = 1;
    // cin>>T;
    while(T--){
        ll n; cin>>n;
        ll arr[n];
        f(i, n) cin>>arr[i];

        ll ans = 0;
        f(i, n){
            ll x = arr[i], j;
            for(j = i; j<n; j++){
                x = min(x, arr[j]);
                ans = max(ans, x*(j-i+1));
            }
        }
        cout<<ans<<"\n";
    }
    return 0;
}

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

void solve(){
    int n;
    cin >> n;
    int arr[n];
    for(int i=0;i<n;i++){
        cin >> arr[i];
    }
    int ans = 0;
    for(int i=0;i<n;i++){
        int now = 0;
        for(int j=i;j>=0;j--){
            if(arr[j]>=arr[i])
                now+=arr[i];
            else
                break;
        }
        for(int j=i+1;j<n;j++){
            if(arr[j]>=arr[i]){
                now+=arr[i];
            }
            else{
                break;
            }
        }
        ans = max(ans,now);
    }
    cout << ans;
}

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);cout.tie(nullptr);
    #ifdef Local
    freopen("in.txt","r",stdin);
    freopen("out.txt","w",stdout);
    #endif
    int t=1;
    //cin>>t;
    while(t--){
        solve();
    }
    #ifdef Local
    cout<<endl<<fixed<<setprecision(2)<<1000.0 * clock() / CLOCKS_PER_SEC<< " milliseconds ";
    #endif
}


#include<cstdio>
#include<iostream>
#include<cstring>

using namespace std;

const int maxn=1e2+10;

int arr[maxn];
string s;
int n;
bool judge(int x){
    for(int i=0;i<n;i++){
        int a=arr[i]/x,b=arr[i+1]/x;
        int aa=arr[i]%x,bb=arr[i+1]%x;
        if(s[i]=='<'){
            if(a>=b) return false;
            if(b-a==1){
                if(aa>bb) return false;
            }
        }
        else{
            if(a<=b) return false;
            if(a-b==1){
                if(aa<bb) return false;
            }
        }
    }
    return true;
}
int main()
{
    cin>>n;
    cin>>s;

    for(int i=0;i<=n;i++) scanf("%d",arr+i);

    int l=0,r=20000;
    int x=0;

    while(l<=r){
        int mid=(l+r)>>1;
        //cout<<l<<","<<r<<":"<<mid<<endl;
        if(!mid||judge(mid)){
            x=max(x,mid);
            l=mid+1;
        }
        else r=mid-1;
    }
    printf("%d\n",x);
    for(int i=0;i<x;i++){
        for(int j=0;j<=n;j++)
            printf("%d ",arr[j]/x+(i<arr[j]%x));
        putchar('\n');
    }

    return 0;
}
/*
3
<><
3 8 6 10

3
<><
8 3 6 10
*/

#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
#define USE_LLONG_AS_INT
#ifdef USE_LLONG_AS_INT
#define int long long
#define inf (1ll<<60)
#else
#define inf (1<<30)
#endif
#define rep(i,n) for(int i=0;i<(n);i++)
#define Rep(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,a,b) for(int i=(a);i<=(b);i++)
#define rev(i,n) for(int i=(n)-1;i>=0;i--)
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define all(v) (v).begin(),(v).end()
#define fi first
#define se second
#define MEMSET(a) memset(a,0,sizeof(a))
#define Yes(f) cout<<(f?"Yes":"No")<<endl
#define yes(f) cout<<(f?"yes":"no")<<endl
#define YES(f) cout<<(f?"YES":"NO")<<endl
#define SORT(v) sort(all(v))
#define RSORT(v) sort(all(v), greater<int>())
#define sq(n) (n)*(n)

using namespace std;
using vi=vector<int>;
using vvi=vector<vi>;
using vs=vector<string>;
using pi=pair<int,int>;
using vp=vector<pi>;

const int mod=1e9+7;
// const int mod=998244353;
const string sp=" ";

void run();

void init() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout<<fixed<<setprecision(12);
}

signed main(){
    init();
    run();
    return 0;
}

void run(){
	int n;
	string s;
	cin>>n>>s;
	n++;
	vi a(n);
	rep(i,n)cin>>a[i];
	int k=inf;
	rep(i,n-1)k=min(k,abs(a[i]-a[i+1]));
	cout<<k<<endl;
	vvi b(k,vi(n));
	rep(j,n){
		rep(i,k)b[i][j]=a[j]/k;
		int t=a[j]%k;
		rep(i,t)b[i][j]++;
	}
	rep(i,k){
		rep(j,n)cout<<b[i][j]<<sp;cout<<endl;
	}
}


/*Author-Nilesh Chandra(isocyanide7)*/
#include <bits/stdc++.h>
using namespace std;
#define fio ios_base::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL);
#define ll long long
#define dd double
#define pb push_back
#define ff first
#define ss second
#define Mp make_pair
const ll Mod=1000000007;
const ll INF=999999999999999999;
const ll NN=(ll)(1e6+5);
ll min(ll x,ll y){if(x<y) return x;return y;}
ll max(ll x,ll y){if(x>y) return x;return y;}
ll power(ll x,unsigned ll y)
{
    if (y==0)
        return 1;
    else if (y%2==0)
        return power(x,y/2)*power(x,y/2);
    else
        return x*power(x,y/2)*power(x,y/2);
}
ll hcf(ll a,ll b)
{
    if(b==0)
        return a;
    return hcf(b,a%b);
}
int main()
{
   fio;
   /*#ifndef ONLINE_JUDGE
    	freopen("input.txt", "r", stdin);
    	freopen("output.txt", "w", stdout);
    	freopen("error.txt", "w", stderr);
   #endif*/
   ll TT=1;
   //cin>>TT;
   while(TT--)
   {
       ll n,i,j,ans=0;
       cin>>n;
       vector <ll> v(n);
       map <ll,ll> mp;
       for(auto &u:v)
        cin>>u,mp[u+200]++;
       for(i=0;i<=400;i++)
        for(j=i+1;j<=400;j++)
         ans+=mp[i]*mp[j]*(i-j)*(i-j);
       cout<<ans;
   }
}

//https://atcoder.jp/contests/zone2021/tasks/zone2021_c
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
bool chk(vector<vector<int>> &arr, int mid)
{
    int n=arr.size();
    set<int> st;
    for (int i = 0; i < n; i++)
    {
        int c=0;
        for (int j = 0; j < 5; j++)
        {
            int bit=0;
            if(arr[i][j]>=mid) bit=1;
            c+=(bit<<j);
        }
        st.insert(c);
    }
    for(auto e:st)
        for(auto f:st)
            for(auto g:st)
            {
                if((e|f|g)==31)
                    return 1;
            }
    return 0;
}
int main()
{
    ios::sync_with_stdio(false);
    cin.tie(NULL);
    int n;
    cin >> n;
    vector<vector<int>> arr(n, vector<int>(5, 0));
    for (int i = 0; i < n; i++)
    {
        for (int j = 0; j < 5; j++)
            cin >> arr[i][j];
    }

    int l = 1, r = 1e9 + 1;
    while (l < r)
    {
        int mid = (l + r)/2;
        if(chk(arr,mid))    l=mid+1;
        else r=mid;
    }
    cout<<l-1<<endl;
}


#include<bits/stdc++.h>
using namespace std;
#define ALL(x) begin(x),end(x)
#define rep(i,n) for(int i=0;i<(n);i++)
#define debug(v) cout<<#v<<":";for(auto x:v){cout<<x<<' ';}cout<<endl;
#define mod 1000000007
using ll=long long;
const int INF=1000000000;
const ll LINF=1001002003004005006ll;
int dx[]={1,0,-1,0},dy[]={0,1,0,-1};
// ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
template<class T>bool chmax(T &a,const T &b){if(a<b){a=b;return true;}return false;}
template<class T>bool chmin(T &a,const T &b){if(b<a){a=b;return true;}return false;}

struct IOSetup{
    IOSetup(){
        cin.tie(0);
        ios::sync_with_stdio(0);
        cout<<fixed<<setprecision(12);
    }
} iosetup;

template<typename T>
ostream &operator<<(ostream &os,const vector<T>&v){
    for(int i=0;i<(int)v.size();i++) os<<v[i]<<(i+1==(int)v.size()?"":" ");
    return os;
}
template<typename T>
istream &operator>>(istream &is,vector<T>&v){
    for(T &x:v)is>>x;
    return is;
}

signed main(){
    int H,W,A,B;
    cin>>H>>W>>A>>B;

    int D=H*(W-1)+(H-1)*W;

    vector<vector<int>> v(H,vector<int>(W,0));
    int res=0;
    for(int bit=0;bit<(1<<D);bit++){
        if(__builtin_popcount(bit)!=A) continue;
        rep(i,H)rep(j,W) v[i][j]=0;

        rep(j,W-1)rep(i,H){
            int idx=(W-1)*i+j;
            if((bit>>idx)&1){
                v[i][j]++;
                v[i][j+1]++;
            }
        }

        rep(i,H-1)rep(j,W){
            int idx=H*(W-1)+W*i+j;
            if((bit>>idx)&1){
                v[i][j]++;
                v[i+1][j]++;
            }
        }

        bool f=true;
        rep(i,H)rep(j,W)if(v[i][j]>1) f=false;
        res+=f;
    }
    cout<<res<<endl;
    return 0;
}

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

// vector<vector<bool>> used;
int h, w, a, b;
vector<vector<bool>> used;

int rec(int i, int j, vector<vector<bool>> &used, int a, int b) {
  if (j == w) return rec(i+1, 0, used, a, b);
  if (i == h) return 1;
  if (used[i][j]) return rec(i, j+1, used, a, b);

  int res = 0;
  used[i][j] = true;

  if (j+1 < w && !used[i][j+1] && a!=0) {
    used[i][j+1] = true;
    res += rec(i, j+1, used, a-1, b);
    used[i][j+1] = false;
  }

  if (i+1 < h && !used[i+1][j] && a!=0) {
    used[i+1][j] = true;
    res += rec(i, j+1, used, a-1, b);
    used[i+1][j] = false;
  }

  if (b!=0) {
    res += rec(i, j+1, used, a, b-1);
  }

  used[i][j] = false;
  return  res;
}

int main() {
  cin >> h >> w >> a >> b;
  used.assign(h,vector<bool>(w));
  int ans = rec(0, 0, used, a, b);
  cout << ans << endl;
  return 0;
}


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

#define INF_LL (int64)1e18
#define INF (int32)1e9
#define REP(i, n) for(int64 i = 0;i < (n);i++)
#define FOR(i, a, b) for(int64 i = (a);i < (b);i++)
#define all(x) x.begin(),x.end()
#define fs first
#define sc second

using int32 = int_fast32_t;
using uint32 = uint_fast32_t;
using int64 = int_fast64_t;
using uint64 = uint_fast64_t;
using PII = pair<int32, int32>;
using PLL = pair<int64, int64>;

const double eps = 1e-10;

template<typename A, typename B>inline void chmin(A &a, B b){if(a > b) a = b;}
template<typename A, typename B>inline void chmax(A &a, B b){if(a < b) a = b;}

template<typename T>
vector<T> make_v(size_t a){return vector<T>(a);}

template<typename T,typename... Ts>
auto make_v(size_t a,Ts... ts){
	return vector<decltype(make_v<T>(ts...))>(a,make_v<T>(ts...));
}

template<typename T,typename U,typename... V>
typename enable_if<is_same<T, U>::value!=0>::type
fill_v(U &u,const V... v){u=U(v...);}

template<typename T,typename U,typename... V>
typename enable_if<is_same<T, U>::value==0>::type
fill_v(U &u,const V... v){
	for(auto &e:u) fill_v<T>(e,v...);
}

template <typename F>
class
#if defined(__has_cpp_attribute) && __has_cpp_attribute(nodiscard)
  [[nodiscard]]
#endif  // defined(__has_cpp_attribute) && __has_cpp_attribute(nodiscard)
FixPoint final : private F
{
public:
  template <typename G>
  explicit constexpr FixPoint(G&& g) noexcept
    : F{std::forward<G>(g)}
  {}

  template <typename... Args>
  constexpr decltype(auto)
  operator()(Args&&... args) const
#if !defined(__GNUC__) || defined(__clang__) || __GNUC__ >= 9
  noexcept(noexcept(F::operator()(std::declval<FixPoint>(), std::declval<Args>()...)))
#endif  // !defined(__GNUC__) || defined(__clang__) || __GNUC__ >= 9
  {
    return F::operator()(*this, std::forward<Args>(args)...);
  }
};  // class FixPoint

#if defined(__cpp_deduction_guides)
template <typename F>
FixPoint(F&&)
  -> FixPoint<std::decay_t<F>>;
#endif  // defined(__cpp_deduction_guides)

namespace
{
  template <typename F>
#if !defined(__has_cpp_attribute) || !__has_cpp_attribute(nodiscard)
  #  if defined(__GNUC__) && (__GNUC__ > 3 || __GNUC__ == 3 && __GNUC_MINOR__ >= 4)
__attribute__((warn_unused_result))
#  elif defined(_MSC_VER) && _MSC_VER >= 1700 && defined(_Check_return_)
_Check_return_
#  endif  // defined(__GNUC__) && (__GNUC__ > 3 || __GNUC__ == 3 && __GNUC_MINOR__ >= 4)
#endif  // !defined(__has_cpp_attribute) || !__has_cpp_attribute(nodiscard)
  inline constexpr decltype(auto)
  makeFixPoint(F&& f) noexcept
  {
    return FixPoint<std::decay_t<F>>{std::forward<std::decay_t<F>>(f)};
  }
}  // namespace

int main(void){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int64 H, W;
	cin >> H>> W;
	vector<string> A(H);
	REP(i, H) {
	  cin >> A[i];
	}

	auto dp = make_v<int64>(H, W);
	fill_v<int64>(dp, -INF_LL);
	auto visited = make_v<int>(H, W);

	auto valid = [&](int y, int x) {
	  return 0<=y&&y<H&&0<=x&&x<W;
	};

	auto dfs = makeFixPoint([&](auto &&dfs, int y, int x) -> int64 {
	  if (visited[y][x]) return dp[y][x];
	  if (y == H-1 && x == W-1) {
	    return 0;
	  }
	  visited[y][x] = 1;

	  if (valid(y + 1, x)) chmax(dp[y][x], -dfs(y + 1, x) + (A[y+1][x] == '+' ? 1 : 0));
	  if (valid(y, x + 1)) chmax(dp[y][x], -dfs(y,x + 1) + (A[y][x + 1] == '+' ? 1 : 0));

//	  cout << y << " " << x << ": " << dp[y][x] << endl;
	  return dp[y][x];
	});

	int64  res = dfs(0, 0);
//	cout << res << endl;
	if (res > 0) {
	  cout << "Takahashi" << endl;
	} else if (res < 0) {
	  cout << "Aoki" << endl;
	} else {
	  cout << "Draw" << endl;
	}
}

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

#define MOD 1000000007
#define mxn 1005
#define mxm 105
#define f first
#define s second
#define pb push_back
#define es " "
#define endl '\n'
#define INF 0x3f3f3f3f
#define INFL 0x3f3f3f3f3f3f3f3f
#define ll long long
#define fastio ios_base::sync_with_stdio(0), cin.tie(0)
#define sz(x) (int)x.size()
#define all(x) x.begin(), x.end()
typedef pair<ll, ll> pii;
typedef pair<pii, int> pip;

int n, m, a, b, memo[20][20];

int solve(int i, int j, int x, int y, int cont){
    if(cont==n*m){
        return 1;
    }
    if(j>m){
        return solve(i+1, 1, x, y, cont);
    }
    if(i>n || x+y<=0){
        return 0;
    }
    ll resp=0;
    if(memo[i][j]){
        return solve(i, j+1, x, y, cont);
    }
    if(!memo[i][j+1] && j+1<=m && x){
        memo[i][j]=1;
        memo[i][j+1]=1;
        resp+=solve(i, j+2, x-1, y, cont+2);
        memo[i][j]=0;
        memo[i][j+1]=0;
    }
    if(!memo[i+1][j] && i+1<=n && x){
        memo[i][j]=1;
        memo[i+1][j]=1;
        resp+=solve(i, j+1, x-1, y, cont+2);
        memo[i][j]=0;
        memo[i+1][j]=0;
    }
    if(y){
        memo[i][j]=1;
        resp+=solve(i, j+1, x, y-1, cont+1);
        memo[i][j]=0;
    }
    return resp;
}

int main(){
    fastio;
    cin >> m >> n >> a >> b;
    cout << solve(1, 1, a, b, 0) << endl;
    return 0;
}


// #include<bits/stdc++.h>
// using namespace std;
// #define ll long long int
// #define ft first
// #define sd second
// #define pb push_back
// #define pob pop_back
// #define str string
// #define map map<ll, ll>
// #define mmap multimap<ll, ll>
// #define FIO ios_base::sync_with_stdio(false);cin.tie(NULL); cout.tie(NULL)
// #define stk stack<ll>
// #define vt vector<char>
// #define set set<ll>
// #define mset multiset<ll>
// int main()
// {
// 	ll n,m;
// 	cin>>n>>m;
// 	ll gap=m-n+1;
// 	ll t1=n/(gap-1);
// 	for(ll i=m;i>=1;i--)
// 	{
// 		if((i*t1>=n &&i*(t1+1)<=m)||(i*(t1+1)>=n && i*(t1+2)<=m))
// 		{
// 			cout<<i;
// 			break;
// 		}
// 	}
// }
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
int findMaxGCD(ll arr[], ll n)
{
    ll high = 0;
    for (ll i = 0; i < n; i++)
        high = max(high, arr[i]);
   ll count[high + 1] = {0};
    for (ll i = 0; i < n; i++)
        count[arr[i]]++;

   ll counter = 0;

    for (ll i = high; i >= 1; i--)
    {
        ll j = i;
       counter = 0;

        while (j <= high)
        {

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

           else if (count[j] == 1)
                counter++;

            j += i;

            if (counter == 2)
                return i;
        }
    }
}

int main()
{
    ll a,m;
    cin>>a>>m;
 	ll n = m-a+1;
 	ll arr[n];
 	ll k=a;
 	for(ll i=0;i<n;i++)
 	{
 		arr[i]=k;
 		k++;
 	}
    cout << findMaxGCD(arr, n);

    return 0;
}

#include <bits/stdc++.h>

using ll =long long;

using namespace std;

using Graph =vector<vector<ll> >;

int main(){
    int A,B;
    cin>>A>>B;
    vector<int>vb(B+1);
    for(int i=A;i<=B;i++){
        for(int j=1;j*j<=i;j++){
            if(i%j==0){
                vb[j]++;
                if(i/j!=j)vb[i/j]++;
            }
        }
    }
    int ans=0;

    for(int i=1;i<=B;i++){
        if(vb[i]>=2){
            ans=max(ans,i);
        }
    }

    cout<<ans<<endl;

}


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

#define int long long
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define rep(i,n) for(int i=0;i<n;++i)
#define rep1(i,n) for(int i=1;i<n;++i)
#define exrep(i, a, b) for(ll i = a; i < b; i++)
#define out(x) cout << x << endl
#define EPS (1e-7)
#define gearup ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);

typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<char> vc;
typedef vector<bool> vb;
typedef vector<double> vd;
typedef vector<string> vs;
typedef vector<pair<int,int> > vpii;
typedef vector<vector<int> > vvi;
typedef vector<vector<char> > vvc;
typedef vector<vector<bool> > vvb;
typedef vector<vector<double> > vvd;
typedef vector<vector<string> > vvs;
typedef vector<ll> vl;
typedef vector<vector<ll> > vvl;
typedef vector<vector<vector<ll> > > vvvl;
ll MOD = 1000000007;
const long long L_INF = 1LL << 60;
const int INF = 2147483647; // 2^31-1
const double PI = acos(-1);
//cout<<fixed<<setprecision(10);

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;}
template<class T> void debug(T v){rep(i,v.size()) cout<<v[i]<<" ";cout<<endl;}
const ll dx[8] = {1, 1, 0, -1, -1, -1, 0, 1};
const ll dy[8] = {0, 1, 1, 1, 0, -1, -1, -1};
//以降 cin の入力元が 'input.txt' になる
//std::ifstream in("input.txt");
//std::cin.rdbuf(in.rdbuf());

signed main() {
    gearup;
    ll n; cin >> n;
    vpii p;
    rep(i,n){
        int X,Y; cin >> X >> Y;
        p.push_back({X,Y});
    }
    sort(all(p));

    for(int i=0;i<n;i++){
        for(int j=i+1;j<n;j++){
            for(int k=j+1;k<n;k++){
                int x1 = p[i].first;
                int y1 = p[i].second;
                int x2 = p[j].first - x1;
                int y2 = p[j].second - y1;
                int x3 = p[k].first - x1;
                int y3 = p[k].second - y1;

                if(x2 == 0 && x3 == 0);
                else if(x2 == 0 || x3 == 0)continue;
                if(y2 == 0 && y3 == 0);
                else if(y2 == 0 || y3 == 0)continue;
                if(y2*x3 == x2*y3){
                    out("Yes");
                    return 0;
                }
            }
        }
    }
    out("No");
}

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

using i64 = long long;
using P   = pair<i64, i64>;

#define overload3(_1, _2, _3, name, ...) name
#define rep1(i, n) for(i64 i = 0LL; i < (n); ++i)
#define rep2(i, a, b) for(i64 i = (a); i < (b); ++i)
#define rep(...) overload3(__VA_ARGS__, rep2, rep1)(__VA_ARGS__)
#define all(v) v.begin(), v.end()

const string YES = "Yes";
const string NO  = "No";

void solve(long long N, std::vector<long long> x, std::vector<long long> y) {
    for(int i = 0; i < N; ++i) {
        for(int j = 0; j < N; ++j) {
            for(int k = 0; k < N; ++k) {
                if(i == j || j == k || i == k) continue;
                bool flag = false;
                if(x[i] == x[j] || x[i] == x[k]) {
                    if(x[i] == x[j] && x[i] == x[k]) { flag = true; }
                } else if(y[i] == y[j] || y[i] == y[k]) {
                    if(y[i] == y[j] && y[i] == y[k]) { flag = true; }
                } else if((x[k] - x[j]) * (y[j] - y[i]) == (y[k] - y[j]) * (x[j] - x[i])) {
                    flag = true;
                }
                if(flag) {
                    cout << YES << endl;
                    return;
                }
            }
        }
    }
    cout << NO << endl;
}

struct IoSetup {
    IoSetup() {
        // cin.tie(nullptr);
        // ios::sync_with_stdio(false);
        cout << fixed << setprecision(10);
        cerr << fixed << setprecision(10);
    }
} iosetup;

int main() {
    long long N;
    scanf("%lld", &N);
    std::vector<long long> x(N);
    std::vector<long long> y(N);
    for(int i = 0; i < N; i++) {
        scanf("%lld", &x[i]);
        scanf("%lld", &y[i]);
    }
    solve(N, std::move(x), std::move(y));
    return 0;
}


//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#include <x86intrin.h>
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define all(v) v.begin(), v.end()
#define allr(v) v.rbegin(), v.rend()
#define V vector
template <typename T> bool chmin(T &a, const T &b) {if(a > b){a = b; return true;} return false;}
template <typename T> bool chmax(T &a, const T &b) {if(a < b){a = b; return true;} return false;}
template<typename T> void print(T a) {ll x = a; cout << x << ' ';}
template<typename A, size_t N, typename T> void Fill (A (&array)[N], const T & val) {fill ((T*)array, (T*)(array+N), val);}
V<ll> dx = {-1, 1,  0, 0, -1, -1,  1, 1};
V<ll> dy = { 0, 0, -1, 1, -1,  1, -1, 1};

ll f (string s) {
    ll n = s.size();
    V<ll> p(n); rep(i, n) p[i] = s[i] - '0';
    sort(allr(p));
    ll g1 = 0;
    ll a = 1;
    for (ll i = n-1; i >= 0; i--) {
        g1 += p[i] * a;
        a *= 10;
    }
    sort(all(p));
    ll g2 = 0;
    a = 1;
    for (ll i = n-1; i >= 0; i--) {
        g2 += p[i] * a;
        a *= 10;
    }
    return g1 - g2;
}

int main () {
    string s; cin >> s;
    ll k; cin >> k;
    if (k == 0) {
        cout << s << endl;
        return 0;
    }
    ll t;
    while (k--) {
        t = f(s);
        s = to_string(t);
    }
    cout << t << endl;
    return 0;
}

#include <bits/stdc++.h>
#include <iostream>
#include <math.h>
#include <string.h>
#include <stdlib.h>
#include <list>
#include <algorithm>
#define eps 10e-14
//cout<<fixed<<setprecision(15)<<
//s=to_string(100);
//vector<vector<char>>c(h,vector<char>(w));
//next_permutation(orig.begin(),orig.end());
using namespace std;
int gcd(int x,int y){
  while(y>0){
    int r=x%y;
      x=y;
      y=r;
  }
  return x;
}
int lcm(int a,int b){
  int r=gcd(a,b);
  return a*b/r;
}
template<typename T, typename U>
void primeFactorization(map<T, U> &primes, T N) {
  T n=N;
  U num=0;
  while(n%2==0){
    num++;
    n/=2;
  }
  if(num!=0){
    primes.emplace(2,num);
  }
  for(T i=3;i*i<=N;i+=2) {
    num=0;
    while(n%i==0){
      num++;
      n/=i;
    }
    if(num!=0){
      primes.emplace(i, num);
    }
  }
  if(n!=1){
    primes.emplace(n,1);
  }
}
template<typename TypeInt>
string Itoa(const TypeInt v, int base){
  static const char table[]="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";
  string ret;
  static numeric_limits<TypeInt> t;
  TypeInt n=v;
  if(t.is_signed){
    if(v<0)n*=-1;
  }
  while(n>=base){
    ret+=table[n%base];
    n/=base;
  }
  ret+=table[n];
  if(t.is_signed){
    if(v<0&&base==10)ret+='-';
  }
  reverse(ret.begin(),ret.end());
  return ret;
}
long long modinv(long long a, long long m) {
    long long b = m, u = 1, v = 0;
    while (b) {
        long long t = a / b;
        a -= t * b; swap(a, b);
        u -= t * v; swap(u, v);
    }
    u %= m;
    if (u < 0) u += m;
    return u;
}
int main(){
 unsigned long long n,a,ans=0;
 map<unsigned long long,unsigned long long>m;
 cin>>n;
 for(int i=0;i<n;i++){
   cin>>a;
   m[a]++;
 }
 ans=(n*(n-1));
 for(auto p:m)ans-=(p.second*(p.second-1));
 cout<<ans/2<<endl;
}


//wtrl,everybody hangbeat me
#pragma GCC optimize(3)
#pragma GCC target("avx")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#include<bits/stdc++.h>
#include<iostream>
#include<string>
#include<cmath>
#include<cstdio>
#include<cctype>
#include<cstring>
#include<iomanip>
#include<cstdlib>
#include<ctime>
#include<set>
#include<map>
#include<utility>
#include<queue>
#include<vector>
#include<stack>
#include<sstream>
#include<algorithm>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef pair<pii,pii> piiii;
typedef vector<pii> vii;
typedef vector<int> vi;
typedef queue<int> qi;
typedef queue<char> qc;
typedef queue<string> qs;
typedef vector<char> vc;
typedef vector<string> vs;
typedef map<char,int> mpci;
typedef map<int,int> mpii;
typedef map<string,int> mpsi;
typedef set<int> sei;
typedef set<char> sec;
typedef set<string> ses;
typedef stack<ll> si;
typedef stack<char> sc;
typedef vector<ll> vll;
typedef vector<vi> vvi;
typedef vector<double> vd;
typedef pair<ll,ll> pll;
typedef pair<double,double> pdd;
typedef vector<pll> vpll;
typedef vector<pdd> vdd;
typedef unsigned int uint;
typedef long double ld;
typedef vector<bool> vb;
typedef vector<double> vd;
typedef vector<vi> vvi;
typedef vector<vvi> vvvi;
typedef vector<vii> vvii;
/*=====================================================================*/
#define pb push_back
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define sz(a) (int)(a.size())
#define len(a) (int)(a.length())
#define all(s) (s).begin(),(s).end()
#define fi first
#define se second
#define be begin
#define en end
#define m_p make_pair
#define repd(i,n) for(int i=n-1;i>=0;i--)
#define forn(i,p,n) for(int i=p;i<=n;i++)
#define ford(i,p,n) for(int i=n;i>=p;i--)
#define foreach(i,c) for(__typeof(c.begin())i=(c.begin());i!=(c).end();++i)
#define zero(a) memset(a,0,sizeof(a))
#define number(a,num) memeset(a,num,sizeof(a))
#define INF 1e9
#define PI acos(-1)

/*=====================================================================*/

string int_to_string(ll n)
{
	string s="";
	while(n)
	{
		ll now=n%10;
		s+=now+'0';
		n/=10;
	}
	reverse(s.begin(),s.end());
	return s;
}
ll string_to_int(string s)
{
	ll n=0;
	rep(i,s.size())
	{
		n*=10;
		n+=s[i]-'0';
	}
	return n;
}
/*======================================================================*/
ll lcm(int a,int b)
{
	return a/__gcd(a,b)*b;
}
bool prime(int n)
{
	if(n==0||n==1)
	  return false;
	for(int i=2;i*i<=n;i++)
	  if(n%i==0)
	    return false;
	return true;
}
string turn(int n,int k)
{
	string s="";
	while(n)
	{
		s+=(char)(n%k+'0');
		n/=k;
	}
	reverse(s.begin(),s.end());
	return s;
}
const string turn16(int n)
{
	string s="";
	while(n!=0)
	{
		if(n%16>9)
		  s+=(char)('A'+n%16-10);
		else
		  s+=(char)('0'+n%16);
		n/=16;
	}
	reverse(s.begin(),s.end());
	return s;
}
/*======================================================================*/
const int dx[]={-1,0,1,0};
const int dy[]={0,-1,0,1};
const int month[2][12]={{31,28,31,30,31,30,31,31,30,31,30,31},{31,29,31,30,31,30,31,31,30,31,30,31}};
ll h,w,k,ans,inv=1,dp[5010][5010],mod=998244353;
char a[5010][5010];
/*======================================================================*/
int main()
{
    std::ios::sync_with_stdio(false);
  /*
	freopen("input.txt","r",stdin);
	freopen("output.txt","w",stdout);
  */
  /*====================================================================*/
    cin>>h>>w>>k;
	int r,c;
	char x;
	rep(i,k)
	{
		cin>>r>>c>>x;
		a[--r][--c]=x;
	}
	while(inv%3)
	{
	 inv+=mod;
    }
	inv/=3;
	dp[0][0]=1;
	rep(i,h)
	{
	  rep(j,w)
	  {
		if(a[i][j]!='R'&&i+1<h)
		{
			dp[i+1][j]+=dp[i][j]*(a[i][j]==0?2*inv:1);
			dp[i+1][j]%=mod;
		}
		if(a[i][j]!='D'&&j+1<w)
		{
			dp[i][j+1]+=dp[i][j]*(a[i][j]==0?2*inv:1);
			dp[i][j+1]%=mod;
		}
	  }
    }
	ans=dp[h-1][w-1];
	rep(i,h*w-k)
	{
	  ans=ans*3%mod;
    }
	cout<<ans<<endl;
  return 0;
}

#include<bits/stdc++.h>
#define ll long long
#define ld long double
#define MOD 998244353
#define f first
#define s second
#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
using namespace std;
const ll inf=1e18+5;
const int maxN=1e6+1;
ll power(ll a,int n){
    if(n==0){
        return 1ll;
    }
    if(n==1){
        return a%MOD;
    }
    ll p=power(a,n/2);
    p=(p*p)%MOD;
    if(n%2==1){
        p=(p*a)%MOD;
    }
    return p;
}
int main(){
    // freopen("input.txt","r",stdin);
    // freopen("output.txt","w",stdout);
    int h,w,k;
    cin>>h>>w>>k;
    int u,v,c;
    char ch;
    vector<vector<int>> a(h,vector<int>(w,0));
    for(int i=0;i<k;i++){
        cin>>u>>v>>ch;
        u--;
        v--;
        if(ch=='R'){
            c=1;
        }
        else if(ch=='D'){
            c=2;
        }
        else{
            c=3;
        }
        a[u][v]=c;
    }
    vector<vector<ll>> dp(h,vector<ll>(w,0));
    ll inv3=power(3ll,MOD-2);
    for(int i=0;i<h;i++){
        for(int j=0;j<w;j++){
            if(i==0 && j==0){
                dp[i][j]=power(3ll,h*w-k);
            }
            if(i>0){
                if(a[i-1][j]==0){
                    dp[i][j]=(dp[i][j]+((dp[i-1][j]*inv3)%MOD)*2)%MOD;
                }
                else if(a[i-1][j]==2 || a[i-1][j]==3){
                    dp[i][j]=(dp[i][j]+(dp[i-1][j])%MOD)%MOD;
                }
            }
            if(j>0){
                if(a[i][j-1]==0){
                    dp[i][j]=(dp[i][j]+((dp[i][j-1]*inv3)%MOD)*2)%MOD;
                }
                else if(a[i][j-1]==1 || a[i][j-1]==3){
                    dp[i][j]=(dp[i][j]+(dp[i][j-1])%MOD)%MOD;
                }
            }
        }
    }
    cout<<(dp[h-1][w-1]+MOD)%MOD<<endl;
}


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

using namespace __gnu_pbds;
using namespace std;

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

typedef tree<
        int,
        null_type,
        less<int>,
        rb_tree_tag,
        tree_order_statistics_node_update>
        ordered_set;

#define mp make_pair

int MOD =  1e9 + 7;

int mul(int a, int b) {
    return (1LL * a * b) % MOD;
}

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

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

int po(int a, ll deg)
{
    if (deg==0) return 1;
    if (deg%2==1) return mul(a, po(a, deg-1));
    int t = po(a, deg/2);
    return mul(t, t);
}

int inv(int n)
{
    return po(n, MOD-2);
}

mt19937 rnd(time(0));

/*
const int LIM = 1000;

vector<int> facs(LIM), invfacs(LIM);

void init()
{
    facs[0] = 1;
    for (int i = 1; i<LIM; i++) facs[i] = mul(facs[i-1], i);
    invfacs[LIM-1] = inv(facs[LIM-1]);
    for (int i = LIM-2; i>=0; i--) invfacs[i] = mul(invfacs[i+1], i+1);
}

int C(int n, int k)
{
    if (n<k) return 0;
    if (n<0 || k<0) return 0;
    return mul(facs[n], mul(invfacs[k], invfacs[n-k]));
}*/

/*struct DSU
{
    vector<int> sz;
    vector<int> parent;
    void make_set(int v) {
        parent[v] = v;
        sz[v] = 1;
    }

    int find_set(int v) {
        if (v == parent[v])
            return v;
        return find_set(parent[v]);
    }

    void union_sets(int a, int b) {
        a = find_set(a);
        b = find_set(b);

        if (a != b) {
            if (sz[a] < sz[b])
                swap(a, b);
            parent[b] = a;
            sz[a] += sz[b];
        }
    }

    DSU (int n)
    {
        parent.resize(n);
        sz.resize(n);
        for (int i = 0; i<n; i++) make_set(i);
    }
};*/

bool cmp(ll a, ll b)
{
    //a vs b*phi
    //cout<<"Comparing: "<<a<<' '<<b<<endl;
    if (a==0) return false;
    if (b==0) return true;
    if (a<=b) return false;
    if (a>=2*b) return true;
    return (!cmp(b, a-b));
}

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

    ll n; cin>>n;

    ld kek = ((ld)(1) + sqrt(5))/(ld)(2);

    ll n1 = n/kek;

    //cout<<n<<' '<<n1<<endl;

    while (cmp(n, n1+1)) n1++;

    while (!cmp(n, n1-1)) n1--;

    //cout<<n<<' '<<n1<<endl;

    vector<int> ops;
    while (n>0 && n1>0)
    {
        //cout<<n<<' '<<n1<<endl;
        if (n>=n1)
        {
            if (cmp(n-1, n1))
            {
                n--; ops.push_back(1);
                continue;
            }
            else if (!cmp(n, n1-1))
            {
                n1--; ops.push_back(2);
                continue;
            }
            n-=n1; ops.push_back(3);
        }
        else
        {
            if (cmp(n1-1, n))
            {
                n1--; ops.push_back(2);
                continue;
            }
            else if (!cmp(n1, n-1))
            {
                n--; ops.push_back(1);
                continue;
            }
            n1-=n; ops.push_back(4);
        }
    }

    while (n>0)
    {
        n--; ops.push_back(1);
    }

    while (n1>0)
    {
        n1--; ops.push_back(2);
    }

    reverse(ops.begin(), ops.end());
    cout<<ops.size()<<endl;
    for (auto it: ops) cout<<it<<endl;

}

/*
 (x, y) ->
 (x+1, y)
 (x, y+1)
 (x+y, y)
 (x, x+y)

 (0, 0):

988988988988988988

 */

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


#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <numeric>
#include <cmath>
#include <queue>
#include <map>
#include <iomanip>
#include <time.h>
#include <set>
using namespace std;

int64_t mod = 998244353 ;

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

vector<int> getprime(int n){
    vector<int> p(0) ;
    vector<bool> table(n+1,0) ;
    for (int i = 2; i <= n; i++)
    {
        if (table.at(i) == 0)
        {
            p.push_back(i) ;
            for (size_t j = 2; j < n/i ; j++)
            {
                table.at(i*j) = 1 ;
            }

        }

    }
    return p ;
}
/*
int getnum(vector<int> &array, vector<char> &c, char a){
    for (int i = 0; i < c.size(); i++)
    {
        if (a == c.at(i))
        {
            return array.at(i) ;
        }

    }

}

int64_t repeatmod(int64_t n, int64_t pow, int64_t p){
    if (pow == 1)
    {
        return n%p ;
    }

    if (pow % 2)
    {
        return (repeatmod(n, pow-1,p) * n) % p ;
    }else
    {
        return (repeatmod(n,pow/2,p) * repeatmod(n,pow/2,p)) % p ;
    }

}
*/
int prod(pair<int,int> a,pair<int,int> b){
    return a.first * b.first + a.second * b.second ;
}

int main(){
    int n ;
    cin >> n ;
    if (n == 1)
    {
        cout << "Yes" << endl ;
        return 0 ;
    }

    vector<pair<int,int> > s(n) ;
    vector<pair<int,int> > t(n) ;
    for (int i = 0; i < n; i++)
    {
        cin >> s.at(i).first >> s.at(i).second ;
    }
    for (int i = 0; i < n; i++)
    {
        cin >> t.at(i).first >> t.at(i).second ;
    }
    int a0 = s.at(0).first ;
    int b0 = s.at(0).second ;
    for (int i = 0; i < n; i++)
    {
        s.at(i).first -= a0 ;
        s.at(i).second -= b0 ;
    }
    pair<int,int> kitei1 = make_pair(s.at(1).first,s.at(1).second) ;
    pair<int,int> kitei2 = make_pair(-s.at(1).second,s.at(1).first) ;
    set <pair<pair<int,int>,pair<int,int> > > svec ;
    for (int i = 0; i < n; i++)
    {
        int size = prod(s.at(i),s.at(i)) ;
        svec.insert(make_pair(make_pair(size*size,prod(s.at(i),kitei1)),make_pair(size*size,prod(s.at(i),kitei2)))) ;
    }
    for (int onum = 0; onum < n; onum++)
    {
        vector<pair<int,int> > copy = t ;
        int c0 = copy.at(onum).first ;
        int d0 = copy.at(onum).second ;
        for (int i = 0; i < n; i++)
        {
            copy.at(i).first -= c0 ;
            copy.at(i).second -= d0 ;
        }
        for (int knum = 0; knum < n; knum++)
        {
            pair<int,int> kitei11 = make_pair(copy.at(knum).first,copy.at(knum).second) ;
            pair<int,int> kitei22 = make_pair(-copy.at(knum).second,copy.at(knum).first) ;
            set <pair<pair<int,int>,pair<int,int> > > tvec ;
            for (int i = 0; i < n; i++)
            {
                int size = prod(copy.at(i),copy.at(i)) ;
                tvec.insert(make_pair(make_pair(size*size,prod(copy.at(i),kitei11)),make_pair(size*size,prod(copy.at(i),kitei22)))) ;
            }
            if ( svec == tvec)
            {
                cout << "Yes" << endl ;
                return 0 ;
            }

        }

    }
    cout << "No" << endl ;

}

#include <bits/stdc++.h>

using namespace std;

#define ull unsigned long long
#define ll long long
#define ui unsigned int
#define us unsigned short
#define inf_int 1e9
#define inf_ll 1e18
#define mod 1000000007
#define smod 998244353

vector<pair<ll, ll>> v[5];

int main(){
	ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
//	freopen("input.txt","r",stdin);
//	freopen("output.txt","w",stdout);

	int n;
	cin >> n;

	vector<pair<ll, ll>> v[5];
	ll data[n][5];
	for(int x=0;x<n;x++){
		for(int y=0;y<5;y++){
			cin >> data[x][y];
			v[y].push_back({data[x][y], x});
		}
	}

	for(int x=0;x<5;x++){
		sort(v[x].begin(), v[x].end());
	}
	ll ans = 0;
	for(int x=0;x<n;x++){
		for(int y=x+1;y<n;y++){
			vector<pair<ll, ll>> tmp;
			for(int z=0;z<5;z++){
				tmp.push_back({max(data[x][z], data[y][z]), z});
			}

			sort(tmp.begin(), tmp.end());

			for(int i=1;i<=3;i++){
				int idx = v[tmp[0].second][n-i].second;
				if(idx == x || idx == y) continue;

				tmp[0].first = max(tmp[0].first, v[tmp[0].second][n-i].first);
				break;
			}

			ll mn = inf_ll;
			for(int z=0;z<5;z++) mn = min(mn, tmp[z].first);
			ans = max(ans, mn);
		}
	}
	cout << ans << "\n";
    return 0;
}

// Santai
// Pikirin dengan benar-benar


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

#define debug(x) cerr << #x << '=' << x << endl
#define rep(i, b, e) for (int i = b; i <= e; i++)

char s1[512345], s2[512345];
vector<int> a(512345);
vector<int> b(512345);
signed main(void) {
    int n, cnt = 0;
    cin >> n;
    scanf("%s%s", s1 + 1, s2 + 1);
    rep (i, 1, n) {
        if (s1[i] == '0') {
            cnt++;
        }
        if (s2[i] == '0') {
            cnt--;
        }
    }
    if (cnt != 0) {
        puts("-1");
        return 0;
    }
    int ans = 0;
    rep (i, 1, n) {
        if (s1[i] == '0') {
            a.push_back(i);
        }
        if (s2[i] == '0') {
            b.push_back(i);
        }
    }
    rep (i, 0, min(a.size(), b.size()) - 1) {
        if (a[i] != b[i]) {
            ans++;
        }
    }
    cout << ans;
    return 0;
}

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

/*
ll fac[100000+1];
ll power(ll x,ll y)
{
    ll res = 1; // Initialize result

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

    while (y > 0)
    {

        // If y is odd, multiply x with result
        if (y & 1)
            res = (res * x) % k;

        // y must be even now
        y = y >> 1; // y = y/2
        x = (x * x) %k;
    }
    return res;
}

// Returns n^(-1) mod p
ll modInverse(ll n)
{
    return power(n, k - 2);
}

// Returns nCr % p using Fermat's little
// theorem.
ll nCr(ll n,ll r)
{
    // If n<r, then nCr should return 0
    if (n < r)
        return 0;
    // Base case
    if (r == 0)
        return 1;

    // Fill factorial array so that we
    // can find all factorial of r, n
    // and n-r

    return (fac[n] * modInverse(fac[r]) % k
            * modInverse(fac[n - r]) % k)
           % k;
}
*/
ll gcd(ll a,ll b)
{
    if(a==0)
        return b;

        return gcd(b%a,a);
}

ll countDivisors(ll n)
{
    ll cnt = 0;
    for (ll i = 1; i <= sqrt(n); i++) {
        if (n % i == 0) {
            if (n / i == i)
                cnt++;

            else
                cnt = cnt + 2;
        }
    }
    return cnt;
}
/*ll binexp(ll a,ll b)
{
    if(a==0||a==1) return a;
    if(b==0)  return 1;
    ll ret= binexp(a,b/2);
    if(b%2) return (((ret*ret)%M)*a)%M;
    else return (ret*ret)%M;
}
*/
ll smallestDivisor(ll n)
{
    // if divisible by 2
    if (n % 2 == 0)
        return 2;

    // iterate from 3 to sqrt(n)
    for (ll i = 3; i * i <= n; i += 2) {
        if (n % i == 0)
            return i;
    }

    return n;
}
ll maxPrimeFactor(ll n)
{
    ll maxPrime = -1;
    while (n % 2 == 0) {
        maxPrime = 2;
        n >>= 1;
    }
    for (ll i = 3; i <= sqrt(n); i += 2) {
        while (n % i == 0) {
            maxPrime = i;
            n = n / i;
        }
    }
    if (n > 2)
        maxPrime = n;
    return maxPrime;
}
ll isPrime(ll n)
{
    if(n==1) return 0;
       if (n <= 3)  return (1);
    if (n%2 == 0 || n%3 == 0) return (0);
    for (ll i=5; i*i<=n; i=i+6)
        if (n%i == 0 || n%(i+2) == 0)
           return (0);

    return (1);
}

ll no_of_digits(ll n)
{
   ll k=0;
   while(n)
   {
       k++;
       n/=10;
   }
  return k;
}
ll sum_of_digits(ll n)
{
   ll k=0;
   while(n)
   {
       k+=n%10;
       n/=10;
   }
  return k;
}

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
   /*ll fac[11];
    fac[0] = 1;
    for (int i = 1; i <=10; i++)
        fac[i] = (fac[i - 1] * i);*/

   ll t=1;
 //  cin>>t;
    while(t--){
         int n;
         cin>>n;
         string s,t;
         cin>>s>>t;
         vector<int> v1,v2,v3,v4;
         for(int i=0;i<n;i++)
         {
             if(s[i]=='0')
                v1.push_back(i);
                else
                    v3.push_back(i);
             if(t[i]=='0')
                v2.push_back(i);
                else
                    v4.push_back(i);
         }
       //  cout<<v1.size()<<" "<<v2.size();

       if(s==t)
        cout<<0;
        else if(v1.size()!=v2.size())
            cout<<-1;
         else{
        int count1=0,count2=0;
         int i=0;
         while(i<v1.size())
         {
             if(v1[i]==v2[i])
             count1++;
             i++;
         }
        /* int j=v1.size()-1;
          while(j>=0 && v1[j]==v2[j])
         {
             count2++;
             j--;
         }*/
        // cout<<count1<<" "<<count2;
         ll ans1=v1.size()-count1-count2;
        count1=0,count2=0;
          i=0;
         while(i<v3.size() && v3[i]==v4[i])
         {
             count1++;
             i++;
         }
        int j=v3.size()-1;
          while(j>=0 && v3[j]==v4[j])
         {
             count2++;
             j--;
         }
        // ll ans2=v3.size()-count1-count2;
         cout<<ans1;
         }
       cout<<"\n";
        }
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ull unsigned long long
#define ld long double
#define pii pair<int, int>
#define pll pair<ll, ll>
#define vi vector<int>
#define vll vector<ll>
#define vc vector<char>
#define vs vector<string>
#define vpll vector<pll>
#define vpii vector<pii>
#define umap unordered_map
#define uset unordered_set
#define PQ priority_queue
#define printa(a, L, R)         \
    for (int i = L; i < R; i++) \
    cout << a[i] << (i == R - 1 ? '\n' : ' ')
#define printv(a) printa(a, 0, a.size())
#define print2d(a, r, c)            \
    for (int i = 0; i < r; i++)     \
        for (int j = 0; j < c; j++) \
    cout << a[i][j] << (j == c - 1 ? '\n' : ' ')
#define pb push_back
#define eb emplace_back
#define UB upper_bound
#define LB lower_bound
#define F first
#define S second
#define mem(a, x) memset(a, x, sizeof(a))
#define inf 1e18
#define E 2.71828182845904523536
#define gamma 0.5772156649
#define nl "\n"
#define lg(r, n) (int)(log2(n) / log2(r))
#define rev(v) reverse(v.begin(), v.end())
#define srt(v) sort(v.begin(), v.end())
#define grtsrt(v) sort(v.begin(), v.end(), greater<ll>())
#define all(v) v.begin(), v.end()
#define mnv(v) *min_element(v.begin(), v.end())
#define mxv(v) *max_element(v.begin(), v.end())
#define toint(a) atoi(a.c_str())
#define BeatMeScanf ios_base::sync_with_stdio(false)
#define one(x) __builtin_popcount(x)
#define Unique(v) v.erase(unique(all(v)), v.end())
#define fout(x) fixed << setprecision(x)
#define debug(args...)                           \
    {                                            \
        string _s = #args;                       \
        replace(_s.begin(), _s.end(), ',', ' '); \
        stringstream _ss(_s);                    \
        istream_iterator<string> _it(_ss);       \
        deb(_it, args);                          \
    }
void deb(istream_iterator<string> it)
{
}
template <typename T, typename... Args>
void deb(istream_iterator<string> it, T a, Args... args)
{
    cout << *it << " = " << a << endl;
    deb(++it, args...);
}
const int mod = 1e9 + 7;
const int N = 3e5 + 9;
const ld eps = 1e-9;
const ld PI = acos(-1.0);
ll gc(ll a, ll b)
{
    while (b)
    {
        ll x = a % b;
        a = b;
        b = x;
    }
    return a;
}
ll lc(ll a, ll b) { return a / gc(a, b) * b; }
ll qpow(ll n, ll k)
{
    ll ans = 1;
    assert(k >= 0);
    n %= mod;
    while (k > 0)
    {
        if (k & 1)
            ans = (ans * n) % mod;
        n = (n * n) % mod;
        k >>= 1;
    }
    return ans % mod;
}

void solve()
{
    ll n;
    cin>>n;
    ll x=sqrt((double) n);
    while((x+1)*(x+2)/2<=(n+1)) x++;
    // debug(x);
    ll y=x*(x+1);
    // debug(y);
    cout<<n-x+1<<nl;
}

int main()
{
    BeatMeScanf;
    int t=1;
    // cin>>t;

    int cs=0;
    while(t--){
        // cout<<"Case "<<++cs<<": ";
        solve();
    }
    return 0;
}

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int  main(){
	ll n,t=0,i=1,k=0;
	cin>>n;
	while(t<=n+1){
		t=t+i;
		i++;
		k++;
	}
	printf("%lld\n",n-k+2);
	return 0;
}


#include <iostream>
#include <sstream>
#include <vector>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <utility>
#include <map>
#include <list>
#include <climits>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <unordered_map>
#include <unordered_set>
#include <iomanip>
#include <bitset>
#include <string>

// #define cerr if(false)cerr
#define watch(x) cerr << "> " << #x << ": " << x << "\n";

using namespace std;

template <typename T>
std::ostream &operator <<(std::ostream &out, vector<T> &v) {
	for (typename vector<T>::size_type i = 0; i < v.size(); ++i)
		out << v[i] << " ";
	out << "\n";
    return out;
}
template <typename T, typename N>
std::ostream &operator <<(std::ostream &out, vector<pair<T, N> > &v) {
	for (size_t i = 0; i < v.size(); ++i)
		out << "(" << v[i].first << ", " << v[i].second << ") ";
	out << "\n";
    return out;
}
template <typename T>
std::ostream &operator <<(std::ostream &out, vector<vector<T> > &v) {
	for (size_t i = 0; i < v.size(); ++i) {
		for (size_t j = 0; j < v[i].size(); ++j) {
			out << v[i][j] << " ";
		}
		out << "\n";
	}
   	return out;
}

int main() {

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

	int n;
	cin >> n;

	vector<int> present(2e5 + 1);
	int min_valid = 0;
	int p;
	for (int i = 0; i < n; ++i) {
		cin >> p;
		present[p] = 1;
		while (present[min_valid]) {
			++min_valid;
		}

		cout << min_valid << "\n";
	}

	return 0;

}

#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)(n);i++)
using namespace std;
using ll=long long;
using P=pair<int,int>;
int n;
vector<int> x(210),y(210),r(210);
vector<int> a(210,-1),b(210,-1),c(210,-1),d(210,-1);
void input(){
    cin>>n;
    for(int i=0;i<n;i++){
        cin>>x[i]>>y[i]>>r[i];
    }
}
void output(){
    rep(i,n){
        cout<<a[i]<<" "<<b[i]<<" "<<c[i]<<" "<<d[i]<<endl;
    }
}
int main(){
    input();
    rep(i,n){
        a[i]=x[i];
        b[i]=y[i];
        c[i]=x[i]+1;
        d[i]=y[i]+1;
    }
    output();
}


#include <iostream>
#include <vector>
#include <utility>
#include <queue>
#include <vector>
#include <list>
#include <cmath>
#include <map>
#include <deque>
#include <utility>
#include <climits>
#include <unordered_map>
#include <unordered_set>
#include <cstdlib>
#include <string>
#include <stack>
#include <set>
#include <functional>
#include <iterator>
#include <algorithm>

using namespace std;

typedef long long ll;

class UnionFind {
private:
    vector<int> f;
    int _components;
public:
    explicit UnionFind(int sz): f(sz), _components(sz) {
        for (int i = 0; i < sz; i++) {
            f[i] = i;
        }
    }

    int find(int x) {
        if (x == f[x]) return x;
        int fa = f[x];
        return f[x] = find(fa);
    }

    void add(int x, int y) {
        int fx = find(x), fy = find(y);
        if (fx != fy) {
            _components--;
        }
        f[fx] = fy;
    }
    int components() const {
        return _components;
    }
};

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

ll lucas(ll n, ll m, ll mod, const vector<vector<ll>>& c) {
    if (m == 0) {
        return 1;
    } else {
        return c[n % mod][m % mod] * lucas(n / mod, m / mod, mod, c);
    }
}

int main(int argc, char *argv[]) {
    std::ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);

    const int mod = 1e9+7;
    int n;
    cin >> n;
    string s;
    cin >> s;

    unordered_map<char, int> dict{{'B', 0}, {'W', 1,}, {'R', 2}};
    unordered_map<char, int> reversedict{{0, 'B'}, {1, 'W'}, {2, 'R'}};

    vector<vector<ll>> c(3, vector<ll>(3, 0));
    c[0][0] = 1;
    c[1][0] = 1;
    c[1][1] = 1;
    c[2][0] = 1;
    c[2][1] = 2;
    c[2][2] = 1;

    int sum = 0;
    for (int i = 0; i < n; i++) {
        ll mult = lucas(n - 1, i, 3, c);
        //cout << mult << ' ';
        sum += mult * dict[s[i]];
        sum %= 3;
    }
    if (n % 2 == 0) {
        sum = -sum;
    }

    sum %= 3;
    if (sum < 0) {
        sum += 3;
    }
    cout << char(reversedict[sum]);
}

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

#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define eb emplace_back
typedef long long ll;
typedef pair<int, int> pi;

const int maxn = 4e5 + 5;
int n;
int f[maxn], g[maxn];
string a;

int C(int i, int j){
    if(f[i] == f[j] + f[i-j])
        return g[i] * g[j] * g[i-j] % 3;
    else
        return 0;
}

string col = "BWR";

int id(char c){
    for(int i = 0;i < 3;i++){
        if(c == col[i])
            return i;
    }
}

int main(){
    ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
    cin >> n;
    f[0] = 0;
    g[0] = 1;
    for(int i = 1;i <= n;i++){
        int c = 0;
        int j = i;
        while(j % 3 == 0){
            j /= 3;
            c++;
        }
        f[i] = f[i-1] + c;
        g[i] = g[i-1] * j % 3;
    }
    cin >> a;
    int ans = 0;
    for(int i = 0;i < n;i++){
        ans += C(n-1, i) * id(a[i]);
    }
    ans %= 3;
    if(n % 2 == 0){
        ans = (3 - ans) % 3;
    }
    cout << col[ans] << endl;
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define T() long long t;cin>>t;for(long long o=1;o<=t;o++)
#define INF INT_MAX
#define INFS INT_MIN
#define mod 1000000007
#define FOR(a, b, n) for(int a = b; a < n; a++)
#define REP(a,c, b) for(int a = c; a < b; a++)
#define FORD(a, b, c) for(int a = b; a >= c; a--)
#define REPR(a, c,b) for(int a = b-1; a >= c; a--)
#define IOS  ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define RESET(a, b) memset(a, b, sizeof a)
#define EPS 1e-9
#define m_p make_pair
#define pb push_back
#define fi first
#define se second
#define  rall(x) x.rbegin(), x.rend()
#define all(x) x.begin(), x.end()
#define ALL(x, y) x, x+y
#define SZ(x) ((int)x.size())
#define  pi(a)  pair<a, a>
#define  vi(a)  vector<a>
#define  vii(a) vector<pi(a)>
#define  vs vector<string>
template<class T> T sqr(T x){ return x*x; }
template<class T> T binPow(T p, int q, int MOD) {
    if(q == 1) return p % MOD;
    if(q & 1) return p*(binPow(p, q-1, MOD) % MOD) % MOD;
    else return sqr(binPow(p, q/2, MOD) % MOD) % MOD;
}
#define TRACE
#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1) {
	cout << name << " : " << arg1 << endl;
	//use cerr if u want to display at the bottom
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args) {
	const char* comma = strchr(names + 1, ','); cout.write(names, comma - names) << " : " << arg1 << " | "; __f(comma + 1, args...);
}
#else
#define trace(...)
#endif

ll nxt() {
    ll temporaryVariable;
    cin >> temporaryVariable;
    return temporaryVariable;
}
const double PI = acos(-1.0);
#define MAXN 100001
const int G = 2e5 + 5;

 int N=10000000;

int main(){
    IOS

    int n;cin>>n;
    if(n>0)
    cout<<n<<endl;
    else
    cout<<0<<endl;

    #ifdef HOHOHOa
    fprintf(stderr, "%.3lf\n", clock() / (double) CLOCKS_PER_SEC );
#endif
}

#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <string.h>
#include <algorithm>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <vector>
#include <bits/stdc++.h>
using namespace std;

const double TL = 1.5 * CLOCKS_PER_SEC;
mt19937 rng((unsigned int) chrono::steady_clock::now().time_since_epoch().count());
#define clr(x, y) memset(x, y, sizeof(x))
#define forn(i, n) for (int i = 0; i < n; i++)
#define LL long long
const double pi = acos(-1.0);

int main() {
#ifdef LOCAL
  auto start_clock = clock();
  freopen("in", "r", stdin);
#endif

  int x;
  scanf("%d", &x);
  if (x < 0) x = 0;
  printf("%d\n", x);

#ifdef LOCAL
 auto end_clock = clock();
 cout << "Time:" << (end_clock - start_clock) * 1.0 / CLOCKS_PER_SEC << endl;
#endif
  return 0;
}


#include <bits/stdc++.h>

#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define endl "\n"
#define rep(i,n) repi(i,0,n)
#define repi(i,a,n) for(ll i=a;i<(ll)n;++i)
#define repe(i,n) repie(i,0,n)
#define repie(i,a,n) for(ll i=a;i<=(ll)n;++i)
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(),(a).rend()

using namespace std;
using ll = long long;
using P = pair<ll, ll>;
void YN(bool a) { cout << (a ? "Yes" : "No") << endl; }
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; }
void show(){ cout << endl; }
template <class Head, class... Tail>
void show(Head&& head, Tail&&... tail){ cout << head << " "; show(std::forward<Tail>(tail)...); }
template<class T> inline void show(T& begin, T& end) { for(auto itr = begin; itr != end; ++itr) cout<<(*itr)<<" "; cout<<endl; }
template<class T> inline void showall(T& a) { for(auto v:a) cout<<v<<" "; cout<<endl; }

void solve()
{
  ll n;
  cin >> n;
  ll a, p, x;
  ll ans = 1LL<<60;
  rep(i, n)
  {
    cin >> a >> p >> x;
    if (x - a > 0) chmin(ans, p);
  }

  if (ans == 1LL<<60) ans = -1;
  show(ans);
}

int main()
{
  fastio;
  solve();

  return 0;
}

// Artur Kraska, II UWr

#include <bits/stdc++.h>

#define forr(i, n)                  for(int i=0; i<n; i++)
#define FOREACH(iter, coll)         for(auto iter = coll.begin(); iter != coll.end(); ++iter)
#define FOREACHR(iter, coll)        for(auto iter = coll.rbegin(); iter != coll.rend(); ++iter)
#define lbound(P,R,PRED)            ({typeof(P) X=P,RRR=(R), PPP = P; while(PPP<RRR) {X = (PPP+(RRR-PPP)/2); if(PRED) RRR = X; else PPP = X+1;} PPP;})
#define testy()                     int _tests; scanf("%d", &_tests); FOR(_test, 1, _tests)
#define CLEAR(tab)                  memset(tab, 0, sizeof(tab))
#define CONTAIN(el, coll)           (coll.find(el) != coll.end())
#define FOR(i, a, b)                for(int i=a; i<=b; i++)
#define FORD(i, a, b)               for(int i=a; i>=b; i--)
#define MP                          make_pair
#define PB                          push_back
#define ff                          first
#define ss                          second
#define deb(X)                      X;

#define M 1000000007
#define INF 1000000007LL

using namespace std;

int n, m, a;
char slowo[1000007];

int main()
{
    testy()
    {
        scanf("%d", &n);
        scanf("%s", slowo);
        scanf("%s", slowo);
        scanf("%s", slowo);
        printf("1");
        forr(i, n)
            printf("0");
        forr(i, n)
            printf("1");
        printf("\n");
    }

    return 0;
}


#include <iostream>
#include <cmath>
#include <string>
#include <vector>
#include <algorithm>
#include <utility>
#include <tuple>
#include <cstdint>
#include <cstdio>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <deque>
#include <unordered_map>
#include <unordered_set>
#include <cassert>
#include <time.h>

#define rep(i, n) for(int i = 0; i < n; i++)
#define per(i, n) for(int i = n - 1; i >= 0; i--)
using ll = long long;
#define vi vector<int>
#define vvi vector<vi>
#define vl vector<ll>
#define vd vector<double>
#define vvd vector<vd>
#define pii pair<int, int>
#define pll pair<ll, ll>
#define pdi pair<double, int>
#define all(a) (a).begin(), (a).end()
#define rall(a) (a).rbegin(), (a).rend()
using namespace std;
constexpr int n = 20;
int m;
vector<string> s;
vector<deque<string>> ss(n + 1);
set<string> cnt;
vvi board(n, vi(n));
int score = 0;

void setset(){
	rep(i, n){
		string t = "";
		rep(j, n) t += board[i][j] + 'A';
		rep(j, n){
			for(int k = 2; (k + j <= n && k <= 12); k++) cnt.insert(t.substr(j, k));
		}
	}
	rep(j, n){
		string t = "";
		rep(i, n) t += board[i][j] + 'A';
		rep(i, n){
			for(int k = 2; (k + i <= n && k <= 12); k++) cnt.insert(t.substr(i, k));
		}
	}
}
int calc_score(){
	cnt.clear();
	setset();
	int v = 0;
	rep(i, m) if(cnt.count(s[i])) v++;
	return v;
}
void random_select(){
	int num = rand() % 2 + 1;
	vector<tuple<int,int,int>> info;
	rep(_, num){
		int i = rand() % n;
		int j = rand() % n;
		int k = rand() % 8;
		info.push_back({i,j,board[i][j]});
		board[i][j] = k;
	}
	int val = calc_score();
	//もとに戻す
	if(score >= val) rep(i, num){
		int a,b,c;
		tie(a, b, c) = info[i];
		board[a][b] = c;
	}
	else score = val;
}
void tekitou_sort(){
	rep(i, n){
		int nokori = n;
		while(true){
			bool found = false;
			for(int j = nokori; j >= 0; j--) if(!ss[j].empty()){
				found = true;
				rep(k, j) board[i][n-nokori+k] = ss[j][0][k] - 'A';
				nokori -= j;
				ss[j].pop_front();
				break;
			}
			if(!found) break;
		}
	}
}
void inputs(){
	cin >> m >> m;
	s.resize(m);
	rep(i, m) cin >> s[i];
}

int main(){
	srand(time(NULL));
	inputs();
	rep(i, m) ss[s[i].size()].push_back(s[i]);

	rep(i, n) rep(j, n) board[i][j] = rand() % 8;
	tekitou_sort();
	score = calc_score();

	rep(i, 100) random_select();

	rep(i, n){
		rep(j, n) printf("%c", board[i][j] + 'A');
		printf("\n");
	}
}

#include <iostream>
using namespace std;

const int INF = 100000000;

int b[10005][102];

bool judge(int k, int n, int *a){
    for(int i = 0; i < k; i++){
        for(int j = 0; j <= n; j++){
            b[i][j] = a[j] / k;
            if(a[j] % k > i) b[i][j]++;
        }
    }
    for(int i = 0; i < k; i++){
        for(int j = 0; j < n; j++){
            if(b[i][j] == b[i][j + 1]) return false;
        }
    }
    return true;
}

int main()
{
    int n;
    cin >> n;
    string s;
    cin >> s;
    int a[102];
    for(int i = 0; i <= n; i++) cin >> a[i];
    int left = 1, right = 10001;
    while(right - left > 1){
        int mid = (right + left) / 2;
        if(judge(mid, n, a)) left = mid;
        else right = mid;
    }
    cout << left << endl;
    judge(left, n, a);
    for(int i = 0; i < left; i++){
        for(int j = 0; j <= n; j++) cout << b[i][j] << " ";
        cout << endl;
    }
}


#include <bits/stdc++.h>
using namespace std;
#define int long long
int32_t main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	int arr[3];
	for(int i=0;i<3;i++) cin>>arr[i];
	sort(arr,arr+3);
	cout<<arr[2]+arr[1];
	return 0;
}

#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define REP(i,m,n) for (int i = (m); i < (n); ++i)
#define rrep(i,n) for (int i = (n)-1; i >= 0; --i)
#define RREP(i,m,n) for (int i = (n)-1; i >= (m); ++i)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
using namespace std;
using ll = long long int;
using vec = vector<int>;
using P = pair<int,int>;
const int INF = 1e9+7;

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

  cout << max(max(a+b, b+c), a+c) << 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;

#define int                     long long int
#define ld                      long double
#define pb                      push_back
#define MOD                     1000000007
#define inf                     3e18
#define vi                      vector<int>
#define vld                     vector<ld>
#define pii                     pair<int,int>
#define mii                     map<int,int>
#define fi                      first
#define se                      second
#define fastIO                  ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define db(...)                 __f(#__VA_ARGS__, __VA_ARGS__)
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 tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update> pbds;
		//order_of_key (k) : Number of items strictly smaller than k .
		//find_by_order(k) : K-th element in a set (counting from zero) (returns an iterator)

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

int32_t main()
{
	fastIO
	inp_out();

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

	map < pii, int > mp;
	mp[{1, n + 1}] = 1;
	vector < pii > a(m);
	for(int i = 0; i < m; ++ i)
		cin >> a[i].fi >> a[i].se;

	mii last;
	last[n + 1] = 1;

	sort(a.begin(), a.end());

	for(int i = 0; i < m;)
	{
		int val = a[i].fi, j = i;
		while(a[j].fi == val)
		{
			mp[{a[j].fi + 1, a[j].se + 1}] = mp[{last[a[j].se], a[j].se}] | mp[{last[a[j].se + 2], a[j].se + 2}];
			++ j;
		}

		for(int k = i; k < j; ++ k)
			last[a[k].se + 1] = a[k].fi + 1;

		i = j;
	}

	int ans = 0;
	for(auto i : last)
		ans += mp[{i.se, i.fi}];
	cout << ans;

	return 0;
}

#include<bits/stdc++.h>
#define INF 1e9
using namespace std;
typedef long long ll;
typedef pair<int,int> pi;
int main(){
	int n,m,q;
	scanf("%d %d %d",&n,&m,&q);
	vector<bool> caja,prod;
	vector<pi> a(n),b(m);
	for(int i = 0; i < n; i++)
		scanf("%d %d",&a[i].second,&a[i].first);
	sort(a.begin(), a.end());
	for(int i = 0; i < m; i++){
		scanf("%d",&b[i].first);
		b[i].second = i;
	}
	sort(b.begin(), b.end());
	while(q--){
		int l,r;
		scanf("%d %d",&l,&r);
		caja.assign(m,true);
		prod.assign(n,true);
		l--;r--;
		for(l; l <= r; l++)
			caja[l]=0;
		ll ans = 0;
		for(int i = 0; i < m; i++){
			if(caja[b[i].second]){
				for(int j = n-1; j >= 0; j--){
					if(prod[j] && a[j].second <= b[i].first){
						ans += a[j].first;
						prod[j] = 0;
						caja[b[i].second]=0;
						break;
					}
				}
			}
		}
		printf("%lld\n", ans);
	}
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
int main(){
  int n,m;
  cin>>n>>m;
  vector<int>a(n);
  char c;
  for(int i=0;i<n;i++){
    for(int j=0;j<m;j++){
      cin>>c;
      if(c=='1'){
        a[i]|=1<<j;
      }
    }
  }
  int64_t even=0,odd=0;
  for(int i=1;i<n;i++){
    if(__builtin_popcount(a[0]^a[i])%2==0)even++;
    else odd++;
  }
  cout<<odd+even*odd<<'\n';
}

#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 a, b;
  cin >> a >> b;
  ll c = min(a, b);
  vl ans;
  rep2(i, 1, c-1) {
    ans.push_back(i);
    ans.push_back(-i);
  }

  if(a < b) {
    ll tmp = 0;
    rep2(i, c, c+b-a) {
      tmp += i;
      ans.push_back(-i);
    }
    ans.push_back(tmp);
  }

  if(a == b) {
    ans.push_back(c);
    ans.push_back(-c);
  }

  if(a > b) {
    ll tmp = 0;
    rep2(i, c, c+a-b) {
      tmp += i;
      ans.push_back(i);
    }
    ans.push_back(-tmp);
  }

  for(ll num: ans) cout << num << ' ';
  cout << newl;
  return 0;
}


#include <iostream>
#include <vector>
#include <math.h>
#include <algorithm>

using namespace std;

int main()
{
    // input
    long long t, N;
    cin >> t >> N;

    // for (int i = 1; i <= 100; i++)
    // {
    //     cout << i << " " << (100 + t) / 100.0 * i << endl;
    // }

    cout << (long long)(100.0 / t * N + 0.99) + N - 1 << endl;
}

#include "bits/stdc++.h"
using namespace std;
#define int long long
#define FOR(n) for(int i=0;i<n;i++)
#define rep(i,j,n) for(int i=j;i<n;i++)
#define pb push_back
#define ppb pop_back()
#define mod 1000000007
#define all(v) v.begin(),v.end()
#define every(a,n) a,a+n
#define mp make_pair
#define F first
#define S second
#define max(a, b) (a < b ? b : a)
#define min(a, b) ((a > b) ? b : a)
#define tez ios_base::sync_with_stdio(false);cin.tie(NULL);
#define all_st for(auto it=st.begin();it!=st.end();it++)
#define mp_x unordered_map<int,int>x
#define endl "\n"
#define sz(x) (int)x.size()

void solve()
{
    double a,b;
    cin>>a>>b;
    if(a==0){
        cout<<0;
        return;
    }
    else{
        cout<<(double)(a/100)*(double)b;
    }
}

signed main()
{
    tez
    int test_case=1;
    //cin>>test_case;
    for(int i=1;i<=test_case;i++)
    {
    solve();
    }
}


#include <bits/stdc++.h>

using namespace std;
using ll = long long;

const int N = 5e5 + 5;

int main() {
	ios :: sync_with_stdio(0), cin.tie(0);
	ll s, p;
	cin >> s >> p;
	for (ll i = 2; i * i <= p; ++i) {
		if (p % i == 0) {
			if (i + (p / i) == s) {
				cout << "Yes";
				return 0;
			}
		}
	}
	if (p + 1 == s) {
		cout << "Yes";
	}
	else {
		cout << "No";
	}
	return 0;
}

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

int main(){
	int n,w;
    cin>>n>>w;
  cout<<n/w;
}


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

int main(){
  int n,x;
  cin >> n>> x;
  vector<char>s(n);
  for(int i=0;i<n;i++){
    cin >> s.at(i);
  }

  for(int i=0;i<n;i++){
    if(s.at(i)=='o'){
        x++;
    }

    else{
      if(x>0)
        x--;
    }
  }
  cout<<x;
}

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

// input
#define INIT std::ios::sync_with_stdio(false);std::cin.tie(0);
#define VAR(type, ...)type __VA_ARGS__;MACRO_VAR_Scan(__VA_ARGS__); // __VA_ARGS__可変引数マクロ
template<typename T> void MACRO_VAR_Scan(T& t) { std::cin >> t; }
template<typename First, typename...Rest>void MACRO_VAR_Scan(First& first, Rest& ...rest) { std::cin >> first; MACRO_VAR_Scan(rest...); }
#define VEC(type, c, n) std::vector<type> c(n);for(auto& i:c)std::cin>>i;
#define MAT(type, c, m, n) std::vector<std::vector<type>> c(m, std::vector<type>(n));for(auto& R:c)for(auto& w:R)std::cin>>w;
// output
template<typename T>void MACRO_OUT(const T t) { std::cout << t; }
template<typename First, typename...Rest>void MACRO_OUT(const First first, const Rest...rest) { std::cout << first << " "; MACRO_OUT(rest...); }
#define OUT(...) MACRO_OUT(__VA_ARGS__);
#define FOUT(n, dist) std::cout<<std::fixed<<std::setprecision(n)<<(dist); // std::fixed 浮動小数点の書式 / setprecision 浮動小数点数を出力する精度を設定する。
#define SP std::cout<<" ";
#define TAB std::cout<<"\t";
#define BR std::cout<<"\n";
#define SPBR(w, n) std::cout<<(w + 1 == n ? '\n' : ' ');
#define ENDL std::cout<<std::endl;
#define FLUSH std::cout<<std::flush;
// utility
#define ALL(a) (a).begin(),(a).end()
#define REP(w, n) for(int w=0;w<int(n);++w)
#define IN(a, x, b) (a<=x && x<b)
template<class T> inline T CHMAX(T & a, const T b) { return a = (a < b) ? b : a; }
template<class T> inline T CHMIN(T& a, const T b) { return a = (a > b) ? b : a; }
template<class T> using V = std::vector<T>;
template<class T> using VV = V<V<T>>;

using ll = long long;
using ull = unsigned long long;
using ld = long double;
using PAIR = std::pair<int, int>;
using PAIRLL = std::pair<ll, ll>;
constexpr int INFINT = (1 << 30) - 1;                    // 1.07x10^ 9
constexpr int INFINT_LIM = (1LL << 31) - 1;              // 2.15x10^ 9
constexpr ll INFLL = 1LL << 60;                          // 1.15x10^18
constexpr ll INFLL_LIM = (1LL << 62) - 1 + (1LL << 62);  // 9.22x10^18
constexpr double eps = 1e-7;
constexpr int MOD = 1000000007;
constexpr double PI = 3.141592653589793238462643383279;
template<class T, size_t N> void FILL(T(&a)[N], const T & val) { for (auto& x : a) x = val; }   //  int a[5] = {1,2,3,4,5};	FILL(a,10);
template<class ARY, size_t N, size_t M, class T> void FILL(ARY(&a)[N][M], const T & val) { for (auto& b : a) FILL(b, val); }  // ２次元配列でもそのまま使える
template<class T> void FILL(std::vector<T> & a, const T & val) { for (auto& x : a) x = val; }   //	使い方 vector<int> a(3);	FILL(a,10);
template<class ARY, class T> void FILL(std::vector<std::vector<ARY>> & a, const T & val) { for (auto& b : a) FILL(b, val); }  // ２次元配列でもそのまま使える
// ------------>8------------------------------------->8------------

int main() {
	INIT;

VAR(int,n,x)
VAR(string,s)

REP(i,n){
	if (s[i] == 'x')
	{
		x -= 1;
		if (x<0)
		{
			x = 0;
		}

	}
	else
	{
		x += 1;
	}
}
OUT(x)

return 0;
}


#include <bits/stdc++.h>

using namespace std;
using pii = pair<int, int>; // <value, weight>

int main() {
  bool box_state[50];

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

  vector<pii> ni;
  vector<pii> ni_copy;
  for (int i = 0; i < n; i++) {
    int w, v;
    cin >> w >> v;
    ni.push_back(make_pair(v, w));
    ni_copy.push_back(make_pair(v, w));
  }
  sort(ni.begin(), ni.end()); // 後ろ（大きいほう）から出していく
  sort(ni_copy.begin(), ni_copy.end());

  vector<int> box_size_tmp(m), box_size;
  for (int& e : box_size_tmp) cin >> e;
  for (int k = 0; k < q; k++) {
    int from, to;
    cin >> from >> to;

    // 初期化部分
    for (int j = 0; j < 50; j++) box_state[j] = true;
    for (int j = from - 1; j < to; j++) {
      box_state[j] = false;
    }
    box_size.clear();
    ni.resize(ni_copy.size());

    for (int j = 0; j < (int)ni_copy.size(); j++) ni[j] = ni_copy[j];
    for (int j = 0; j < m; j++) {
      if (box_state[j]) box_size.push_back(box_size_tmp[j]);
    }
    sort(box_size.begin(), box_size.end());

    int sum_value = 0;
    while (!ni.empty() && !box_size.empty()) {
      pii tmp = ni[(int)ni.size() - 1];
      int value = tmp.first, weight = tmp.second;
      if (weight <= box_size[(int)box_size.size() - 1]) {
        for (int i = 0; i < (int)box_size.size(); i++) {
          if (box_size[i] >= weight) {
            sum_value += value;

            // cout << "a" << box_size.size() << "b" << endl;
            box_size.erase(box_size.begin() + i);
            break;
          }
        }
      }
      ni.pop_back();
    }
    cout << sum_value << endl;
  }
}

#include <bits/stdc++.h>
#include <string>
#define MAX 100007
#define scn1(a) scanf("%d", &a);
#define scn2(a, b) scanf("%d %d", &a, &b);
#define scn3(a, b, c) scanf("%d %d %d", &a, &b, &c);
#define lscn1(a) scanf("%lli", &a);
#define lscn2(a, b) scanf("%lli %lli", &a, &b);
#define lscn3(a, b, c) scanf("%lli %lli %lli", &a, &b, &c);
#define prnt(a) printf("%d\n", a);
#define forr(i, a, n) for(int i=a;i<n;i++)
#define nl puts("");
#define PB push_back
#define enl cout << "\n";
#define CHK(a) cout << (#a) << " = " << (a) << endl;
typedef long long int ll;
using namespace std;
void arraychk(int a[],int n) {for(int i=0;i<n;i++)cout<<a[i]<<" ";enl;}
#define LOOPCHK(a, n) arraychk(a, n);

int main()
{
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    ll tt=1;
    // cin >> tt;
    for(int cse=1; cse<=tt; cse++)
    {
        int n=0, x=0, y=0, ans=0, sum=0;

        cin >> n;
        double a[n], b[n];
        forr(i, 0, n)
            cin >> a[i] >> b[i];
        forr(i, 0, n)
        {
            forr(j, i+1, n)
            {
                if( ((b[j]-b[i])/(a[j]-a[i]))<=1 && ((b[j]-b[i])/(a[j]-a[i]))>=-1 )
                {
                    ans++;
                }
            }
        }
        // cout << "Case " << cse <<  ":";
        cout << ans << endl;
    }
    return 0;
}