#include<cstdio>
#include<cmath>

#define db double
#define ri register int

#define sqr(x) ((x)*(x))
#define eps 1e-6

using namespace std;

const int MAXN=100+10;

int n;
int x[MAXN],y[MAXN];
db sdis(int i,int j){return sqr(x[i]-x[j])+sqr(y[i]-y[j]);}

int fa[MAXN];
int get_fa(int u){return u==fa[u]?u:fa[u]=get_fa(fa[u]);}
void merge(int u,int v){fa[get_fa(u)]=get_fa(v);}
bool check(db r)
{
	for(ri i=0;i<=n+1;++i)fa[i]=i;
	for(ri i=1;i<=n;++i)
		for(ri j=i+1;j<=n;++j)if(sdis(i,j)<sqr(r*2))
			merge(i,j);
	for(ri i=1;i<=n;++i)if(sqr(100-y[i])<sqr(r*2))merge(i,0);
	for(ri i=1;i<=n;++i)if(sqr(y[i]+100)<sqr(r*2))merge(i,n+1);
	return get_fa(0)!=get_fa(n+1);
}

int main()
{
//	freopen("1.in","r",stdin);

	scanf("%d",&n);
	for(ri i=1;i<=n;++i)scanf("%d %d",&x[i],&y[i]);

	db l=0,r=100,m;
	while(r-l>eps)
	{
		m=(l+r)/2;
		if(check(m))l=m;
		else r=m;
	}
	printf("%lf\n",l);

	return 0;
}

//
//  main.cpp
//

#include <algorithm>
#include <array>
#include <assert.h>
#include <complex>
#include <iomanip>
#include <iostream>
#include <limits>
#include <inttypes.h>
#include <map>
#include <math.h>
#include <memory>
#include <memory>
#include <queue>
#include <random>
#include <set>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <vector>
// #include <atcoder/dsu>
// using namespace atcoder;
// using mint = modint1000000007;
// using mint = modint998244353;
// using mint = modint;

using namespace std;

using ll = int64_t;
using ull = uint64_t;

[[maybe_unused]] constexpr ll LL_MAX = numeric_limits<ll>::max();
[[maybe_unused]] constexpr ll LL_MIN = numeric_limits<ll>::min();
[[maybe_unused]] constexpr ull ULL_MAX = numeric_limits<ull>::max();

#define rep(i, a, b) for (ll i = (a); i < (b); i++)
#define rrep(i, a, b) for (ll i = (a)-1; i >= (b); i--)

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

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

ll csum(ll x, ll y) {
	if (x > 0 && y > 0 && x > LL_MAX - y) {
		return LL_MAX;
	}
	if (x < 0 && y < 0 && x < LL_MIN - y) {
		return LL_MIN;
	}
	return x + y;
}

ll readi() {
	ll ret;
	scanf("%" PRId64 "", &ret);
	return ret;
}

vector<ll> readvi(ll n) {
	vector<ll> ret(n);
	rep(i, 0, n) { ret[i] = readi(); }
	return ret;
}

double readf() {
	double ret;
	scanf("%lf", &ret);
	return ret;
}

string reads() {
	string s;
	cin >> s;
	return s;
}

void writei(ll x) {
	printf("%" PRId64 "\n", x);
}

void writevi(const vector<ll>& xs) {
    rep(i,0,xs.size()) {
        if (i < xs.size() - 1) {
            printf("%" PRId64 " ", xs[i]);
        } else {
            printf("%" PRId64 "\n", xs[i]);
        }
    }
}

void writes(const string& s) {
	cout << s.c_str() << endl;
}

void writef(double x) {
	printf("%.10f\n", x);
}

template<typename T>
vector<T> make_vec_nd(T init, ll size) {
	return vector<T>(size, init);
}
template<typename T, typename... Args>
auto make_vec_nd(T init, ll size, Args... rest) {
	auto inner = make_vec_nd(init, rest...);
	return vector<decltype(inner)>(size, inner);
}

struct UnionFind {
	vector<size_t> parent;
	vector<size_t> rank;
	size_t find_parent(size_t x) {
		if (parent[x] == x) {
			return x;
		} else {
			parent[x] = find_parent(parent[x]);
			return parent[x];
		}
	}
	explicit UnionFind(size_t size) {
		parent.resize(size);
		rank.resize(size);
		for (size_t i = 0; i < size; i++) {
			parent[i] = i;
			rank[i] = 0;
		}
	}
	virtual ~UnionFind() {}
	void unite(size_t x, size_t y) {
		size_t px = find_parent(x);
		size_t py = find_parent(y);
		if (px == py) {
			return;
		}
		if (rank[px] < rank[py]) {
			parent[px] = py;
		} else if (rank[px] > rank[py]) {
			parent[py] = px;
		} else {	// rank[px] == rank[py]
			parent[py] = px;
			rank[px]++;
		}
	}
	bool is_same(size_t x, size_t y) {
		return find_parent(x) == find_parent(y);
	}
	unordered_map<size_t, set<size_t>> create_map_parent_to_elements() {
		unordered_map<size_t, set<size_t>> ans;
		for (size_t i = 0; i < parent.size(); i++) {
			ans[find_parent(i)].insert(i);
		}
		return ans;
	}
};

struct P {
	double x;
	double y;
	double dist(const P& rhs) const {
		double sq = (x - rhs.x) * (x - rhs.x) + (y - rhs.y) * (y - rhs.y);
		return sqrt(sq);
	}
};

int main() {
	ll N = readi();
	vector<P> pts(N);
	rep(i,0,N) {
		pts[i].x = readi();
		pts[i].y = readi();
	}
	double good = 0.0;
	double bad = 100.0;
	while (bad - good > 1.0e-5) {
		double mid = (good + bad) / 2;
		UnionFind tree(N + 2);
		rep(i,0,N) {
			P a = pts[i];
			rep(j,i+1,N) {
				P b = pts[j];
				if (a.dist(b) < 2*mid) {
					tree.unite(i, j);
				}
			}
			if (a.y + 100 < 2*mid) {
				tree.unite(i, N);
			}
			if (100 - a.y < 2*mid) {
				tree.unite(i, N+1);
			}
		}
		if (tree.is_same(N, N+1)) {
			bad = mid;
		} else {
			good = mid;
		}
	}
	writef(good);
}


#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const double pi = acos(-1);
#define FOR(i,a,b) for (ll i=(a),__last_##i=(b);i<__last_##i;i++)
#define RFOR(i,a,b) for (ll i=(b)-1,__last_##i=(a);i>=__last_##i;i--)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define __GET_MACRO3(_1, _2, _3, NAME, ...) NAME
#define rep(...) __GET_MACRO3(__VA_ARGS__, FOR, REP)(__VA_ARGS__)
#define rrep(...) __GET_MACRO3(__VA_ARGS__, RFOR, RREP)(__VA_ARGS__)
template<typename T> ostream& operator<<(ostream& os, const vector<T>& v) {
REP(i,v.size()){if(i)os<<" ";os<<v[i];}return os;}
template<typename T> ostream& operator<<(ostream& os, const vector<vector<T>>& v) {
REP(i,v.size()){if(i)os<<endl;os<<v[i];}return os;}

int main() {
ll n,input;
string input2;
cin>>n;
vector<ll>hight(n);
map<ll,string>m;
rep(i,n){
    cin>>input2;
    cin>>input;
    hight[i]=input;
    m[input]=input2;
}
sort(hight.begin(),hight.end());
cout<<m[hight[n-2]]<<endl;
}

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

vector <string> solve(int x) {
  if (x == 1) {
    vector <string> tmp{"AB"};
    return tmp;
  }
  vector <string> a, b;
  a = solve(x - 1);
  for (auto s : a) {
    string r, t;
    for (auto c : s)
      if (c == 'A') r += "AB", t += "AA";
      else r += "BA", t += "BB";
    b.push_back(r);
    b.push_back(t);
  }
  string s;
  for (int i = 1; i <= (1 << (x - 1)); i ++) s += "AB";
  b.push_back(s);
  return b;
}

int main() {
  int x; cin >> x;
  vector <string> tmp = solve(x);
  cout << tmp.size() << endl;
  for (auto s : tmp) cout << s << endl;
}


#include <bits/stdc++.h>
using namespace std;
using LL = long long;
LL N, fib[100];
vector<int> ans;
int vis[100];
void print() {
    LL x = 0, y = 0;
    for (int i : ans) {
        if (i == 1) x++;
        if (i == 2) y++;
        if (i == 3) x = x + y;
        if (i == 4) y = x + y;
    }
    cerr << x << endl;
}
int main() {
#ifndef ONLINE_JUDGE
    freopen("cpp.in", "r", stdin);
#endif
    fib[0] = fib[1] = 1;
    for (int i = 2; i < 90; i++) fib[i] = fib[i - 1] + fib[i - 2];
    cin >> N;
    for (int i = 89; ~i; i--)
        if (N >= fib[i]) N -= fib[i], vis[i] = 1;
	int lim = 0;
	for (int i = 1; i < 90; i++) if (vis[i]) lim = i;
    for (int i = lim, j = 1; ~i; i--, j++) {
        if (vis[i]) {
            if (i & 1) ans.push_back(2);
            else ans.push_back(1);
        }
        if (j & 1) ans.push_back(4);
        else ans.push_back(3);
    }
    //print();
    printf("%lu\n", ans.size());
    for (int i : ans) printf("%d\n", i);
    return 0;
}

#include <bits/stdc++.h>
using namespace std;
#define SZ(x) ((int)(x).size())
#define all(x) (x).begin(), (x).end()
#define loop(i, a) for (int i = 0; i < (a); ++i)
#define cont(i, a) for (int i = 1; i <= (a); ++i)
#define circ(i, a, b) for (int i = (a); i <= (b); ++i)
#define range(i, a, b, c) for (int i = (a); (c) > 0 ? i <= (b) : i >= (b); i += (c))
#define parse(it, x) for (auto &it : (x))
#define pub push_back
#define pob pop_back
#define emb emplace_back
#define mak make_pair
#define mkt make_tuple
typedef long long ll;
typedef long double lf;
const int Inf = 0x3f3f3f3f;
const ll INF = 0x3f3f3f3f3f3f3f3fll;

mt19937_64 Rand(chrono::steady_clock::now().time_since_epoch().count());
ll n;

ll calc(ll x) {
    ll y = n;
    ll cs = 0;
    while (y) {
        cs += x / y;
        x %= y;
        swap(x, y);
    }
    return cs + x;
}

int main() {
    cin >> n;
    while (1) {
        ll m = uniform_int_distribution<ll>(0, n)(Rand);
        if (calc(m) <= 130) {
            ll x = n, y = m;
            vector<int> ans;
            while (x && y) {
                if (x < y) {
                    y -= x;
                    ans.pub(4);
                }
                else {
                    x -= y;
                    ans.pub(3);
                }
            }
            while (x) --x, ans.pub(1);
            while (y) --y, ans.pub(2);
            reverse(all(ans));
            printf("%d\n", SZ(ans));
            parse(i, ans) printf("%d\n", i);
            return 0;
        }
    }
}


#include <bits/extc++.h>
using namespace std;
using ll = long long;
#define REP(i,n) for(int i=0;i<int(n);i++)
#define FOR(i,a,b) for(int i=a;i<=int(b);i++)
#define ALL(x) x.begin(),x.end()
#define MOD (ll)1000000007
set<ll> ans;
vector<pair<ll, ll>> xy;

signed main() {
  ll n;
  int m;
  cin >> n >> m;
  ans.insert(n);
  xy.resize(m);
  REP(i, m){
    ll x, y;
    cin >> x >> y;
    xy[i] = make_pair(x, y);
  }
  ll xb = 0;
  if(m > 0) {
    sort(xy.begin(), xy.end());
    xb = xy[0].first;
  }
  vector<ll> dellist(0);
  vector<ll> addlist(0);
  REP(i, m){
    ll x, y;
    tie(x, y) = xy[i];
    if(xb != x){
      for(ll del: dellist){
        if(ans.find(del) != ans.end()) ans.erase(del);
      }
      for(ll add: addlist){
        if(ans.find(add) == ans.end()) ans.insert(add);
      }
      dellist.clear();
      addlist.clear();
    }
    if(ans.find(y) != ans.end()){
      dellist.push_back(y);

    }
    if(y - 1 >= 0){
      if(ans.find(y - 1) != ans.end()){
        addlist.push_back(y);
      }
    }
    if(y + 1 <= 2 * n){
      if(ans.find(y + 1) != ans.end()){
        addlist.push_back(y);
      }
    }
    xb = x;
  }
  for(ll del: dellist){
    if(ans.find(del) != ans.end()) ans.erase(del);
  }
  for(ll add: addlist){
    if(ans.find(add) == ans.end()) ans.insert(add);
  }
  cout << ans.size();
  return 0;
}


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

int main(){
  int N;
  cin>>N;
  int A[N];
  for(int i = 0; i < N; i++){
    cin>>A[i];
  }
  int count = 0;
  for(int i = 0; i < N; i++){
    if(A[i] <= 10){

    }else if(A[i] > 10){
      count += A[i] - 10;
    }else{

    }
  }
  cout<<count<<endl;
  return 0;
}

#include<iostream>
#include<algorithm>
#include<vector>
#include<set>
using namespace std;

struct UF{
    vector<int> p;
    UF(int n):p(n, -1){}

    int leader(int x){
        if(p[x] < 0)return x;
        return p[x] = leader(p[x]);
    }

    void merge(int a, int b){
        a = leader(a);
        b = leader(b);
        if(a == b)return;
        p[a] += p[b];
        p[b] = a;
    }
};

set<int> leaders;

int main(){
    int n, f;
    cin >> n;
    UF uf(n+1);
    for(int i = 1;i <= n;i++){
        cin >> f;
        uf.merge(i, f);
    }
    for(int i = 1;i <= n;i++){
        leaders.insert(uf.leader(i));
    }
    long long ans = 1;
    for(int i = 0;i < leaders.size();i++){
        ans = (ans + ans) % 998244353;
    }
    ans--;
    cout << ans << endl;
    return 0;
}


#include <bits/stdc++.h>

#define int long long
#define ll long long
#define ld long double

#define mod 1000000007
#define mod2 998244353
#define ff first
#define ss second
#define pb push_back
#define endl "\n"

#define vi vector<int>
#define si set<int>
#define pii pair<int,int>
#define mii map<int,int>
#define umii unordered_map<int,int>
#define vii vector<pii>
#define sii set<pii>
#define vvi vector<vi>
#define vvii vector<vii>
#define vsi vector<si>

#define in(arr,n) for(int i=0;i<n;i++)cin>>arr[i];
#define out(arr,n) for(int i=0;i<n;i++)cout<<arr[i]<<" ";cout<<endl;
#define inn(arr,m,n) for(int i=m;i<n;i++)cin>>arr[i];
#define outt(arr,m,n) for(int i=m;i<n;i++)cout<<arr[i]<<" ";cout<<endl;

#define narr int arr[n];in(arr,n)
#define nbrr int brr[n];in(brr,n)
#define intt(n,m) int n,m;cin>>n>>m;

using namespace std;
void solve1();

int power(int x, int y, int p){
    //if(x==0&&y==0)return 1;
    int res = 1;x = x % p;if (x == 0) return 0;
    while (y > 0){if (y & 1)res = (res*x) % p;y = y>>1;x = (x*x) % p;}
    return res;
}
int power(int x, int y){
    //if(x==0&&y==0)return 1;
    int res = 1;if (x == 0) return 0;
    while (y > 0){if (y & 1)res = (res*x);y = y>>1;x = (x*x);}
    return res;
}
int fib(int s1) {
    int s2, s4, s5, s3;
    s2 = s3 = 1;
    s4 = s5 = 0;
    while (s1 > 0) {
        if (s1 % 2 == 0) {
            int s6 = s3*s3;
            s3 = 2*s5*s3 + s6;
            s5 = s5*s5 + s6;
            s1 /= 2;
        } else {
            int s6 = s2*s3;
            s2 = s4*s3 + s6 + s2*s5;
            s4 = s4*s5 + s6;
            s1 -= 1;
        }
    }
    return s4;
}
int sum(int arr[],int a,int n)
{
    int zz=0;
    for(int i=a;i<n;i++)
    {
        zz+=arr[i];
    }
    return zz;
}
void solve(){
    int t;cin>>t;
    while(t--){solve1();}
}
signed main()
{
    //std::ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
    solve1();
    return 0;
}

void solve1()
{
    int n,m,a,b;cin>>n>>m;
    if(n==1&&m==0)
    {
        cout<<1<< " "<<3<<endl;return;
    }
    if(((m<0)||(m>=n-1)))
    {
        cout<<-1<<endl;return;
    }
    int arr[n][2];
    arr[0][0]=2;arr[0][1]=4;
    for(int i=1;i<n;i++)
    {
        arr[i][0]=arr[i-1][0]+4;
        arr[i][1]=arr[i-1][1]+4;
    }
    if(m>0)
    {
        arr[0][1]+=(m)*4+3;
    }
    else if(m<0)
    {
        arr[n-1][0]-=3+(abs(m))*4;
    }
    for(int i=0;i<n;i++)
    {
        cout<<arr[i][0]<<" "<<arr[i][1]<<endl;
    }
}

#include<iostream>
#include<iomanip>
#include<cmath>
#include<string>
#include<cstring>
#include<vector>
#include<list>
#include<algorithm>
#include<map>
#include<set>
#include<queue>
#include<stack>
using namespace std;
typedef long long ll;
#define fi first
#define se second
#define mp make_pair
#define mt make_tuple
#define pqueue priority_queue
const int inf=1e9+7;
const ll mod=1e9+7;
const ll mod1=998244353;
const ll big=1e18;
const double PI=2*asin(1);

int main() {
  ll N, M;
  cin>>N>>M;
  vector<pair<ll, ll> > ans;
  if(M>=0) {
    if(N==1 && M==0) {
      cout<<1<<" "<<2<<endl;
      return 0;
    }
    if(M>N-2) {
      cout<<-1<<endl;
      return 0;
    }
    ll now1 = 1, now2 = (ll)1e9;
    for(ll i=0;i<=N-(M+2);++i) {
      ans.push_back(mp(now1, now2));
      now1++;
      now2--;
    }
    for(ll i=0;i<M+1;++i) {
      ans.push_back(mp(now1, now1+1));
      now1 += 2;
    }
  }
  else {
    cout<<-1<<endl;
    return 0;
  }
  for(ll i=0;i<N;++i) cout<<ans[i].fi<<" "<<ans[i].se<<endl;
}


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

using ll = long long;
using ii = pair<int, int>;
using vi = vector<int>;
#define all(v) begin(v), end(v)
#define sz(v) (int)(v).size()
#define fi first
#define se second

const int N = 1e5 + 5;

int n, dp[N];

int main(int argc, char const *argv[])
{
#ifdef LOCAL
  freopen("in", "r", stdin);
#endif
  cin >> n;
  for(int i = n; i >= 1; --i) {
    dp[i] = 1;
    for(int j = i+i; j <= n; j += i) {
      dp[i] = max(dp[i], dp[j]+1);
    }
  }
  for(int i = 1; i <= n; ++i)
    cout << dp[i] << ' ';
  cout << endl;
  return 0;
}
/*
* use std::array instead of std::vector, if u can
* overflow?
* array bounds
*/

#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#include<functional>
#include<assert.h>
#include<numeric>
using namespace std;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
using ll = long long;
constexpr int inf=1e9+7;
constexpr ll longinf=1LL<<60 ;
constexpr ll mod=1e9+7 ;

int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int n;
    cin>>n;
    vector<vector<ll>> c(n,vector<ll>(n));
    rep(i,n){
        rep(j,n)cin>>c[i][j];
    }
    vector<ll> a(n), b(n);
    rep(i,n)a[i]=c[i][0];
    rep(i,n)b[i]=c[0][i];
    ll ami = inf,bmi=inf;
    rep(i,n)ami=min(a[i],ami);
    rep(i,n)bmi=min(b[i],bmi);
    if(ami+bmi<c[0][0]){
        cout<<"No"<<endl;
        return 0;
    }
    rep(i,n)a[i]-=ami;
    rep(i,n)b[i]-=(c[0][0]-ami);
    rep(i,n)rep(j,n){
        if(a[i]+b[j]!=c[i][j]){
            cout<<"No"<<endl;
            return 0;
        }
    }
    cout<<"Yes"<<endl;
    rep(i,n)cout<<a[i]<<" \n"[i+1==n];
    rep(i,n)cout<<b[i]<<" \n"[i+1==n];
    return 0;
}


#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cstring>
using namespace std;
char s[30];
int main()
{
	int n,m;
	scanf("%d%d",&n,&m);
	int cnt0=0,cnt1=0;
	for(int i=1;i<=n;i++)
	{
		scanf("%s",s+1);
		int cnt=0;
		for(int j=1;j<=m;j++)cnt+=(s[j]==49);
		if(cnt&1) cnt1++;
		else cnt0++;
	}
	printf("%lld",(long long)cnt0*cnt1);
	return 0;
}

#include "bits/stdc++.h"
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<int, int>;
using vi = vector<int>;
using vvi = vector<vi>;
const int INF = 1e9;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep2(i, x, n) for(int i = x; i < (n); i++)
#define all(n) begin(n), end(n)

void Main() {
    int n, m;
    cin >> n >> m;
    vector<string> s(n);
    rep(i, n) cin >> s[i];
    vector<int> cnt(n);
    rep(i, n) rep(j, m) if(s[i][j] == '1')++ cnt[i];
    ll sum = 0;
    vector<int> r(n);
    ll sum2 = 0;
    vector<int> r2(n);
    rep(i, n) {
        if(cnt[i] % 2 == 1) {
            ++sum;
        } else {
            ++sum2;
        }
        r[i] = sum;
        r2[i] = sum2;
        // cout << sum << endl;
        // cout << sum2 << endl;
    }
    ll ans = 0;
    rep(i, n) {
        if(cnt[i] % 2 == 1) {
            // cout << sum2 << " " << r2[i] << endl;
            ans += sum2 - r2[i];
        } else {
            // cout << sum << " " << r[i] << endl;
            ans += sum - r[i];
        }
    }
    cout << ans << endl;
}

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


#include <bits/stdc++.h>
// #include <atcoder/all>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define srep(i, s, t) for (int i = s; i < t; ++i)
#define drep(i, n) for (int i = (n)-1; i >= 0; --i)
using namespace std;
// using namespace atcoder;
typedef long long int ll;
typedef pair<int, int> P;
#define yn         \
  { puts("Yes"); } \
  else {           \
    puts("No");    \
  }
#define MAX_N 200005

int main() {
  int n;
  cin >> n;
  ll ans = 0;
  ll sum = 0;
  while (sum < n) {
    ans++;
    sum += ans;
  }
  cout << ans << endl;
  return 0;
}

#include<bits/stdc++.h>

#define int long long
#define fer( a , b , c ) for( register int a = b ; a <= c ; a ++ )
#define der( a , b , c ) for( register int a = b ; a >= c ; a -- )

  using namespace std ;

inline int read(){
	int sum = 0 , f = 1 ;
	char ch = getchar() ;
	while( ch < '0' || ch > '9' ){
		if( ch == '-' ){
			f = -1 ;
		}
		ch = getchar() ;
	}
	while( ch >= '0' && ch <= '9' ){
		sum = ( sum << 1 ) + ( sum << 3 ) + ( ch ^ 48 ) ;
		ch = getchar() ;
	}
	return sum * f ;
}

int s , p ;

signed main(){
    s = read() , p = read() ;
    fer( i , 1 , 10000005 ) if( p % i == 0 ) if( i + ( p / i ) == s ){ puts( "Yes" ) ; return 0 ; }
    puts( "No" ) ;
	return 0 ;
}


#include <bits/stdc++.h>
using namespace std;
#define pi 3.1415926536
#define ll long long int
#define mod 1000000007
#define fastio ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);

int main(){
fastio

    ll n;
    cin>>n;

    ll res=(1LL<<60);
    ll a,b,c;
    for(int i=0;i<60;i++){
        //cout<<a<<b<<c<<endl;
        b=i;
        a=n/(1LL<<i);
        c=n-(a*(1LL<<i));

        res=min(res,a+b+c);

    }
    cout<<res<<endl;
    return 0;
}

#pragma GCC optimize("Ofast,unroll-loops")
#pragma GCC target("avx,avx2,sse,sse2")
#include <functional>
template <typename T>
inline void hash_combine(std::size_t &seed, const T &val) {
    seed ^= std::hash<T>()(val) + 0x9e3779b9 + (seed << 6) + (seed >> 2);
}
template <typename T> inline void hash_val(std::size_t &seed, const T &val) {
    hash_combine(seed, val);
}
template <typename T, typename... Types>
inline void hash_val(std::size_t &seed, const T &val, const Types &... args) {
    hash_combine(seed, val);
    hash_val(seed, args...);
}
template <typename... Types>
inline std::size_t hash_val(const Types &... args) {
    std::size_t seed = 0;
    hash_val(seed, args...);
    return seed;
}
struct pair_hash {
    template <class T1, class T2>
    std::size_t operator()(const std::pair<T1, T2> &p) const {
        return hash_val(p.first, p.second);
    }
};
#include<bits/stdc++.h>
#include<unordered_set>
#include<unordered_map>
#define INF 0x3f3f3f3f
#define mod 1000000007
#define G 3
#define MAX_N 300005
using namespace std;
typedef long long ll;
typedef pair<int,int>P;
typedef complex<double> E;
string a,b="ZONe";
int main(){
    cin>>a;
    int ans=0;
    for(int i=0;i<9;i++){
        bool f=1;
        for(int j=i;j<i+4;j++)if(a[j]!=b[j-i])f=0;
        if(f)ans++;
    }
    cout<<ans;
    return 0;
}


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

// template {{{
#define  range(i, l, r) for (int i = (int)(l); i < (int)(r); (i) += 1)
#define rrange(i, l, r) for (int i = (int)(r) - 1; i >= (int)(l); (i) -= 1)

#define  whole(f, x, ...) ([&](decltype((x)) container) { return (f)(  begin(container),  end(container), ## __VA_ARGS__); })(x)
#define rwhole(f, x, ...) ([&](decltype((x)) container) { return (f)( rbegin(container), rend(container), ## __VA_ARGS__); })(x)

#define debug(x) cerr << "(" << __LINE__ << ")" << #x << ": " << (x) << endl

using i32 = int;
using u32 = unsigned int;
using i64 = long long;
using u64 = unsigned long long;

constexpr i32 mod   = 1e9 + 7;
// constexpr i32 mod   = 998244353;

constexpr i32 inf   = 1001001001;
constexpr i64 infll = 1001001001001001001ll;

constexpr i32 dx[] = {0, -1, 1, 0, -1, 1, -1, 1};
constexpr i32 dy[] = {-1, 0, 0, 1, -1, -1, 1, 1};

struct IoSetup { IoSetup(i32 x = 15){ cin.tie(0); ios::sync_with_stdio(0); cout << fixed << setprecision(x); cerr << fixed << setprecision(x); } } iosetup;

template <typename T = i64> T input() { T x; cin >> x; return x; }

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

template <typename T1, typename T2> ostream &operator<<(ostream &os, pair<T1, T2> p) { os << "(" << p.first << ", " << p.second << ")"; return os; }
template <typename T1, typename T2> istream &operator>>(istream &is, pair<T1, T2> &p) { is >> p.first >> p.second; return is; }

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

template <typename T1, typename T2> inline bool chmax(T1 &a, T2 b) { return a < b && (a = b, true); }
template <typename T1, typename T2> inline bool chmin(T1 &a, T2 b) { return a > b && (a = b, true); }
// }}}

void solve() {
  int n = input();

  vector< int > as(n), bs(n);
  cin >> as >> bs;
  whole(reverse, as);

  range(i, 0, n) if (as[i] > bs[i]) swap(as[i], bs[i]);

  i64 ans = 0;
  using P = pair<i64, i64>;
  priority_queue<P, vector< P >, greater< P >> pq;
  range(i, 0, n) {
    if (not pq.empty() and pq.top().first < as[i]) {
      ans += bs[i] + as[i] - pq.top().first;
      pq.emplace(pq.top().second, infll);
      pq.emplace(as[i], bs[i]);
      pq.pop();
    } else {
      ans += bs[i];
      pq.emplace(bs[i], infll);
    }
  }

  cout << ans << endl;
}

signed main() {
  solve();
}

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,string> pi;
int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	int n;
	cin>>n;
	vector<pi>arr;
	for(int i=0; i<n; i++){
		string s;
		int h;
		cin>>s>>h;
		arr.push_back(pi(h,s));
	}
	sort(arr.begin(),arr.end());
	arr.pop_back();
	cout<<arr.back().second;
}


#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(ll i=0;i<n;i++)
#define repl(i,l,r) for(ll i=(l);i<(r);i++)
#define per(i,n) for(ll i=n-1;i>=0;i--)
#define perl(i,r,l) for(ll i=r-1;i>=l;i--)
#define fi first
#define se second
#define pb push_back
#define mkp make_pair
#define ins insert
#define pqueue(x) priority_queue<x,vector<x>,greater<x>>
#define all(x) (x).begin(),(x).end()
#define CST(x) cout<<fixed<<setprecision(x)
#define vtpl(x,y,z) vector<tuple<x,y,z>>
#define rev(x) reverse(x);
#define lin(x) ll x; cin>>x;
#define stin(x) string x; cin>>x;
#define yn(x)  if(x) {  cout<<"Yes"<<endl;   }    else {    cout<<"No"<<endl;   }
#define YN(x)  if(x) {  cout<<"YES"<<endl;   }    else {    cout<<"NO"<<endl;   }
#define co(x) cout<<x<<endl;
using ll=long long;
using ld=long double;
using vl=vector<ll>;
using vvl=vector<vector<ll>>;
using pl=pair<ll,ll>;
using vpl=vector<pl>;
using vvpl=vector<vpl>;
const ll mod=1000000007;
const ll MOD9=998244353;
const int inf=1e9+10;
const ll INF=4e18;
const ll dy[8]={1,0,-1,0,1,1,-1,-1};
const ll dx[8]={0,-1,0,1,1,-1,1,-1};
template <typename T> inline bool chmax(T &a, T b) {
    return ((a < b) ? (a = b, true) : (false));
}
template <typename T> inline bool chmin(T &a, T b) {
    return ((a > b) ? (a = b, true) : (false));
}
ll powmod(ll n, ll k, ll m) {
ll r=1;
 for(; k>0; k >>=1) {
   if(k&1) r=(r*n)%m;
   n=(n*n)%m;
 }
  return r;
}

ll fact(ll n) {
ll a=1;
rep(i,n) {
a=a*(n-i);
}
return a;
}

ll pow(ll a, ll b) {
ll x=1;
rep(i,b) {
x=x*a;
}
return x;
}

int main() {
lin(N); lin(M); lin(X); lin(Y);
vl A(M);
  vl B(M);
  vl T(M);
  vl K(M);
  rep(i,M) {
    ll a,b,t,k;
    cin>>a>>b>>t>>k;
    A.at(i)=a-1;
    B.at(i)=b-1;
    T.at(i)=t;
    K.at(i)=k;
  }
  X=X-1;
  Y=Y-1;

  vvpl G(N);
  rep(i,M) {
    G.at(A.at(i)).pb({B.at(i),i});
    G.at(B.at(i)).pb({A.at(i),i});
  }

  vl dist(N,INF);
  dist.at(X)=0;

  priority_queue<pl, vpl, greater<pl>>que;

  que.push({0,X});
  while(!que.empty()) {//que
    auto[d,v]=que.top();
    que.pop();
    if(dist[v]<d) continue;
    for(auto e:G[v]) {
      ld aa=(ld)d/(ld)K[e.se];
      ll aaa=ceil(aa);
      if(       chmin(dist[e.fi],  ((d + K[e.second] - 1) / K[e.second]) * K[e.second] + T[e.second])      ){
        que.push({dist[e.fi],e.fi});
      }
    }

  }//endque

  if(dist.at(Y)==INF) {
    co(-1);
  }
  else {
    co(dist.at(Y));
  }
}//end

#include<cstdio>
#include<cctype>
#include<cstring>
#include<cstdlib>
#include<set>
#include<queue>
#include<unordered_map>
#include<algorithm>
using namespace std;
typedef long long ll;
typedef long double ld;
const ll inf=1e18,N=1e5+500;

ll gti(void)
{
	char c=getchar();
	ll ret=0,st=1;
	for (;c!='-'&&!isdigit(c);c=getchar());
	if (c=='-') st=-1,c=getchar();
	for (;isdigit(c);c=getchar()) ret=ret*10+c-'0';
	return ret*st;
}

struct edge{edge *nxt;int to,t,k;}pool[N<<1],*pt[N],*p=pool;
void addedge(int a,int b,int t,int k)
{
	*(++p)=(edge){pt[a],b,t,k},pt[a]=p;
	*(++p)=(edge){pt[b],a,t,k},pt[b]=p;
}
ll dis[N];
struct P
{
	ll dis;
	int id;
	bool operator<(const P &b)const
	{
		return dis>b.dis;
	}
};
ll dijkstra(int n,int s,int t)
{
	priority_queue<P> hp;
	fill(dis,dis+n+1,inf);
	dis[s]=0,hp.push((P){dis[s],s});
	while (hp.size())
	{
		P now=hp.top();
		hp.pop();
		if (dis[now.id]!=now.dis)
			continue;
		for (edge *i=pt[now.id];i;i=i->nxt)
		{
			ll tm=now.dis+(i->k-now.dis%i->k)%i->k+i->t;
			if (dis[i->to]>tm)
				dis[i->to]=tm,hp.push((P){dis[i->to],i->to});
		}
	}
	if (dis[t]==inf) return -1;
	return dis[t];
}
int main(void)
{
	int n=gti(),m=gti(),x=gti(),y=gti();
	for (int i=1;i<=m;i++)
	{
		int u=gti(),v=gti(),t=gti(),k=gti();
		addedge(u,v,t,k);
	}
	printf("%lld\n",dijkstra(n,x,y));
	return 0;
}


#include<bits/stdc++.h>
// #include <ext/pb_ds/assoc_container.hpp> //Policy Based Data Structure
// using namespace __gnu_pbds;              //Policy Based Data Structure
using namespace std;
// typedef tree<int, null_type, less<int>, rb_tree_tag,tree_order_statistics_node_update> pbds; //Policy Based Data Structure
// #define gc              getchar_unlocked
// #define pqb             priority_queue<int>
// #define pqs             priority_queue<int, vi, greater<int> >
// #define mk(arr,n,type)  type *arr = new type[n]
#define fo(i,n)         for(i=0;i<n;i++)
#define Fo(i,k,n)       for(i=k;k<n?i<n:i>n;k<n?i+=1:i-=1)
#define int             long long
#define endl            '\n'
#define w(t)            int t; cin>>t; while(t--)
#define deb(x)          cout << #x << "=" << x << endl
#define deb2(x,y)       cout << #x << "=" << x << "," << #y << "=" << y << endl
#define pb              push_back
#define mp              make_pair
#define F               first
#define S               second
#define all(x)          x.begin(), x.end()
#define clr(x)          memset(x, 0, sizeof(x))
#define sortall(x)      sort(all(x))
#define tr(it,a)        for(auto it = a.begin(); it != a.end(); it++)
#define ps(x,y)         fixed<<setprecision(y)<<x
#define setbits(x)      __builtin_popcountll(x)
#define zrobits(x)      __builtin_ctzll(x)
#define PI              3.1415926535897932384626
#define inf             1e18
// mt19937                 rng(chrono::steady_clock::now().time_since_epoch().count());  //Random Shuffler
typedef pair<int, int>   pii;
typedef vector<int>     vi;
typedef vector<pii>     vpii;
typedef vector<vi>      vvi;
typedef map<int, int>    mii;
int mpow(int base, int exp);
void ipgraph(int m);
void dfs(int u, int par);
const int mod = 1000000007;
// const int N = 3e5, M = N;
// vi g[N];
//=======================

void sol()
{
	int a, b; cin >> a >> b;
	cout << (a + b) / 2 << " " << (a - b) / 2;

}

int32_t main() {
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif

	sol();

	return 0;
}

int mpow(int base, int exp) {
	base %= mod;
	int result = 1;
	while (exp > 0) {
		if (exp & 1) result = (result * base) % mod;
		base = (base * base) % mod;
		exp >>= 1;
	}
	return result;
}

// void ipgraph(int n, int m){
//     int i, u, v;
//     while(m--){
//         cin>>u>>v;
//         g[u-1].pb(v-1);
//         g[v-1].pb(u-1);
//     }
// }
//
// void dfs(int u, int par){
//     for(int v:g[u]){
//         if (v == par) continue;
//         dfs(v, u);
//     }
// }

#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#include<cstdlib>
#include<queue>
#include<set>
#include<cstdio>
#include<map>
#include<cassert>

using namespace std;

#define ll long long
#define reps(i, a, b) for(int i = a; i < b; i++)
#define rreps(i, a, b) for(int i = a-1; i >= b; i--)
#define rep(i, n) reps(i, 0, n)
#define rrep(i, n) rreps(i, n, 0)
#define P pair<int, int>

const ll mod = 1000000007;
const int INF = 1001001001;

char winner(char a, char b){
    if(a == b) return a;
    if (a > b) swap(a, b);
    if(a == 'P' && b == 'R'){
        return a;
    }else if(a == 'P' && b == 'S'){
        return b;
    }else{
        return a;
    }
}

int main(){
    int n, k;
    cin >> n >> k;
    string s;
    cin >> s;
    rep(i, k){
        string s_ = s + s;
        string ns;
        for (int i = 0; i < 2*n; i+=2){
            ns += winner(s_[i], s_[i+1]);
        }
        s = ns;
    }
    cout << s[0] << endl;
}


#include "bits/stdc++.h"
#define fio ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define endl '\n'
#define all(V) (V).begin(), (V).end()
using namespace std;
typedef long long ll;

int main() {fio;
	int n;
	cin >> n;
	vector <pair <int, int>> a(2 * n);
	vector <pair <int, int>> b(2 * n);
	string s;
	for(int i = 0; i < 2 * n; i++) {
		cin >> a[i].first;
		a[i].second = i;
		b[i] = a[i];
	}
	sort(all(b));
	vector <bool> oh(2 * n);
	for(int i = 0; i < 2 * n; i++) {
		if(a[i] < b[n]) {
			oh[i] = 0;
		} else {
			oh[i] = 1;
		}
	}
	int ls = 0;
	for(int i = 0; i < 2 * n; i++) {
		if(oh[i]) {
			if(ls >= 0) {
				s += '(';
			} else {
				s += ')';
			}
			ls++;
		} else {
			if(ls <= 0) {
				s += '(';
			} else {
				s += ')';
			}
			ls--;
		}
	}
	assert(ls == 0);
	cout << s << endl;
    return 0;
}

#include<bits/stdc++.h>
#include<bits/extc++.h>
#pragma GCC optimize("Ofast")
using namespace std;
using namespace __gnu_pbds;
template<typename TH> void _dbg(const char* sdbg, TH h) { cerr<<sdbg<<"="<<h<<"\n"; }
template<typename TH, typename... TA> void _dbg(const char* sdbg, TH h, TA... t){
	while(*sdbg != ',') { cerr<<*sdbg++; } cerr<<"="<<h<<","; _dbg(sdbg+1, t...);
}
#ifdef DEBUG
#define debug(...) _dbg(#__VA_ARGS__, __VA_ARGS__)
#define debugv(x) {{cerr<<#x<<": "; for(auto i:x) cerr<<i<<" "; cerr<<endl;}}
#define debugr(l,r,x) {{cerr<<#x<<": "; for(int i=l;i<=r;i++) cerr<<x<<" "; cerr<<endl;}}
#else
#define debug(...) (__VA_ARGS__)
#define debugv(x)
#define debugr(l,r,x)
#define cerr while(0) cerr
#endif
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
//#define int long long
typedef __int128 INT;
typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> pii;
#define priority_queue std::priority_queue
#define F first
#define S second
typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> ordered_set;

int a[500005];
bool good[500005];
signed main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	string ans="";
	int n;
	cin>>n;
	n*=2;
	for(int i=0; i<n; i++) ans.push_back('#');
	for(int i=0; i<n; i++){
		cin>>a[i];
	}
	vi idx(n);
	iota(idx.begin(), idx.end(), 0);
	sort(idx.begin(), idx.end(), [&](int x, int y){
		return a[x] < a[y];
	});
	for(int i=0; i<n/2; i++){
		good[idx[i]]=1;
	}
	stack<int> st;
	for(int i=0; i<n; i++){
		if(st.empty()){
			ans[i]='(';
			st.push(i);
		}
		else{
			int t=st.top();
			if(good[t]==good[i]){
				st.push(i);
			}
			else{
				st.pop();
				ans[t]='(';
				ans[i]=')';
			}
		}
	}
	cout<<ans<<endl;
}


#include <iostream>
#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 ONLINE_JUDGE
#ifndef ONLINE_JUDGE
template<typename T>
void __p(T a) {
	cout << a;
}
template<typename T, typename F>
void __p(pair<T, F> a) {
	cout << "{";
	__p(a.first);
	cout << ",";
	__p(a.second);
	cout << "}";
}
template<typename T>
void __p(std::vector<T> a) {
	cout << "{";
	for (auto it = a.begin(); it < a.end(); it++)
		__p(*it), cout << ",}"[it + 1 == a.end()];
}
template<typename T, typename ...Arg>
void __p(T a1, Arg ...a) {
	__p(a1);
	__p(a...);
}
template<typename Arg1>
void __f(const char *name, Arg1 &&arg1) {
	cout << name << " : ";
	__p(arg1);
	cout << endl;
}
template<typename Arg1, typename ... Args>
void __f(const char *names, Arg1 &&arg1, Args &&... args) {
	int bracket = 0, i = 0;
	for (;; i++)
		if (names[i] == ',' && bracket == 0)
			break;
		else if (names[i] == '(')
			bracket++;
		else if (names[i] == ')')
			bracket--;
	const char *comma = names + i;
	cout.write(names, comma - names) << " : ";
	__p(arg1);
	cout << " | ";
	__f(comma + 1, args...);
}
#define trace(...) cout<<"Line:"<<__LINE__<<" ", __f(#__VA_ARGS__, __VA_ARGS__);
#else
#define trace(...)
#endif
typedef long long int ll;
template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
template <typename T>
using ordered_multiset = tree<T, null_type, less_equal<T>, rb_tree_tag, tree_order_statistics_node_update>;
#define pb(x) push_back(x)
#define mp(x,y) make_pair(x,y)
typedef pair<ll , ll> pp;
typedef pair<pair<ll, ll>, ll> ppp;
#define X first
#define Y second
#define getones(n) __builtin_popcountll(n)
#define debug(x) cout<<#x<<" :: "<<x<<"\n";
#define debug2(x,y) cout<<#x<<" :: "<<x<<"\t"<<#y<<" :: "<<y<<"\n";
#define debug3(x,y,z) cout<<#x<<" :: "<<x<<"\t"<<#y<<" :: "<<y<<"\t"<<#z<<" :: "<<z<<"\n";
#define fastIO ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define frv(i,a,b) for (ll i = (a), _b = (b); i < _b; i++)
#define frrv(i,a,b) for (ll i = (a), _b = (b); i >= _b; i--)
#define fr(i,n) for (ll i = 0, _n = (n); i < _n; i++)
#define frr(i,n) for (ll i = n - 1; i >= 0; i--)
#define fordata(it,ar) for (auto it = ar.begin(); it != ar.end(); it++)
#define fill(ar,val) fr(i,sizeof(ar)/sizeof(ll)) ar[i]=val
#define fill2(ar,val) fr(i,sizeof(ar)/sizeof(ar[0])) fr(j,sizeof(ar[0])/sizeof(ll)) ar[i][j]=val
#define fill0(ar) memset(ar,0,sizeof(ar))
#define sz(x) (int)x.size()
#define len(x) (int)x.length()
#define all(ar) ar.begin(), ar.end()
#define INF 1000000000000000000
#define PI 3.14159265358979323846L
#define max3(a,b,c) max(a,max(b,c))
#define min3(a,b,c) min(a,min(b,c))
const ll N = 1e6 + 1;
const ll K = 998244353;
#define vv vector<ll>
const ll globalmod = 1e9 + 9;
vv spf(N);
void sieve() {
	frv(i, 2, N) {
		spf[i] = i;
	}
	for (int i = 2; i * i <= N; i++) {
		for (int j = i; j <= N; j += i) {
			if (spf[j] == j) {
				spf[j] = i;
			}
		}
	}
}
ll binaryexpo(ll a, ll b, ll m) {
	a %= m;
	ll res = 1;
	while (b > 0) {
		if (b & 1) {
			res = (res * a) % m;
		}
		a = (a * a) % m;
		b >>= 1;
	}
	return res;
}
vv fact(N);
ll ncr(ll a, ll b) {
	ll temp = fact[a];
	ll init = ((fact[b] * fact[a - b]) % K);
	temp *= binaryexpo(init, K - 2, K);
	temp %= K;
	return temp;
}
int main() {
	fact[0] = 1;
	frv(i, 1, N) {
		fact[i] = fact[i - 1] * i;
		fact[i] %= K;
	}
	sieve();
	ll t = 1;
	// cin >> t;
	while (t--) {
		ll n, m;
		cin >> n >> m;
		ll sum = 0;
		frv(i, 1, m + 1) {
			ll temp = i;
			ll pr = 1;
			while (spf[temp] != 0) {
				ll ind = spf[temp];
				ll cnt = 0;
				while (spf[temp] == ind) {
					temp /= ind;
					cnt++;
				}
				pr *= (ncr(cnt + n - 1, n - 1));
				pr %= K;
			}
			// trace(pr)
			sum += pr;
			sum %= K;
		}
		cout << sum;
	}
}

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

#define forn(i, n) for(int i=0; i<(n); i++)
#define readVec(v) forn(i, v.size()){cin >> v[i];}
#define printArr(arr, n) forn(i, n){if (i) cout << " "; cout << arr[i];} cout << endl;
#define pb push_back
#define mp make_pair
#define MOD 1000000007
#define f first
#define s second

typedef long long ll;
typedef double ld;
typedef long double lld;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<bool> vb;
typedef vector<pii> vpi;
typedef vector<pll> vpl;
typedef vector<vi> vii;

//Printing pairs and vectors
template<typename A, typename B> ostream& operator<<(ostream &cout, pair<A, B> const &p) { return cout << "(" << p.f << ", " << p.s << ")"; }
template<typename A> ostream& operator<<(ostream &cout, vector<A> const &v) {
  cout << "["; for(int i = 0; i < v.size(); i++) {if (i) cout << ", "; cout << v[i];} return cout << "]";
}

//2 147 483 647 int max
//9 223 372 036 854 775 807 ll max
void fast_io(){
   ios_base::sync_with_stdio(0);
   cin.tie(NULL);
   cout.tie(NULL);
}
void file_io(string taskname){
   string fin = taskname + ".in";
   string fout = taskname + ".out";
   const char* FIN = fin.c_str();
   const char* FOUT = fout.c_str();
   freopen(FIN, "r", stdin);
   freopen(FOUT, "w", stdout);
   fast_io();
}

int main(){
    fast_io();
    ll b, c;
    cin >> b >> c;
    // ll left = b, right = b;

    vpl v;

    v.pb(mp(-b-(c-1)/2, -b));
    v.pb(mp(-b, -b+(c-1)/2));
    v.pb(mp(b-c/2, b));
    if(c > 1) {v.pb(mp(b, b+(c-2)/2));}
    else {v.pb(mp(b, b));}
    sort(v.begin(), v.end());
    ll tot = 0;

    forn(i, 4){
      tot += v[i].s-v[i].f + 1;
    }
    forn(i, 4){
      for(int j=i+1; j<4; j++){
        tot -= max(0LL, min(v[i].s, v[j].s)-max(v[i].f, v[j].f)+1);
      }
    }
    forn(i, 4){
      tot += max(0LL, min(v[i].s, min(v[(i+1)%4].s, v[(i+2)%4].s))-max(v[i].f, max(v[(i+1)%4].f, v[(i+2)%4].f))+1);
    }
    tot -= max(0LL, min(v[0].s, min(v[1].s, min(v[3].s, v[2].s)))-max(v[0].f, max(v[1].f,  max(v[3].f, v[2].f)))+1);
    cout << tot << "\n";
}


#include<bits/stdc++.h>
using namespace std;
int main()
{
 int a,b,c;
  cin>>a>>b>>c;
  if((a+b==2*c)||(a+c==2*b)||(b+c==2*a))
    cout<<"Yes"<<endl;
  else
    cout<<"No"<<endl;
}

#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
#define rep(i, n) for(ll i = 0; i < n; ++i)
#define rep2(i, a, b) for(ll i = a; i <= b; ++i)
#define rep3(i, a, b) for(ll i = a; i >= b; --i)
#define pii pair<int, int>
#define pll pair<ll, ll>
#define pb push_back
#define eb emplace_back
#define vi vector<int>
#define vvi vector<vector<int>>
#define vll vector<ll>
#define vpi vector<pii>
#define vpll vector<pll>
#define fi first
#define se second
#define all(c) begin(c), end(c)
#define SUM(v) accumulate(all(v), 0LL)
#define MIN(v) *min_element(all(v))
#define MAX(v) *max_element(all(v))
#define drop(s) cout << #s << endl, exit(0)
#define endl '\n'
using Graph = vector<vector<int>>;
const int inf = 100100101;
const ll ll_inf = 1e18;
const int mod = 1000000007;
template <class T> using vc = vector<T>;
template <class T> using vvc = vector<vc<T>>;
template <class T> using vvvc = vector<vvc<T>>;
template <class T> using vvvvc = vector<vvvc<T>>;
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a = b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a = b; return 1; } return 0; }

int main() {
  vector<int> a(3);
  rep(i,3) cin >> a[i];

  sort(all(a));

  if(a[2]-a[1] == a[1]-a[0]) cout<<"Yes"<<endl;
  else cout<<"No"<<endl;
  return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
typedef long long ll;
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define all(v) v.begin(), v.end()
template<class T>bool chmax(T& a, const T& b) { if (a<b) { a=b; return 1;} return 0;}
template<class T>bool chmin(T& a, const T& b) { if (b<a) { a=b; return 1;} return 0;}

ll mul(ll x, ll a) {
    ll ret = 1;
    rep(i, a) ret *= x;
    return ret;
}

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

    if (X.size() == 1) {
        ll x = stoll(X);
        if (x <= M) cout << 1 << endl;
        else cout << 0 << endl;
        return 0;
    }

    ll len = X.size();
    ll ma = 0;
    for (int i = 0; i < X.size(); ++i) {
        chmax(ma, (ll)(X[i] - '0'));
    }

    for (ll i = ma+1; i < 2e18; ++i) {
        if (i > 100) i += 1e12;
        ll tmp = 0;
        double judge = 0;
        for (int j = 0; j < len; ++j) {
            tmp += mul(i, (len - j - 1)) * (X[j] - '0');
            judge += pow(i, (len - j - 1)) * (X[j] - '0');
        }

        if (judge > 2e18 || tmp > M) {
            for (ll k = max(ma+1, i - (ll)1e12-1); k < 2e18; k++) {
                if (k > 100) k += 1e6;
                ll tm = 0;
                double ju = 0;
                for (int l = 0; l < len; ++l) {
                    tm += mul(k, (len - l - 1)) * (X[l] - '0');
                    ju += pow(k, (len - l - 1)) * (X[l] - '0');
                }

                if (ju > 2e18 || tm > M) {
                    for (ll m = max(ma+1, k - (ll)1e6-1); m < 2e18; ++m) {
                        ll t = 0;
                        double j = 0;
                        for (int n = 0; n < len; ++n) {
                            t += mul(m, (len - n - 1)) * (X[n] - '0');
                            j += pow(m, (len - n - 1)) * (X[n] - '0');
                        }

                        if (j > 2e18 || t > M) {
                            cout << m - (ma+1) << endl;
                            return 0;
                        }
                    }
                }
            }
        }
    }
}

#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <cmath>
#include <stdio.h>
#include <queue>
#include <deque>
#include <cstdio>
#include <set>
#include <map>
#include <bitset>
#include <stack>
#include <cctype>
using namespace std;
int main() {
    long k;
    string s, t;
    long double co[10] = {}, co1[10] = {}, co2[10] = {};
    long double ans = 0, ans1 = 0;
    cin >> k >> s >> t;
    long double kd = k;
    for (int i = 0; i < 4; i++) {
        co[int(s[i] - '0')]++;
        co1[int(s[i] - '0')]++;
        co[int(t[i] - '0')]++;
        co2[int(t[i] - '0')]++;
    }
    for (int i = 1; i < 10; i++) {
        for (int j = 1; j < 10; j++) {
            if (i == j && co[i] < k - 1) {
                co1[i]++, co2[j]++;
                long s1 = 0, t1 = 0;
                for (int k1 = 1; k1 < 10; k1++) {
                    long s2 = 1, t2 = 1;
                    for (int l = 0; l < co1[k1]; l++) {
                        s2 *= 10;
                    }
                    for (int l = 0; l < co2[k1]; l++) {
                        t2 *= 10;
                    }
                    s1 += k1 * s2, t1 += k1 * t2;
                }
                if (s1 > t1) {
                    ans += (kd - co[i]) * (kd - co[i] - 1);
                }
                co1[i]--, co2[j]--;
            }
            else if (i != j && co[i] < k && co[j] < k) {
                co1[i]++, co2[j]++;
                long s1 = 0, t1 = 0;
                for (int k1 = 1; k1 < 10; k1++) {
                    long s2 = 1, t2 = 1;
                    for (int l = 0; l < co1[k1]; l++) {
                        s2 *= 10;
                    }
                    for (int l = 0; l < co2[k1]; l++) {
                        t2 *= 10;
                    }
                    s1 += k1 * s2, t1 += k1 * t2;
                }
                if (s1 > t1) {
                    ans += (kd - co[i]) * (kd - co[j]);
                }
                co1[i]--, co2[j]--;
            }
        }
    }
    ans1 = (9 * kd - 8) * (9 * kd - 9);
    cout << fixed << setprecision(16) << ans / ans1 << endl;
}


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

int main() {
  ll N;
  cin>>N;
  vector<pair<int,string>> A(N);
  rep(i,N){
   cin>>A[i].second>>A[i].first;
  }
  sort(all(A));
  cout<<A[N-2].second<<endl;
}

#include <bits/stdc++.h>

using namespace std;
typedef long long ll;
typedef vector<int> VI;
typedef vector<long long> Vll;
ll mm=1000000000;ll MM=mm+7;
#define rep(i, n) for(int i=0;i<n;i++)
#define PI 3.141592653589793

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

    priority_queue<ll> dif;
    rep(i,n){
        dif.push(2*a[i]+b[i]);
    }
    ll ans=0;
    rep(i,n){
        suma-=dif.top();
        dif.pop();
        ans++;
        if(suma<0)break;
    }
    cout << ans << endl;
}


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

void solve() {
    ll arr[4];
    ll sum = 0;
    // ll one;
    for(int i=0; i<4; i++){
        cin>>arr[i];
        sum+=arr[i];
    }
    //Two
    sort(arr, arr+4);
    ll one = arr[3];
    sum-=arr[3];
    if(one < sum){
        if(one + arr[0] == sum-arr[0]){
            cout<<"Yes"<<endl;
            return;
        }
        else if(one + arr[1] == sum - arr[1]){
            cout<<"Yes"<<endl;
        }
        else if(one + arr[2] == sum-arr[2]){
            cout<<"Yes"<<endl;
        }
        else{
            cout<<"No"<<endl;
        }
    }
    else if(one == sum){
        cout<<"Yes"<<endl;
        return;
    }
    else{
        cout<<"No"<<endl;
        return;
    }
    return;
}

int main(){
    #ifndef ONLINE_JUDGE
    freopen("/home/shubham/Desktop/codes/input.txt", "r", stdin);
    freopen("/home/shubham/Desktop/codes/output.txt", "w", stdout);
    #endif
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll t;
    // cin>>t;
    t = 1;
    while(t--) {
        solve();
    }
    return 0;
}

#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define printVec(v) printf("{"); for (const auto& i : v) { std::cout << i << ", "; } printf("}\n");
#define ALL(obj) (obj).begin(), (obj).end()
#define debug(x) cout << #x << ": " << x << '\n';
#define degreeToRadian(deg) (((deg)/360)*2*M_PI)
#define radianTodegree(rad) (((rad)/2/M_PI)*360)
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
using namespace std;
using P = pair<int,int>;
using ll = long long;
const ll INF = 1LL<<60;
const int MOD = 1e9 + 7;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};

//cin.tie(0);ios::sync_with_stdio(false);
//cout << fixed << setprecision(15) << y << endl;
int main() {
  int A, B, C, D;
  cin >> A >> B >> C >> D;
  vector<int> T;
  T.push_back(A);
  T.push_back(B);
  T.push_back(C);
  T.push_back(D);

  bool ok = false;
  for (int bit = 1; bit < (1 << 4); bit++) {
    ll sum = A + B + C + D;
    ll x = 0;
    for (int i = 0; i < 4; i++) {
      if (bit & 1 << i) {
	sum -= T[i];
	x += T[i];
      }
    }
    if (sum == x) ok = true;
  }

  if (ok) {
    cout << "Yes" << endl;
  } else {
    cout  << "No" << endl;
  }
  return 0;
}


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

int main() {
  string s,t;
  cin >> s >> t;
  if (s[0]=='Y') {
    t[0]^=32;
    cout << t << endl;
  }
  else {
    cout << t << endl;
  }
}

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

int main() {
  char s, t;
  cin >> s >> t;

  if (s == 'Y'){
    if (t == 'a'){
      cout << 'A' << endl;
    }else if (t == 'b'){
      cout << 'B' << endl;
    }else if (t == 'c'){
      cout << 'C' << endl;
    }
  } else if (s == 'N'){
    cout << t << endl;
  }

}


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

#define SWAP(a,b) ((a != b)? (a += b,b = a - b,a -= b) : 0 ) //数値のみ
#define SWAP(type,a,b) { type temp = a; a = b; b = temp; } //ポインタ, 構造体, 文字列
#define rng(i, a, b) for(int i = int(a); i < int(b); i++)
#define rep(i, b) rng(i, 0, b)
#define pb push_back
#define eb emplace_back
#define bg begin()
#define ed end()
#define all(x) x.bg,x.ed

ll jo(ll a, ll n){
  ll tmp = 1;
  rep(i, n) {
    tmp *= a;
    if(tmp <= 0) return -1;
  }
  return tmp;
}

void yn(bool Yes){
  cout << ((Yes)? "Yes" : "No") << endl;
}

void ny(bool No){
  cout << ((No)? "No" : "Yes") << endl;
}

void YN(bool YES){
  cout << ((YES)? "YES" : "NO") << endl;
}

void NY(bool NO){
  cout << ((NO)? "NO" : "YES") << endl;
}

void Yay(bool y){
  cout << ((y)? "Yay!" : ":(") << endl;
}

int main() {
  int n, a, b, ans = 0;
  char c;
  string s;
  cin >> s;
  rep(i, s.size()){
    if(s[i] == '.') break;
    cout << s[i];
  }
  cout << endl;
  //printf("%.10lf\n", ans);
}

#include<bits/stdc++.h>

using namespace std;

int main(){
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  long long n;
  cin >> n;
  long long res=0;
  long long st,fi;
  long long c=0;
  for(st=1;;st*=10){
    fi=10*st-1;
    fi=min(n,fi);
    res+=(c/3)*(fi-st+1);
    c++;
    if(fi==n){break;}
  }
  cout << res << '\n';
  return 0;
}


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

template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
ll modinv(ll a, ll m){
    ll b = m, u = 1, v = 0;
    while(b) {
        ll t = a / b;
        a -= t * b; swap(a, b);
        u -= t * v; swap(u, v);
    }
    u %= m;
    if(u < 0) u += m;
    //cout << u << endl;
    return u;
}

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

}

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

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

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

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

//bfs

int main() {
    ll h, w;
    cin >> h >> w;
    vector<vector<char>> g(h, vector<char>(w));
    REP(i, h){
        REP(j, w){
            char tmp;
            cin >> tmp;
            //cout << tmp << endl;
            g[i][j] = tmp;
            //cout << g[i][j] << endl;
        }

    }
    ll ans = 0;

    REP(i, h){
        REP(j, w){
            if(i+1 < h){
                if(g[i][j] == '.' && g[i+1][j] == '.') ans += 1;
            }
            if(j + 1 < w){
                if(g[i][j] == '.' && g[i][j+1] == '.') ans += 1;
            }
        }
    }

    cout << ans << endl;

}

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

#define FAST ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define int long long
#define F first
#define S second
#define pb push_back
#define sz(x) (int)x.size()
#define len(x) (int)x.length()
#define pii pair<int,int>
#define ppi pair<pii,int>
#define vi vector<int>
#define mp make_pair
#define minheap priority_queue<int,vector<int>,greater<int>>

int32_t main(){
FAST
 int h,w;
 cin>>h>>w;
 char a[h][w];
 int ans=0;
 for(int i=0;i<h;i++)
 	for(int j=0;j<w;j++)
 		cin>>a[i][j];
 for(int i=0;i<h;i++){
 	for(int j=0;j<w;j++){
 		if(a[i][j]=='.' && (i<h-1 && a[i+1][j]=='.'))
 			ans++;
 		if(a[i][j]=='.' && (j<w-1 && a[i][j+1]=='.'))
 			ans++;
 	}
 }

 cout << ans;
}


#include <bits/stdc++.h>

using namespace std;
using int64 = long long;

constexpr int DEBUG = 0;

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

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

#include <bits/stdc++.h>
using namespace std;
#define endl ("\n")
#define pi (3.141592653589)
#define mod 1e9+7
#define int long long
#define float double
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define all(c) c.begin(), c.end()
#define min3(a, b, c) min(c, min(a, b))
#define min4(a, b, c, d) min(d, min(c, min(a, b)))
#define rrep(i, n) for(int i=n-1;i>=0;i--)
#define rep(i,n) for(int i=0;i<n;i++)
#define fast ios_base::sync_with_stdio(false), cin.tie(nullptr), cout.tie(nullptr);

int32_t main(){
    fast
    int t=1;
    // cin>>t;
    while(t--){
        int n;cin>>n;
        float X;cin>>X;
        int a[n], b[n];
        rep(i, n)cin>>a[i]>>b[i];
        int f=0;
        float x=0;
        rep(i, n){
            x+=(b[i]*a[i]);
            if(x>X*100){
                cout<<i+1<<endl;
                f=1;
                break;
            }
        }
        if(f==0)cout<<-1<<endl;
    }
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define int long long
#define double long double
#define IOS ios_base::sync_with_stdio(0);cin.tie(0)
/* start */

const int N = 52;
const int mod = 998244353;

int g[N][N], tot;
int was[N];
int fat[N];
vector<int> vx[N], vy[N];

void dfs1(int v) {
   tot++;
   was[v]=1;
   for(int u : vx[v]) {
      if(!was[u]) {
         dfs1(u);
      }
   }
}

void dfs2(int v) {
   tot++;
   was[v]=1;
   for(int u : vy[v]) {
      if(!was[u]) {
         dfs2(u);
      }
   }
}

signed main(){
   IOS;
   fat[0] = fat[1] = 1;
   for(int i = 2; i < N; i++) {
      fat[i] = (fat[i-1] * i) % mod;
   }
   int n, K;
   cin >> n >> K;
   for(int i = 0; i < n; i++)
      for(int j = 0; j < n; j++)
         cin >> g[i][j];

   for(int i = 0; i < n; i++) {
      for(int j = i + 1; j < n; j++) {
         bool ok = true;
         for(int k = 0; k < n; k++) {
            if(g[k][i] + g[k][j] > K) {
               ok = false;
               break;
            }
         }
         if(ok) {
            vx[i].push_back(j);
            vx[j].push_back(i);
         }
      }
   }
   int ans = 1;
   for(int i = 0; i < n; i++) {
      if(!was[i]) {
         tot = 0;
         dfs1(i);
         ans = (ans * fat[tot])%mod;
      }
   }

   for(int i = 0; i < n; i++) {
      for(int j = i + 1; j < n; j++) {
         bool ok = true;
         for(int k = 0; k < n; k++) {
            if(g[i][k] + g[j][k] > K) {
               ok = false;
               break;
            }
         }
         if(ok) {
            vy[i].push_back(j);
            vy[j].push_back(i);
         }
      }
   }

   memset(was, 0, sizeof(was));

   for(int i = 0; i < n; i++) {
      if(!was[i]) {
         tot = 0;
         dfs2(i);
         ans = (ans * fat[tot])%mod;
      }
   }

   cout << ans << "\n";

}

/*
   Coisas pra se lembrar:
      * Overflow, tamanho do N
      * Casos especiais (e.g. n = 1)
      * Nao ficar parado e fazer alguma coisa
      * Escrever coisas no papel
      * NAO FICAR TRAVADO EM UMA IDEIA
*/

#include <bits/stdc++.h>
#ifndef ONLINE_JUDGE
#define debug(x) cout << #x << ": " << (x) << endl
#else
#define debug(x)
#endif
using namespace std;
typedef long long ll;
typedef vector<int> vi;
const int maxn=1e6+7,inf=0x3f3f3f3f,mod=1e9+7;

int fa[maxn];

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

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    int h,w;
    cin>>h>>w;
    for(int i=0;i<h;++i) cin>>mp[i];
    mp[0][0]='#',mp[0][w-1]='#',mp[h-1][0]='#',mp[h-1][w-1]='#';
    for(int i=0;i<=h+w;++i) fa[i]=i;
    for(int i=0;i<h;++i)
    {
        for(int j=0;j<w;++j)
        {
            if(mp[i][j]=='#')
            {
                int fx=find(i),fy=find(j+h);
                if(fx!=fy) fa[fy]=fx;
            }
        }
    }
    set<int>row,col;
    for(int i=0;i<h;++i) row.insert(find(i));
    for(int i=0;i<w;++i) col.insert(find(h+i));
    cout<<min(row.size(),col.size())-1<<'\n';
    return 0;
}


/**
    Lost Arrow (Aryan V S)
    Saturday 2020-12-19
**/

#ifdef LOST_IN_SPACE
#  if   __cplusplus > 201703LL
#    include "lost_pch1.h" // C++20
#  elif __cplusplus > 201402LL
#    include "lost_pch2.h" // C++17
#  else
#    include "lost_pch3.h" // C++14
#  endif
#else
#  include <bits/stdc++.h>
#endif

constexpr bool test_cases = false;

void solve () {
    int n;
    std::cin >> n;
    int cnt = 0;
    for (int i = 1; i <= n; ++i) {
        std::string base10 = std::to_string(i);
        std::string base8;
        int j = i;
        while (j) {
            base8 += '0' + (j % 8);
            j /= 8;
        }
        bool bad = false;
        for (char c : base10)
            if (c == '7')
                bad = true;
        for (char c : base8)
            if (c == '7')
                bad = true;
        if (!bad)
            ++cnt;
    }
    std::cout << cnt << '\n';
}

int main () {

    std::ios::sync_with_stdio(false);
    std::cin.tie(nullptr);
    std::cout.precision(10);
    std::cerr.precision(10);
    std::cout << std::fixed << std::boolalpha;
    std::cerr << std::fixed << std::boolalpha;

    int32_t cases = 1;
    if (test_cases)
        std::cin >> cases;
    while (cases--)
        solve();

    return 0;
}

// g++.exe -Wall -Weffc++ -Wextra -pedantic -std=c++20 -g -D_GLIBCXX_DEBUG -DLOST_IN_SPACE -H

// Replace failing with learning
// Replace overthinking with action
// Replace blame with responsibility
// Replace toxic friends with mentors
// Replace complaining with gratitude
// Replace netflix marathons with sleep
// Replace fake influencers with inspiring creators

#include <bits/stdc++.h>
#define FAST ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define ll long long int
#define ld long double
#define pb push_back
#define pob pop_back
#define ub upper_bound
#define lb lower_bound
#define mp make_pair
#define f0(i,n) for(i=0;i<n;i++)
#define rf0(i,n) for(i=n-1;i>=0;i--)
#define f2(i,n) for(i=1;i<n;i++)
#define f1(i,n) for(i=1;i<=n;i++)
#define fab(i,a,b) for(i=a;i<=b;i++)
#define shr  ll t;cin>>t; while(t--)
#define fi first
#define sc second
#define pll pair<ll,ll>
#define vll vector<ll>
#define vpll vector<pll>
#define all(v) v.begin(),v.end()
#define mod 1000000007
#define dev(a) for(auto it:a)cout<<it<<" "
#define prec(nm,prc) cout<<fixed<<setprecision(nm)<<prc<<" "
#define print(a) cout<<a<<"\n";
#define print2(a,b) cout<<a<<" "<<b<<"\n";
#pragma GCC optimization ("O3")
#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
#define nl cout<<"\n"
#define ye cout<<"Yes\n"
#define yee cout<<"YES\n"
#define no cout<<"No\n"
#define noo cout<<"NO\n"
#define ln length()
#define ms(cnt,r) memset(cnt, r, sizeof(cnt))
using namespace std;
bool comp(pll &a,pll &b)
{
    return (a.sc<b.sc);
}
ll power(ll n,ll p)
{
	if(p==0)
	return 1;
	else
	{
		ll ans=power(n,p/2)%mod;
		ans=(ans*ans)%mod;
		if(p%2==0)
		return ans;
		else
		return ans=(ans*n)%mod;
	}
}
bool isPrime(ll n)
{
    if (n <= 1)
        return false;
    if (n <= 3)
        return true;

    if (n % 2 == 0 || n % 3 == 0)
        return false;

    for (ll i = 5; i * i <= n; i = i + 6)
        if (n % i == 0 || n % (i + 2) == 0)
            return false;

    return true;
}
    /********************HAR HAR MAHADEV***********JAI BAJRANG BALI************************/
  int main()
 {
  	FAST;
  	/* ifstream cin;
    cin.open("input.txt");
    ofstream cout;
    cout.open("output.txt");
                      */
  	//shr
  	  {
  	  	ll i,j,n,a,b,c,d,m,sum=0,ans=0,cnt=0,r=0,e=0;
  	  	string str,s1,om,s;
  	     unordered_map<ll,ll>mp,mp1;
  	     set<ll>st; vll v;
  	     cin>>a;
  	     n=sqrt(a);
  	     fab(i,1,n)
  	     {
  	         if(a%i==0)
  	         {
  	             e=a/i;
  	             if(i%2==1)r++;
  	             if(e%2==1)r++;
  	             if(i==e&&i%2==1)r--;
  	         }
  	     }
  	    cout<<(r*2);

  	  }
   	return 0;
  }


#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define all(x) x.begin(),x.end()
#define MOD 1000000007
#define PI acos(-1)
#define debug cerr <<
#define var(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "
#define close << "\n";

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

	ll N,W;
	cin >> N >> W;
	vector<ll> arr((int)2e5+60,0);
	ll max_T = 0;
	for (ll i = 0; i < N; ++i) {
		ll S,T,P;
		cin >> S >> T >> P;
		T--;
		arr[S]+=P;
		arr[T+1]-=P;
		max_T = max(max_T,T);
	}
	for (ll i = 1; i < arr.size(); ++i) {
		arr[i] += arr[i-1];
	}
	bool possible = true;
	for (ll i = 0; i < arr.size(); ++i) {
		//cout << arr[i] << " ";
		if(arr[i] > W){
			possible = false;
			break;
		}
	}
	cout << ((possible)?"Yes":"No") close
}

#include<iostream>
#include<stdio.h>
#include<string>
#include<vector>
#include<map>
#include<tuple>
#include<algorithm>
#include<cmath>
#include<limits>
#include<set>
#include<deque>
#include<queue>
#include<stack>
using namespace std;
#define int long long int
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define dup(x,y) (((x)+(y)-1)/(y))
int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
int lcm(int a, int b) { return a / gcd(a, b) * b; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
typedef pair<int, int>P;
const int MOD = 1e9 + 7;
//const int MOD = 998244353;
const int INF = 1e18;
const long double PI = (acos(-1));

signed main() {
	int N, W;
	cin >> N >> W;
	vector<int>S(N), T(N), P(N);
	rep(i, N)cin >> S[i] >> T[i] >> P[i];
	int tmx = -INF;
	rep(i, N)chmax(tmx, T[i]);
	vector<int>v(tmx + 1, 0);
	rep(i, N) {
		v[S[i]] += P[i];
		v[T[i]] -= P[i];
	}
	rep(i, tmx) {
		v[i + 1] += v[i];
	}
	rep(i, tmx + 1) {
		if (v[i] > W) {
			cout << "No" << endl;
			return 0;
		}
	}
	cout << "Yes" << endl;
}


#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <queue>
#include <unordered_map>
#include <map>
#include <algorithm>
#define int long long
inline int read()
{
    int num=0,f=1;char c=getchar();
    while(c<48||c>57){if(c=='-')f=-1;c=getchar();}
    while(c>47&&c<58)num=(num<<3)+(num<<1)+(c^48),c=getchar();
    return num*f;
}
const int mod=998244353;
int dp[200005][25];
inline int min(int a,int b){return a<b?a:b;}
inline int max(int a,int b){return a>b?a:b;}

int C[200005];
int dfs(int v,int qwq,int n,int m)
{
    if(qwq>n)return 0;
    if(dp[v][qwq])return dp[v][qwq];
    int ans=C[qwq-1];
    for(int i=qwq?2:1;i<=m;i++)
    {
        if(v*i>m)break;
        ans=(ans+dfs(v*i,qwq+1,n,m))%mod;
    }
    return dp[v][qwq]=ans;
    /*if(mp[x].count(y))return mp[x][y];
    //if(x==0)return mp[x][y]=1;
    if(x==1)return m/y-1+f;
    int ans=0;
    for(int i=2-f;i*y<=m;i++)ans+=dfs(x-1,y*i,m),ans%=mod;
    return mp[x][y]=ans%mod;
    return ans%mod;*/
}
inline int qp(int x,int p)
{
    int res=1;
    while(p)
    {
        if(p&1)res=res*x%mod;
        x=x*x%mod;
        p>>=1;
    }
    return res;
}
signed main()
{
    int n=read(),m=read(),ans=0;
    C[0]=1;
    for(int i=1;i<=n-1;i++)C[i]=C[i-1]*(n-i)%mod*qp(i,mod-2)%mod;
    //for(int i=1;i<=18;i++)
    //{ans+=dfs(i,1,m,1)*C[i-1]%mod;for(int i=1;i<=n;i++)mp[i].clear();}
    /*for(int i=1;i<=n;i++)
    {
        ans=(ans+mp[i][m]*qp(i,n-i))%mod;
    }*/
    printf("%lld\n",dfs(1,0,n,m));
    //printf("%lld\n",dfs(n,1,m));
}

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

#define int long long

const int mod = 998244353;
const int N = 2e5 + 200;

int n, m;
int factorial[N], invfac[N];

int power(int base, int expo) {
	int res = 1;

	while(expo) {
		if(expo & 1) {
			res = (res * base) % mod;
		}

		base = (base * base) % mod;
		expo /= 2;
	}

	return res;
}

int modInverse(int num) {
	return power(num, mod - 2);
}

int nCr(int n, int r) {
	int num = factorial[n];
	int den = invfac[n - r] * invfac[r];
	den %= mod;

	int ans = (num * den) % mod;

	return ans;
}

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

	int ans = 0;

	for(int i = 1; i <= m; i++) {
		int curr = 1;

		int num = i;

		for(int j = 2; j * j <= num; ++ j) {
			int count = 0;
			while(num % j == 0) {
				num /= j;
				++ count;
			}

			curr *= nCr(n + count - 1, count);
			curr %= mod;
		}

		if(num > 1) {
			curr *= n;
			curr %= mod;
		}

		ans += curr;
		ans %= mod;
	}

	return ans;
}

signed main() {
	#ifndef ONLINE_JUDGE
	    // for getting input from input.txt
		freopen("input.txt", "r", stdin);
	    // for writing output to output.txt
	    //this can be opted out if you want to print the output to the sublime console
		freopen("output.txt", "w", stdout);
	#endif

	factorial[0] = 1;

	for(int i = 1; i < N; i++) {
		factorial[i] = factorial[i - 1]  * i;
		factorial[i] %= mod;
	}

	invfac[N - 1] = modInverse(factorial[N - 1]) % mod;

	for(int i = N - 2; i >= 0; -- i) {
		invfac[i] = invfac[i + 1] * (i + 1);
		invfac[i] %= mod;
	}

	cout << solve();

	return 0;
}


#include<bits/stdc++.h>
using namespace std ;
#define Next( i, x ) for( register int i = head[x]; i; i = e[i].next )
#define rep( i, s, t ) for( register int i = (s); i <= (t); ++ i )
#define drep( i, s, t ) for( register int i = (t); i >= (s); -- i )
#define re register
#define int long long
int gi() {
	char cc = getchar() ; int cn = 0, flus = 1 ;
	while( cc < '0' || cc > '9' ) {  if( cc == '-' ) flus = - flus ; cc = getchar() ; }
	while( cc >= '0' && cc <= '9' )  cn = cn * 10 + cc - '0', cc = getchar() ;
	return cn * flus ;
}
const int N = 100 + 5 ;
const int M = 6e5 + 5 ;
int n, m, P, lim, Ans[N], dp[N][M], sum[N][M] ;
signed main()
{
	n = gi(), m = gi(), P = gi(), lim = n * (n + 2) / 2 * m, dp[0][0] = 1 ;
	rep( i, 1, n ) {
		rep( j, 0, i - 1 ) sum[i][j] = dp[i - 1][j] ;
		rep( j, i, lim ) sum[i][j] = (sum[i][j - i] + dp[i - 1][j]) % P ;
		rep( j, 0, (m + 1) * i - 1 ) dp[i][j] = sum[i][j] ;
		rep( j, i * (m + 1), lim ) dp[i][j] = (sum[i][j] - sum[i][j - i * (m + 1)] + P) % P ;
	}
	rep( i, 1, n ) rep( j, 0, lim )
		Ans[i] = (Ans[i] + dp[i - 1][j] * dp[n - i][j]) % P ;
	rep( i, 1, n ) printf("%lld\n", (Ans[i] * (m + 1) % P + P - 1) % P ) ;
	return 0 ;
}

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

/*
 * @title ModInt
 * @docs md/util/ModInt.md
 */
template<long long& mod> class ModInt {
public:
    long long x;
    constexpr ModInt():x(0) {}
    constexpr ModInt(long long y) : x(y>=0?(y%mod): (mod - (-y)%mod)%mod) {}
    ModInt &operator+=(const ModInt &p) {if((x += p.x) >= mod) x -= mod;return *this;}
    ModInt &operator+=(const long long y) {ModInt p(y);if((x += p.x) >= mod) x -= mod;return *this;}
    ModInt &operator+=(const int y) {ModInt p(y);if((x += p.x) >= mod) x -= mod;return *this;}
    ModInt &operator-=(const ModInt &p) {if((x += mod - p.x) >= mod) x -= mod;return *this;}
    ModInt &operator-=(const long long y) {ModInt p(y);if((x += mod - p.x) >= mod) x -= mod;return *this;}
    ModInt &operator-=(const int y) {ModInt p(y);if((x += mod - p.x) >= mod) x -= mod;return *this;}
    ModInt &operator*=(const ModInt &p) {x = (x * p.x % mod);return *this;}
    ModInt &operator*=(const long long y) {ModInt p(y);x = (x * p.x % mod);return *this;}
    ModInt &operator*=(const int y) {ModInt p(y);x = (x * p.x % mod);return *this;}
    ModInt &operator^=(const ModInt &p) {x = (x ^ p.x) % mod;return *this;}
    ModInt &operator^=(const long long y) {ModInt p(y);x = (x ^ p.x) % mod;return *this;}
    ModInt &operator^=(const int y) {ModInt p(y);x = (x ^ p.x) % mod;return *this;}
    ModInt &operator/=(const ModInt &p) {*this *= p.inv();return *this;}
    ModInt &operator/=(const long long y) {ModInt p(y);*this *= p.inv();return *this;}
    ModInt &operator/=(const int y) {ModInt p(y);*this *= p.inv();return *this;}
    ModInt operator=(const int y) {ModInt p(y);*this = p;return *this;}
    ModInt operator=(const long long y) {ModInt p(y);*this = p;return *this;}
    ModInt operator-() const {return ModInt(-x); }
    ModInt operator++() {x++;if(x>=mod) x-=mod;return *this;}
    ModInt operator--() {x--;if(x<0) x+=mod;return *this;}
    ModInt operator+(const ModInt &p) const { return ModInt(*this) += p; }
    ModInt operator-(const ModInt &p) const { return ModInt(*this) -= p; }
    ModInt operator*(const ModInt &p) const { return ModInt(*this) *= p; }
    ModInt operator/(const ModInt &p) const { return ModInt(*this) /= p; }
    ModInt operator^(const ModInt &p) const { return ModInt(*this) ^= p; }
    bool operator==(const ModInt &p) const { return x == p.x; }
    bool operator!=(const ModInt &p) const { return x != p.x; }
    ModInt inv() const {int a=x,b=mod,u=1,v=0,t;while(b > 0) {t = a / b;swap(a -= t * b, b);swap(u -= t * v, v);} return ModInt(u);}
    ModInt pow(long long n) const {ModInt ret(1), mul(x);for(;n > 0;mul *= mul,n >>= 1) if(n & 1) ret *= mul;return ret;}
    friend ostream &operator<<(ostream &os, const ModInt &p) {return os << p.x;}
    friend istream &operator>>(istream &is, ModInt &a) {long long t;is >> t;a = ModInt<mod>(t);return (is);}
};
long long mod;
using mint = ModInt<mod>;

int main() {
    cin.tie(0);ios::sync_with_stdio(false);
    int N,K;
    cin >> N >> K >> mod;

    int L = N*(N-1)/2*K;
    vector<vector<mint>> dp(N,vector<mint>(L+1,0));
    dp[0][0]=1;
    for(int i=1;i<N;++i) {
        dp[i]=dp[i-1];
        //jの値をj,j+1*i,j+2*i,...,j+K*iに加算したい
        //累積和で考えると、j+(K+1)*i,j+(K+2)*i,...に足しすぎる。
        //imosを考えると先に j+(K+1)*iからjの分を引けば良い。
        for(int j=L; 0 <= j; --j) if(j + (K+1)*i <= L) dp[i][j + (K+1)*i] -= dp[i][j];
        for(int j=0;j<=L; ++j) if(j + i <= L) dp[i][j+i] += dp[i][j];
    }
    vector<mint> ans(N+1);
    for(int i=1;i<=N;++i) {
        int l = i-1;
        int r = N-i;
        mint sum = 0;
        for(int j=0;j<=L;++j) sum += dp[l][j]*dp[r][j];
        ans[i]=sum*(K+1) - 1;
    }
    for(int i=1;i<=N;++i) {
        cout << ans[i] << "\n";
    }

    return 0;
}


#pragma GCC optimize("O3")
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC optimize("no-stack-protector")
#pragma GCC optimize("fast-math")
#pragma GCC optimize("trapv")
#pragma GCC target("sse4")

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

typedef pair<int, int> pi;
typedef pair<long long, long long> pll;
typedef vector<int> vi;
typedef vector<long long> vl;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
typedef long long int ll;
typedef unsigned long long int  ull;
typedef priority_queue<ll> mxhpl;
typedef priority_queue<int> mxhpi;
typedef priority_queue<ll, vector<ll>, greater<ll>> mnhpl;
typedef priority_queue<int, vector<int>, greater<int>> mnhpi;

#define rep(i,start,end) for(ll i = start; i <= end; ++i)
#define rrep(i,end,start) for(ll i = end; i >= start; --i)
#define parr(a,n) rep(i,0,n-1){cout << a[i] << " ";}cout<<"\n"
#define sarr(a,n) rep(i,0,n-1)cin >> a[i]
#define pb push_back
#define F first
#define S second
#define all(a) a.begin(),a.end()
#define mset(a,x) memset(a, x, sizeof(a))
#define ps(x,y) fixed<<setprecision(y)<<x //cout << ps(ans, decimal places);
#define setbits(x) __builtin_popcountll(x)
#define zrobits(x) __builtin_ctzll(x)

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

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

// Fast IO
void IO() {
  ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#ifndef ONLINE_JUDGE
  freopen("input.txt", "r", stdin);
#endif
}

#define MOD 1000000007

//CODE
/*******************************************************/
#define MX 200001

ll n;

void solve() {
  cin >> n;
  vl a(n), b(n), c(n), whoHasMyBag(n);

  sarr(a, n);
  sarr(b, n);
  sarr(c, n);
  vector<pll> wp;
  rep(i, 0, n - 1) {
    if (c[i] - 1 != i && a[i] <= b[c[i] - 1]) {
      cout << "-1\n";
      return;
    }
    c[i]--;
    wp.pb({ a[i],i });
    whoHasMyBag[c[i]] = i;
  }

  sort(all(wp));
  vector<pll> ans;
  for (auto p : wp) {
    if (c[p.S] == p.S) continue;
    ans.pb({ p.S + 1,whoHasMyBag[p.S] + 1 });

    c[whoHasMyBag[p.S]] = c[p.S];
    whoHasMyBag[c[whoHasMyBag[p.S]]] = whoHasMyBag[p.S];
  }

  // debug("TEST");
  cout << ans.size() << "\n";
  for (auto p : ans) {
    cout << p.F << " " << p.S << "\n";
  }
  // debug(ans, c);
}

int main() {
  IO();
  int t = 1;

  // cin >> t;

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

/*******************************************************/

#include <bits/stdc++.h>
using namespace std;
int main(){
	ios::sync_with_stdio(0);
	cin.tie(0); cout.tie(0);
	int N; cin >> N;
	int A[200010], B[200010], P[200010];
	int pos[200010];
	pair<int, int> W[200010];
	for(int i = 1; i <= N; i++) cin >> A[i];
	for(int i = 1; i <= N; i++) cin >> B[i];
	for(int i = 1; i <= N; i++) cin >> P[i];
	for(int i = 1; i <= N; i++) pos[P[i]] = i;
	for(int i = 1; i <= N; i++){
		W[i].first = A[i]; W[i].second = i;
	}
	sort(W+1, W+N+1);
	vector<pair<int, int>> ans;
	for(int i = 1; i <= N; i++){
		int a = W[i].second;
		if(P[a] == a) continue;
		if(A[a] <= B[P[a]]){
			cout << -1 << "\n";
			return 0;
		}
		ans.emplace_back(a, pos[a]);
		int x = P[a]; int y = pos[a];
		P[a] = a; P[y] = x;
		pos[a] = a; pos[x] = y;
	}
	cout << ans.size() << "\n";
	for(auto p : ans){
		cout << p.first << " " << p.second << "\n";
	}
}


#include <iostream>
using namespace std;

int main()
{
    int A, B;
    cin >> A >> B;

    for(int r = B; r >= 1; r--)
    {
        if((B/r * r) - r >= A)
        {
            cout << r << '\n';
            return 0;
        }
    }
}

#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>

#include <algorithm>
#include <bitset>
#include <complex>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>

#include <cassert>
#include <functional>

using ll = long long;
using namespace std;

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

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

#ifndef LOCAL
#define debug(...) ;
#else
#define debug(...) cerr << __LINE__ << " : " << #__VA_ARGS__ << " = " << _tostr(__VA_ARGS__) << endl;

template<typename T>
ostream &operator<<(ostream &out, const vector<T> &v);

template<typename T1, typename T2>
ostream &operator<<(ostream &out, const pair<T1, T2> &p) {
  out << "{" << p.first << ", " << p.second << "}";
  return out;
}

template<typename T>
ostream &operator<<(ostream &out, const vector<T> &v) {
  out << '{';
  for (const T &item : v) out << item << ", ";
  out << "\b\b}";
  return out;
}

void _tostr_rec(ostringstream &oss) {
  oss << "\b\b \b";
}

template<typename Head, typename... Tail>
void _tostr_rec(ostringstream &oss, Head &&head, Tail &&...tail) {
  oss << head << ", ";
  _tostr_rec(oss, forward<Tail>(tail)...);
}

template<typename... T>
string _tostr(T &&...args) {
  ostringstream oss;
  int size = sizeof...(args);
  if (size > 1) oss << "{";
  _tostr_rec(oss, forward<T>(args)...);
  if (size > 1) oss << "}";
  return oss.str();
}
#endif

constexpr int mod = 1'000'000'007; //1e9+7(prime number)
constexpr int INF = 1'000'000'000; //1e9
constexpr ll LLINF = 2'000'000'000'000'000'000LL; //2e18
constexpr int SIZE = 200010;

template<typename T>
vector<T> divisor(T n) {
  vector<T> res, res2;
  for (T i = 1; i * i <= n; i++) {
    if (n % i == 0) {
      res.push_back(i);
      if (i * i < n) res2.push_back(n / i);
    }
  }

  reverse(res2.begin(), res2.end());
  res.insert(res.end(), res2.begin(), res2.end());

  return res;
}

// GCC __gcd(long long A, long long B)

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

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

int main() {
  int A, B;

  cin >> A >> B;

  int ans = 1;

  for (int i = A; i <= B; i++) {
    int X = i;

    auto ds = divisor(X);

    for (int j : ds) {
      int Y = X - j;
      if (A <= Y && Y < X)
        chmax(ans, gcd(X, Y));
    }
  }

  cout << ans << endl;

  return 0;
}


#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i<(n); i++)
#define reps(i,s,n) for(int i=(s); i<(n); i++)
#define all(v) v.begin(),v.end()
#define outve(v) for(auto i : v) cout << i << " ";cout << endl
#define outmat(v) for(auto i : v){for(auto j : i) cout << j << " ";cout << endl;}
#define in(n,v) for(int i=0; i<(n); i++){cin >> v[i];}
#define out(n) cout << (n) << endl
#define fi first
#define se second
#define pb push_back
#define si(v) int(v.size())
#define len(v) int(v.length())
#define lob(v,n) lower_bound(all(v),n)
#define lobi(v,n) lower_bound(all(v),n) - v.begin()
#define upb(v,n) upper_bound(all(v),n)
#define upbi(v,n) upper_bound(all(v),n) - v.begin()
#define mod 1000000007
#define infi 1010000000
#define infl 1100000000000000000
#define cyes cout << "Yes" << endl
#define cno cout << "No" << endl
#define csp << " " <<
#define outset(n) cout << fixed << setprecision(n);
using namespace std;
using ll = long long;
using ld = long double;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vd = vector<double>;
using vvd = vector<vector<double>>;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;
using pii = pair<int,int>;
using pll = pair<ll,ll>;
template<typename T> using ve = vector<T>;
template<typename T> using pq2 = priority_queue<T>;
template<typename T> using pq1 = priority_queue<T,vector<T>,greater<T>>;
template<typename T> bool chmax(T &a, T b) {if(a < b) {a = b;return 1;}return 0;}
template<typename T> bool chmin(T &a, T b) {if(a > b) {a = b;return 1;}return 0;}

int main(){

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

    int N,M;
    cin >> N >> M;

    vvl dp(N+1,vl(int(1<<N),0));
    dp[0][0] = 1;

    ve<ve<pii>> A(N+1);
    rep(i,M) {
        int x;
        cin >> x;
        int y,z;
        cin >> y >> z;
        A[x].pb(make_pair(y,z));
    }

    rep(i,N) rep(j,int(1<<N)) if(dp[i][j] > 0){
        rep(k,N) if(!(j & 1 << k)) {
            int b = int(j | 1 << k);
            int f = 1;
            for (pii a : A[i+1]) {
                int n = 0;
                rep(ii, a.fi) if(b & 1 << ii) n++;
                if(n > a.se){
                    f = 0;
                    break;
                }
            }
            if(f){
                dp[i+1][b] += dp[i][j];
            }

        }

    }
    //outmat(dp);

    cout << dp[N][int(1<<N)-1] << endl;
    return 0;
}

#include <iostream>
#include <vector>
#include <unordered_set>
#include <random>
#include <algorithm>
#define INF (1ll<<60)
#define ll long long
using namespace std;

vector<pair<int,int>> counts[22];

bool HasBit(int x, int b) {
    return ((x>>b)&1);
}

ll dp[(1<<18)+1];

ll Solve(int N, int mask, int x) {

    if (x == N) {
        return 1;
    }

    if (dp[mask]!=-1) return dp[mask];
    ll ans=0;
    for(int val=0;val<N;val++) {
        if (HasBit(mask,val)) continue;
        int nmask = (mask|(1<<val));
        bool ok=true;
        for(pair<int,int> yz : counts[x]) {
            int y = yz.first;
            int z = yz.second;
            if (__builtin_popcount(nmask&((1<<(y+1))-1)) > z) ok=false;
        }
        if (ok) {
            ans += Solve(N, nmask, x+1);
        }
    }
    dp[mask]=ans;
    return ans;
}

int main() {
    int N,M;
    cin>>N>>M;
    for(int i=1;i<=M;i++) {
        int x,y,z;
        cin>>x>>y>>z;
        x--;
        y--;
        counts[x].push_back({y,z});
    }
    for(int mask=0;mask<(1<<N);mask++)
        dp[mask]=-1;
    cout << Solve(N, 0, 0) << endl;
}


 // AtCoder.cpp : このファイルには 'main' 関数が含まれています。プログラム実行の開始と終了がそこで行われます。
//

#ifndef ONLINE_JUDGE ///???

#endif ///????
#define _USE_MATH_DEFINES

#include<math.h>
#include<deque>
#include<queue>
#include<vector>
#include<algorithm>
#include<iostream>
#include<set>
#include<cmath>
#include<tuple>
#include<string>
#include<chrono>
#include<functional>
#include<iterator>
#include<random>
#include<unordered_set>
#include<array>
#include<map>
#include<iomanip>
#include<assert.h>
#include<bitset>
#include<stack>
#include<memory>
#include <sstream>
#pragma GCC optimize("Ofast") //???

using namespace std;
typedef long long ll;
#define rad_to_deg(rad) (((rad)/2/M_PI)*360)
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
#define rep(i,n) for(ll i=0;i<n;i++)
#define show(s) cout<<s<<endl
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)
#define LINF (1LL << 50)
#define MOD (1e9+7)
#define rrep(i,n) for(int i=n-1;i>=0;--i)

typedef pair < ll, ll> P;

//元がintの分けたものを返す p[0]は1桁目
vector<int> divnum(ll num) {
	int dig;
	vector<int>p;
	while (num) {
		dig = num % 10;
		p.push_back(dig);
		num /= 10;
	}
	return p;
}
//桁数を返す
int digiter(ll num) {
	int dig;
	vector<int>p;
	while (num) {
		dig = num % 10;
		p.push_back(dig);
		num /= 10;
	}
	return p.size();
}
//元がstringの分けたものを返す d[0]は最高位
vector<int> convertstring(string s) {
	vector<int> d;
	ll n = s.size();
	reverse(s.begin(), s.end());
	rep(i, n) {
		d.push_back(s[i] - '0');
	}
	return d;
}

// 1-indexedなので注意。(先頭が1から始まる) O(log N) (Nは要素数)
struct BIT {
private:
	vector<int> bit;
	int N;
public:
	BIT(int size) {
		N = size;
		bit.resize(N + 1);
	}

	// 一点更新です
	void add(int a, int w) {//a番目にwを加算
		for (int x = a; x <= N; x += x & -x) bit[x] += w;
	}

	// 1~a(以下)までの和を求める。[1,a]
	int sum(int a) {
		int ret = 0;
		for (int x = a; x > 0; x -= x & -x) ret += bit[x];
		return ret;
	}
};

/*long double　は%Lf*/
//queue古い順,stack新しい順
int N; P A[3000005]; ll cnt[3000005],res[3000005];
int32_t main() {
	cin >> N;
	rep(i, N) {
		int a;
		cin >> a;
		A[i] = P(a, i+1);
	}
	sort(A, A + N);
	BIT bit(N+5);

	rep(i, N) {
		int sum = bit.sum(A[i].second);
		cnt[A[i].first]=A[i].second - 1 - sum;
		bit.add(A[i].second,1);
		res[0]+=(cnt[A[i].first]);
	}
	rep(i, N) {
		swap(A[i].first, A[i].second);
	}
	sort(A, A + N);
	rep(i, N) {
		res[i+1] = res[i]+N-A[i].second-1LL-A[i].second;
	}
	rep(i, N) {
		cout << res[i] << endl;
	}

}

#include <bits/stdc++.h>
using namespace std;
#define BUFF ios::sync_with_stdio(false),cin.tie(0),cout.tie(0)
#define rep(i,a,n) for(int i=a;i<=n;++i)
#define per(i,n,a) for(int i=n;i>=a;--i)
#define ll long long
inline ll read(){ll f=1;ll x=0;char ch=getchar();while(ch>'9'||ch<'0'){if(ch=='-')f=-1;ch=getchar();}while(ch>='0'&&ch<='9')x=(x<<3)+(x<<1)+ch-'0',ch=getchar();return x*f; }
inline ll quick_pow(ll a,ll b,ll mod) {ll ans=1,base=a;while(b){if(b&1)ans=ans*base%mod;base=base*base%mod;b>>=1;}return ans%mod;}
inline ll inv(ll x,ll p){return quick_pow(x,p-2,p);}
inline ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
inline ll lcm(ll a,ll b){return a*b/gcd(a,b);}
const double pi=acos(-1.0);
const ll inf = LONG_LONG_MAX;
const ll mod = 1e9+7;
const ll maxn = 1e4 + 10;
ll a[maxn];

int main()
{
    ll n;
    n = read();
    rep(i,1,n)
    {
        a[i] = read();
    }
    ll ans = 0;
    for (int i = 1;i <= n;i++)
    {
        ll minn = a[i];
        for (int j = i; j <= n;j++)
        {
            minn = min(minn, a[j]);
            ans = max(ans, minn * (j - i + 1));
        }
    }
    cout << ans << endl;
    return 0;
}


/********include********/
#include <cstdio>
#include <cstring>
#include <iostream>
#include <string>
#include <cmath>
#include <bitset>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <algorithm>
#include <complex>
#include <unordered_map>
#include <unordered_set>
#include <random>
#include <cassert>
#include <fstream>
#include <utility>
#include <functional>
#define popcount __builtin_popcount
using namespace std;
//#include <atcoder/all>

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

/********define********/
const int MAX = 510000;
const int MOD = 1000000007;

#define rep(i,x) for(long long i=0;i<x;i++)
#define repn(i,x) for(long long i=1;i<=x;i++)
#define rrep(i,x) for(long long i=x-1;i>=0;i--)
#define rrepn(i,x) for(long long i=x;i>1;i--)
#define REP(i,n,x) for(long long i=n;i<x;i++)
#define REPN(i,n,x) for(long long i=n+1;i<x;i++)

#define pr printf
#define re return
#define mod 1000000007
//#define mod 998244353
#define inf  INT_MAX//19桁
#define INF 1e18+5//19桁
const double PI=3.14159265358979323846;
#define fi first
#define se second
#define MAX(a,b) (((a)>(b))?(a):(b))
#define MIN(a,b) (((a)<(b))?(a):(b))
#define all(x) (x).begin(),(x).end()

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

/********変数宣言********/
//vector<long long> g[200020];
vector<pair<long long,long long>> g[200020];
ll s[200020];
bool used[200020];
//bool dp[100005];

ll A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,Q,R,S,T,U,V,W,X,Y,Z;
double dA,dB,dC,dD,dE,dF,dG,dH,dI,dJ,dK,dL,dM,dN,dO,dP,dQ,dR,dS,dT,dU,dV,dW,dX,dY,dZ;

string sa,sb,sc,sd,se,sf,sg,sh,si,sj,sk,sl,sm,sn,so,sp,sq,sr,ss, su,sv,sw,sx,sy,sz;
int main()
{
	cin.tie(0);
	ios::sync_with_stdio(false);

	cin>>N;cin>>M;

	vector<string>v(M);

	vector<pair<long long, string> > p(M);
	//sort(p.begin(), p.end());
	//sort(p.begin(), p.end(),greater<pair<long long,long long> >());

	rep(j,M){
		cin>>v[j];
	}
	rep(i,M){
		p[i].fi=v[i].size();
		p[i].se=v[i];
	}
	//sort(p.begin(), p.end());
	ll check;
	check=0;
	ll i;
	i=0;
	ll flg;
	while(check<N*N && i<M){

		if(check%N!=0){
			if(p[i-1].se[p[i-1].se.size()-1]==p[i].se[0]){
				rep(j,p[i].se.size()-1){
					p[i].se[j]=p[i].se[j+1];
				}
				p[i].se.resize(p[i].se.size()-1);
			}
		}

		if(check%N+p[i].se.size()<=N){
			cout<<p[i].se;
			check+=p[i].se.size();
			if(check%N==0){
				cout<<"\n";
			}
		}
		else{
			while(check%N!=0){
				cout<<".";
				check++;
			}
			cout<<"\n";
		}
		i++;
	}
	re 0;
}

#include<bits/stdc++.h>
#define ll long long
#define dbg(x) cout<<#x<<": "<<x<<endl;
#define N 2005
#define M 1000000007
#define pii pair<ll,ll>
#define fast ios_base::sync_with_stdio(0);cin.tie(0);
using namespace std;
string s[2005];
int h,w;
ll dp[N][N][5];

bool valid(int i,int j)
{
    return i>=0&&i<h&&j>=0&&j<w&&s[i][j]=='.';
}

ll run(int i,int j,int c)
{
    if(i==h-1&&j==w-1)
    {
        return 1;
    }
    if(dp[i][j][c]!=-1)
        return dp[i][j][c];
    ll ans=0;
    if(c==0)
    {
        if(valid(i,j+1)) ans=(ans+run(i,j+1,1));
        if(valid(i+1,j)) ans=(ans+run(i+1,j,2));
        if(valid(i+1,j+1)) ans=(ans+run(i+1,j+1,3));
    }
    else if(c==1)
    {
        ans=(ans+run(i,j,0));
        if(valid(i,j+1)) ans=(ans+run(i,j+1,1));
    }
    else if(c==2)
    {
        ans=(ans+run(i,j,0));
        if(valid(i+1,j)) ans=(ans+run(i+1,j,2));
    }
    else if(c==3)
    {
        ans=(ans+run(i,j,0));
        if(valid(i+1,j+1)) ans=(ans+run(i+1,j+1,3));
    }
    ans%=M;
    return dp[i][j][c]=ans;
}

main()
{
    memset(dp,-1,sizeof dp);
    cin>>h>>w;
    for(int i=0;i<h;i++)
        cin>>s[i];
    cout<<run(0,0,0);
}


#include <bits/stdc++.h>
#define M_PI           3.14159265358979323846  /* pi */
using namespace std;
using  ll = long long;

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

	cin >> N;
	cin >> A;
	cin >> B;

	cout << N - A + B << endl;
}

// Code for A - box
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define FOR(i,x,y) for(ll i=x;i<(ll)(y);i++)

#define MOD 1000000007
#define mod(x) ( (x) % MOD + MOD ) % MOD

#define debug(var)  do{std::cout << #var << " : ";view(var);}while(0)
template<typename T> void view(T e){std::cout << e << std::endl;}
template<typename T> void view(const std::vector<T>& v){for(const auto& e : v){ std::cout << e << " "; } std::cout << std::endl;}
template<typename T> void view(const std::vector<std::vector<T> >& vv){ for(const auto& v : vv){ view(v); } }
template<typename T, typename U> void view(const std::map<T, U>& m){ for(const auto& e : m){ std::cout << e.first << "=>" << e.second << " "; } std::cout << std::endl; }

int main() {
  int N, A, B;
  cin >> N >> A >> B;

  cout << N - A + B << endl;
  return 0;
}


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

int debug = 0;

const int N = 5e5;

int n, strong, cur, start, was[N], a[N], b[N], p[N];
vector <array <int, 2>> ans;

void fail() {
    puts("-1");
    exit(0);
}

void sw(int i, int j) {
    swap(p[i], p[j]);
    ans.push_back({i, j});
}

main() {
    cin >> n;
    rep(i, 1, n + 1) { cin >> a[i]; }
    rep(i, 1, n + 1) { cin >> b[i]; }
    rep(i, 1, n + 1) { cin >> p[i]; }
    rep(i, 1, n + 1) {
        if (i != p[i] && a[i] <= b[p[i]]) {
            fail();
        }
    }
    rep(i, 1, n + 1) {
        if (debug) {
            cerr << " i: "<< i << '\n';
        }
        if (!was[i]) {
            strong = i;
            start = i;
            was[start] = 1;
            cur = p[start];
            while (cur != start) {
                was[cur] = 1;
                if (a[cur] > a[strong]) {
                    strong = cur;
                }
                cur = p[cur];
            }

            while (p[strong] != strong) {
                if (debug) { cerr << " strong: " << strong << ' ' << p[strong] << '\n'; }
                sw(strong, p[strong]);
            }
        }
    }
    cout << ans.size() << '\n';
    for (auto i : ans) {
        cout << i[0] << ' ' << i[1] << '\n';
    }
}

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

#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<ld> vld;
typedef vector<bool> vb;
typedef pair<ll,ll> Pll;
typedef pair<int,int> Pin;

ll INF = 1e16;
int inf = 1e9;

#define ALL(x) (x).begin(), (x).end()
#define FOR(i, m, n) for (ll i = (m); i < (n); ++i)
#define REVFOR(i, m, n) for (ll i = ((n) - 1); i >= (m); --i)
#define REP(i, n) FOR(i, 0, n)
#define REVREP(i, n) REVFOR(i, 0, n)
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define bcnt __builtin_popcountll

// inputs
#define VLLIN(x, n) vll x(n); REP(i, n) cin >> x[i];
#define VIIN(x, n) vin x(n); REP(i, n) cin >> x[i];
#define VLDIN(x, n) vld x(n); REP(i, n) cin >> x[i];
#define SIN(s, n) string s; cin >> s;

#ifdef LOCAL
#include <prettyprint.hpp>
#define debug(...)  cerr << "[" << #__VA_ARGS__ << "]: ", d_err(__VA_ARGS__);
#else
#define debug(...) 83;
#endif

void d_err() {
    cerr << endl;
}

template <typename H, typename... T>
void d_err(H h, T... t) {
    cerr << h << " ";
    d_err(t...);
}

template <typename T>
void print(T x) {
    cout << x << "\n";
}

template <typename T>
void print(vector<T>& x) {
    int N = x.size();
    REP(i, N) {
        if (i > 0) cout << " ";
        cout << x[i];
    }
    cout << "\n";
}

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

    int n; cin >> n;
    string s1, s2; cin >> s1 >> s2;

    int c1 = 0, c2 = 0;
    REP(i, n) {
        c1 += s1[i] == '1';
        c2 += s2[i] == '1';
    }

    if (c1 != c2) {
        print(-1);
        return 0;
    }

    stack<int> q1, q2;
    REP(i, n) {
        if (s1[i] == '0') q1.push(i);
        if (s2[i] == '0') q2.push(i);
    }

    int ans = 0;
    assert(q1.size() == q2.size());
    while(q1.size()) {
        auto a = q1.top(); q1.pop();
        auto b = q2.top(); q2.pop();
        ans += a != b;
    }

    print(ans);

}


#include <iostream>
#include <string>
#include <cstring>
#include <algorithm>
#include <functional>
#include <cmath>
#include <set>
#include <queue>
#include <deque>
#include <vector>
#include <climits>
#include <sstream>
#include <iomanip>
#include <map>
#include <stack>
using namespace std;
using ui = unsigned int;
using ull = unsigned long long;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vvvi = vector<vector<vector<int>>>;
using vui = vector<ui>;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;
using vvvl = vector<vector<vector<ll>>>;
template <typename T>
using vv = vector<vector<T>>;
template <typename T>
using vvv = vector<vector<vector<T>>>;

int main()
{
	int N, M;
	cin >> N >> M;
	vi A(N);
	vi B(M);
	for (auto& i : A)
	{
		cin >> i;
	}
	for (auto& i : B)
	{
		cin >> i;
	}

	vvi dp(N + 1, vi(M + 1, INT_MAX));
	dp[0][0] = 0;
	for (auto i = 0; i <= N; ++i)
	{
		for (auto j = 0; j <= M; ++j)
		{
			if (dp[i][j] == INT_MAX)
			{
				continue;
			}

			if (i < N)
			{
				dp[i + 1][j] = min(dp[i + 1][j], dp[i][j] + 1);
			}
			if (j < M)
			{
				dp[i][j + 1] = min(dp[i][j + 1], dp[i][j] + 1);
				if (i < N)
				{
					auto temp = dp[i][j];
					if (A[i] != B[j])
					{
						++temp;
					}
					dp[i + 1][j + 1] = min(dp[i + 1][j + 1], temp);
				}
			}
		}
	}
	cout << dp[N][M] << endl;

	return 0;
}

#include <iostream>
#include <algorithm>
#include <cmath>
#include <vector>
#include <string>
#include <iomanip>
#include <functional>
#include <deque>
#include <stack>
#include <queue>
#include <bitset>
#include <map>
#include <set>
#include <unordered_set>
using namespace std;
typedef long long ll;
#define rep(i,n) for (ll i = 0; i < (ll)(n); i++)
#define REP(i,n) for (ll i = 1; i <= (ll)(n); i++)
#define FOR(i,a,b) for(ll i=a;i<=b;i++)
#define all(v) v.begin(), v.end()
#define pb push_back
#define vt vector
#define fcout cout<<fixed<<setprecision(15)
#define PI 3.1415926535897932384626433832795028841971693993751058209749445923078160628620899
const ll MOD = 1000000007;
const ll MOD2 = 998244353;
const ll INF = 1000000000000000000;
const ll NIL = -1;
const ll dx[4] = { 0,1,0,-1 };
const ll dy[4] = { 1,0,-1,0 };

ll N, X, A[110];

int main() {
	cin >> N >> X;
	rep(i, N) cin >> A[i];
	ll ANS = INF;
	for (ll c = 1; c <= N; c++) {
		ll dp[105][105][105];
		ll q = X % c;
		FOR(i, 0, N)FOR(j, 0, N)FOR(k, 0, c - 1) dp[i][j][k] = -1000000000000000000;
        FOR(i, 0, N) dp[i][0][0]=0;
		FOR(i, 1, N)FOR(j, 1, i)FOR(k, 0, c - 1) {
			ll p = k + c - (A[i - 1] % c);
			p %= c;
			if (i == j) {
				dp[i][j][k] = A[i - 1] + dp[i - 1][j - 1][p];
			}
			else {
				dp[i][j][k] = max(dp[i - 1][j][k], A[i - 1] + dp[i - 1][j - 1][p]);
			}
		}
		ll k = dp[N][c][q];
		if (k > 0) {
			ll tmp = (X - k) / c;
			ANS = min(ANS, tmp);
        }
	}
	cout << ANS << endl;
	return 0;
}


#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<int, int> ii;
#define mp make_pair
#define pb push_back
#define T ll t; cin>>t; while(t--)
#define print(name) for(auto t:name){cout<<t<<" ";}cout<<endl;
#define mod 1000000007
#define mod1 998244353
#define inf 1000000000000000000
#define mem(name,val) memset(name,val,sizeof(name))
#define f(n) for(ll i=0;i<n;i++)
#define rep(i,a,n) for(ll i=a;i<n;i++)
#define endl "\n"
ll gcd(ll a,ll b){if(b==0){return a;}return gcd(b,a%b);}
ll g1(ll n)
{
 string s=to_string(n);
 sort(s.begin(),s.end(),greater<char>());
 ll k1=stoll(s);
 return k1;
}
ll g2(ll n)
{
  string s=to_string(n);
  sort(s.begin(),s.end());
  ll k1=stoll(s);
  return k1;
}
ll func(ll n)
{
   return g1(n)-g2(n);
}
int main()
{
   ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
   #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
   #endif
   ll n,k;cin>>n>>k;
   //map<ll,ll>m;
   for(int i=1;i<=k;i++)
   {
    n=func(n);
   }
   cout<<n<<endl;
}

#include<bits/stdc++.h>
using namespace std;
int a,b,c,d,e,i,j,ii,jj,zx,xc,f[1500009],pas;
multiset <int> s,h;
multiset <int>::iterator it,tt;
void ins(int q){
	it=h.lower_bound(q);
	if(it!=h.end()&&(*it)==q){
		h.erase(it);
	}
	s.insert(q);
}
void er(int q){
	it=s.lower_bound(q);
	s.erase(it);
	it=s.lower_bound(q);
	if(it!=s.end()&&(*it)==q){

	}else{
		h.insert(q);
	}
}
void chk(){
	tt=h.begin();
	if(pas>(*tt)) pas=(*tt);
}
int main(){
	ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0);
	cin>>a>>b;
	pas=a+2;
	for(i=1; i<=a; i++){
		cin>>f[i];
	}
	for(i=0; i<=a+2; i++){
		h.insert(i);
	}
	for(i=1; i<=b; i++){
		//s.insert(f[i]);
		ins(f[i]);
	}
	chk();
	for(i=b+1; i<=a; i++){
		c=f[i-b];
		/*it=s.lower_bound(c);
		s.erase(it);*/
		er(c);
		//s.insert(f[i]);
		ins(f[i]);
		chk();
	}
	cout<<pas;
	return 0;
}