#include <bits/stdc++.h>
using namespace std;
#define int long long
const int nax=2e5+100;
vector<int> g[nax];
int cnt,res,n,k,md;
int dfs(int s,int pp)
{
    int p=0;
    for(auto it:g[s])
    if(it^pp)
    {
        int q=dfs(it,s);
        if(q<p)
        swap(p,q);
        if(p<=0 and q>0 and q-p<=md)
        p=q;
    }
    if(p==-md)
    {
        cnt++;
        return 1;
    }
    if(p<=0)
    return p-1;
    return p+1;
}
bool find()
{
    cnt=0;
    cnt+=dfs(1,0)<0;
    return cnt<=k;
}
int32_t main()
{
    cnt=res=0;
    cin>>n>>k;
    for(int i=1;i<n;i++)
    {
        int x,y;
        cin>>x>>y;
        g[x].push_back(y);
        g[y].push_back(x);
    }
    int l=1,r=n;
    while(l<=r)
    {
        md=(l+r)>>1;
        if(find())
        {
            res=md;
            r=md-1;
        }
        else
        l=md+1;
    }
    cout<<res;
    return 0;
}

#include<bits/stdc++.h>
#define fgx cerr<<"-----------------------"<<endl
#define LL long long
#define DB double
#define pb push_back
using namespace std;
inline int read(){
	int nm=0,fh=1; char c=getchar();
	for(;!isdigit(c);c=getchar()) if(c=='-') fh=-1;
	for(;isdigit(c);c=getchar()) nm=nm*10+c-'0';
	return nm*fh;
}
#define M 200020
#define pii pair<int,int>
#define mp make_pair
#define ds second
int n,K,ans,tot,to[M<<1],nt[M<<1],fs[M],dep[M],fa[M][21],lim;
bool vis[M]; priority_queue<pii >que;
inline void link(int u,int v){to[++tot]=v,nt[tot]=fs[u],fs[u]=tot;}
inline int Jump(int u,int k){for(int i=20;~i;i--) if(k&(1<<i)) u=fa[u][i]; return u;}
inline void dfs(int u,int last=0){
	dep[u]=dep[last]+1,fa[u][0]=last;
	for(int i=1;i<=20;i++) fa[u][i]=fa[fa[u][i-1]][i-1];
	for(int i=fs[u];i;i=nt[i]) if(to[i]^last) dfs(to[i],u);
}
inline void dfst(int u,int dep,int last=0){
	if(dep>lim) return; vis[u]=true;
	for(int i=fs[u];i;i=nt[i]) if(to[i]^last) dfst(to[i],dep+1,u);
}
inline bool Jud(int td){
	lim=td;
	for(int i=1;i<=n;i++) que.push(mp(dep[i],i)),vis[i]=false;
	int ret=0;
	while(!que.empty()){
		if(ret>=K) return 0;
		int u=que.top().ds,pos; que.pop();
		if(vis[u]) continue;
		if(dep[u]<=td) pos=1; else pos=Jump(u,td);
		dfst(pos,0),ret++;
		while(!que.empty()&&vis[que.top().ds]) que.pop();
	} return ret<=K;
}
int main(){
	n=read(),ans=n; K=read();
	for(int i=1;i<n;i++){int u=read(),v=read(); link(u,v),link(v,u);}
	dfs(1);
	for(int k=20;~k;k--){int td=ans-(1<<k); if(td>=0&&Jud(td)) ans=td;}
	printf("%d\n",ans);
	return 0;
}


#include<iostream>
#include<cmath>
#include<map>
#include<set>
#include<vector>
#include<algorithm>
using namespace std;
#define function function2
#define int long long int
int32_t main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	int n;
	int k=0;
	cin>>n;
	int temp=n;
	vector<int> vec;
	while(temp!=0)
	{
		vec.push_back(temp%10);
		temp/=10;
		k++;
	}
	int ones=0,twos=0,threes=0;
	for(int x:vec)
	{
		if(x%3==0)
		   threes++;
		else if(x%3==1)
		  ones++;
		else
		  twos++;
	}
	int val=threes;
	int i,j;
	for(i=0;i<=ones;i++)
	{
		for(j=0;j<=twos;j++)
		{
			int total=i+2*j;
			total+=3*threes;
			if(total%3==0)
			{
				val=max(val,i+j+threes);
			}
		}
	}
	if(val==0)
	  cout<<-1<<endl;
	else
	  cout<<k-val<<endl;
}

#include<bits/stdc++.h>

#define endl '\n'

using ll = long long;
using namespace std;

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

	string s;
	cin >> s;

	int n = s.length();

	int sum = 0;
	int ones = 0, twos = 0;
	for(char c : s) {
		int d = c-'0';
		sum += d;
		if(d % 3 == 1) ones++;
		if(d%3 == 2) twos++;
	}

	if(sum % 3 == 0) {
		cout << "0" << endl;
		return 0;
	}

	sum %= 3;
	if(sum == 1) {
		if(ones > 0 && n > 1) cout << 1;
		else if(twos > 1 && n > 2) cout << 2;
		else cout << "-1";
	}else if(sum == 2){
		if(twos > 0 && n > 1 ) cout << 1;
		else if(ones > 1 && n > 2) cout << 2;
		else cout << "-1";
	}

	return 0;
}


#include <bits/stdc++.h>
//#include<boost/multiprecision/cpp_int.hpp>
//#include <atcoder/all>
#define rep(i, a) for (int i = (int)0; i < (int)a; ++i)
#define rrep(i, a) for (int i = (int)a - 1; i >= 0; --i)
#define REP(i, a, b) for (int i = (int)a; i < (int)b; ++i)
#define RREP(i, a, b) for (int i = (int)a - 1; i >= b; --i)
#define pb push_back
#define eb emplace_back
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define popcount __builtin_popcount
using ll = long long;
constexpr ll mod = 1e9 + 7;
constexpr ll INF = 1LL << 60;

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

//using lll=boost::multiprecision::cpp_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;
}

template <typename T>
T mypow(T x, T n, const T &p = -1)
{ //x^nをmodで割った余り
	T ret = 1;
	while (n > 0)
	{
		if (n & 1)
		{
			if (p != -1)
				ret = (ret * x) % p;
			else
				ret *= x;
		}
		if (p != -1)
			x = (x * x) % p;
		else
			x *= x;
		n >>= 1;
	}
	return ret;
}

using namespace std;
//using namespace atcoder;

void solve()
{
	int n,m;
	cin>>n>>m;
	vector<int>a(n);
	rep(i,n)cin>>a[i];

	vector<int>cur(n+1,-1),nx(n+1,-1);
	int ans=n;
	rep(i,n){
		int pre=cur[a[i]];
		cur[a[i]]=i;
		nx[a[i]]=i+(m-1);
		if(i-pre>m){
			chmin(ans,a[i]);
		}
	}
	rep(i,n+1){
		if(nx[i]<n-1){
			chmin(ans,i);
		}
	}
	cout<<ans;
}

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

#include<bits/stdc++.h>
using namespace std;
#define int long long
#define fo(i,a,b) for(int i = a; i<b ; i++)
#define FIO ios_base::sync_with_stdio(false);   cin.tie(NULL);   cout.tie(NULL);
#define pb push_back
#define M 1000000007
int mod(int x){
return ((x%M + M)%M);
}
int add(int a,int b){
return mod(mod(a)+mod(b));
}
int mul(int a,int b){
return mod(mod(a)*mod(b));
}
// ****************************************************************************
int a[3002];
int n;
int dp[2][3002][3002];
int store[3002][3002];
// take 1 based indexing
void fun(){
   fo(j,1,n+1){
    //    j is the sequnce number
    int sum = 0;
    map<int,int>m;
    m[0]=0;
    fo(i,1,n+1){
        sum+=a[i];
        int curr = sum%j;
        if(m.find(curr)!=m.end()){
            store[m[curr]+1][j]=i;
        }
        m[curr]=i;
    }
   }
}
int rec(int f,int j,int i){
    if(i==n+1)
    return 1ll;
    if(dp[f][j][i]!=-1)
    return dp[f][j][i];
    int ans = 0;
    if(!f){
        // now i have to start jth sequnce from me
        // find the next pointer
        int next = store[i][j];
        if(!next)
        return 0;
        ans = mod(rec(1,j,next + 1));
    }
    else{
        // now i have got a jth sequnce
        // now start a new one from me
        ans = mod(rec(0,j+1,i));
        int next = store[i][j];
        if(next)
        ans=add(ans,rec(1,j,next+1));
    }
    return dp[f][j][i]=ans;
}
void solve(){
    cin>>n;
    fo(i,1,n+1)
    cin>>a[i];
    fun();
    // fo(i,1,n+1){
    //     fo(j,2,n+1)
    //     cout<<store[i][j]<<" ";
    //     cout<<"\n";
    // }
    memset(dp,-1,sizeof dp);
    cout<<rec(0,1,1);
}
signed main()
{
FIO
int t;
t=1;
// cin>>t;
while(t--)
{
solve();
}
}


#include <bits/stdc++.h>
#include <ext/numeric>

#include<ext/pb_ds/tree_policy.hpp>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/rope>
using namespace std;
using namespace __gnu_pbds;
using namespace __gnu_cxx;
template<class T> using Tree = tree<T, null_type, less<T>, rb_tree_tag,tree_order_statistics_node_update>;

using namespace std;
#define go ios::sync_with_stdio(0);cin.tie(nullptr);cout.tie(nullptr);
#define ll long long
typedef vector<vector<int>>vvi;
typedef complex<long double>Point;
const double Pi = acos(-1.0) , eps = 1e-8;
#define X real()
#define Y imag()
#define Angle(v) (atan2((v).Y , (v).X))
#define Length(v) ((long double)hypot((v).Y , (v).X))
#define Lengthsqr(v) (dot((v) , (v)))
const int mxn = 2e5+ 5 , mod = 1e9 + 7, MOD = 1e9 + 7 , mod2 = 998244353;

void bingo(){
	int odd = 0 , even = 0;
	ll x ;
	cin>>x;
	if(x % 4 == 1 || x%4 == 3)
		cout<<"Odd\n";
	else if(x % 4 == 2)
		cout<<"Same\n";
	else cout<<"Even\n";

}
int main() {
	go
#ifdef LOCAL
	freopen("input.in", "rt", stdin);
//	freopen("output.out", "wt", stdout);
#endif
	//freopen("card.in", "rt", stdin);
	int t = 1;
	cin>>t;
	while(t--){
		bingo();
	}
	return 0;
}

#pragma GCC target ("avx2")
#pragma GCC optimize ("unroll-loops")
#pragma GCC optimize ("O3")
#include "bits/stdc++.h"
#include <unordered_set>
#include <unordered_map>
#include <random>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
constexpr ll MOD = 1'000'000'007LL; /*998'244'353LL;*/
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(), (x).end()
#define rep(i, n) for(int (i)=0; (i)<(n); (i)++)
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; }
constexpr int dy[4]={-1,0,1,0};
constexpr int dx[4]={0,-1,0,1};

int N;
string S[60];

ll dp[2][62];
ll solve(int b, int n){
    if(n == N) return b;
    if(dp[b][n] != -1) return dp[b][n];
    ll ret;
    if(S[n] == "AND"){
        ret = solve(b&0, n+1) + solve(b&1, n+1);
    }
    else{
        ret = solve(b|0, n+1) + solve(b|1, n+1);
    }
    return dp[b][n] = ret;
}

signed main(){
    cin >> N;
    rep(i, N) cin >> S[i];
    memset(dp, -1, sizeof(dp));
    cout << solve(0, 0) + solve(1, 0) << endl;
}


#include<bits/stdc++.h>
using namespace std;
long long t,n;
long long read()
{
    long long num=0;bool flag=1;
    char c=getchar();
    for(;c<'0'||c>'9';c=getchar())
      if(c=='-')flag=0;
    for(;c>='0'&&c<='9';c=getchar())
      num=(num<<1)+(num<<3)+c-'0';
    return flag?num:-num;
}
int main(){
	t=read();
	while(t){
		n=read();
		if(n%2==1){
			printf("Odd\n");
		}
		if(n%4==0){
			printf("Even\n");
		}
		if(n%2==0&&n%4!=0)printf("Same\n");
		t--;
	}
	return 0;
}

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef complex<double> point;
#define endl '\n'
#define F first
#define S second
#define dbg(x) cerr<<#x<<" = "<<x<<endl
#define dbg2(x,y) cerr<<#x<<" = "<<x<<", "<<#y<<" = "<<y<<endl
#define dbg3(x,y,z) cerr<<#x<<" = "<<x<<", "<<#y<<" = "<<y<<", "<<#z<<" = "<<z<<endl
#define dbg4(x,y,z,q) cerr<<#x<<" = "<<x<<", "<<#y<<" = "<<y<<", "<<#z<<" = "<<z<<", "<<#q<<" = "<<q<<endl
#define FOR(sz) for(int i = 0; i < sz; ++i)
#define dbg_array(x,sz) FOR(sz) cerr << x[i] << " \n"[i==sz-1]
#define X real()
#define Y imag()

const int d4i[4] = { -1, 0, 1, 0 }, d4j[4] = { 0, 1, 0, -1 };
const int d8i[8] = { -1, -1, 0, 1, 1, 1, 0, -1 }, d8j[8] = { 0, 1, 1, 1, 0, -1, -1, -1 };

void _init_() {
	ios_base::sync_with_stdio(0), cin.tie(0);
#ifdef ECLIPSE
	freopen("input.txt", "rt", stdin);
//	freopen("output.txt", "wt", stdout);
#endif
}

const int N = 1000 + 9, M = 1e8 + 9, SEG = 131072; // SEG = 1 << ((int) ceil(log2(N)) + 1)
const int Mod_M = 1e9 + 7;

ll get_tens(ll num) {
	ll tens = 1;
	while (num) {
		num /= 10;
		tens *= 10;
	}
	return tens;
}

void solve() {
	ll n;
	scanf("%lld", &n);
	ull ans = 0;
	ll st = 1, res = 11, tens = 10;
	while (res <= n) {
//		if (st == 10) tens *= 10;
//		dbg(res);
		++ans;
		++st;
		tens = get_tens(st);
		res = st + st * tens;
	}

	printf("%llu", ans);
}

int main() {
	_init_();
//	int t;
//	scanf("%d", &t);
//	while (t--) {
	solve();
//	}
	return 0;
}


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

int main()
{
  int a,b,n;
  cin>>a>>b>>n;
  n*=1000;
  a=n/a;
  if(n%b==0)
    b=n/b;
  else
    b=n/b+1;
  if(a<b)
    cout<<"UNSATISFIABLE"<<endl;
  else
    cout<<b<<" "<<a<<endl;
}

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

int main(){
    int a,b,c;
    cin >> a >> b >> c;
    if(c){
        if(a >= b){
            cout << "Takahashi";
        }
        else
            cout << "Aoki";
    }
    else{
        if(b >= a)
            cout << "Aoki";
        else
            cout << "Takahashi";
    }
    cout << '\n';
}


#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <iomanip>
typedef long long ll;
using namespace std;

const int maxn = 2e5 + 79;
vector<vector<int> > g(maxn);
vector<int> d(maxn, 0), p(maxn, -1);
void dfs(int u, int pr = -1)
{
	for (int v : g[u])
	{
		if (v == pr) continue;
		d[v] = d[u] + 1;
		p[v] = u;
		dfs(v, u);
	}
}
vector<int> ord(maxn, 0), vis(maxn, 0);
void dfs_et(int u, int pr, vector<int>& et)
{
	et.push_back(u);
	for (int v : g[u])
	{
		if (v == pr || vis[v]) continue;
		dfs_et(v, u, et);
		et.push_back(u);
	}
}
int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	int n;
	cin >> n;
	for (int i = 0, a, b; i < n - 1; i++)
	{
		cin >> a >> b;
		g[--a].push_back(--b);
		g[b].push_back(a);
	}
	dfs(0, -1);
	int d1 = max_element(d.begin(), d.end()) -d.begin();
	d.assign(n, 0); p.assign(n, -1);
	dfs(d1, -1);
	int d2 = max_element(d.begin(), d.end()) - d.begin();
	vector<int> dia;
	for (int i = d2; i != -1; i = p[i])
	{
		dia.push_back(i); vis[i] = true;
	}
	vector<int> ord;
	for (int i : dia)
	{
		ord.push_back(i);
		for (int j : g[i])
			if (!vis[j])
			{
				dfs_et(j, -1, ord);
				ord.push_back(i);
			}
	}
	vector<int> ans(n, 0);
	for (int i = 0; i < ord.size(); i++)
	{
		if (!ans[ord[i]]) ans[ord[i]] = i + 1;
	}
	for (int i : ans) cout << i << " ";
	cout << "\n";
	return 0;
}

#include <bits/stdc++.h>
#define rep(i, l, r) for (register int i = l; i <= r; i++)
#define per(i, r, l) for (register int i = r; i >= l; i--)
#define srep(i, l, r) for (register int i = l; i < r; i++)
#define sper(i, r, l) for (register int i = r; i > l; i--)
#define erep(i, x) for (register int i = h[x]; i; i = e[i].next)
#define erep2(i, x) for (register int& i = cur[x]; i; i = e[i].next)
#define pii pair<int, int>
#define pll pair<ll, ll>
#define pdd pair<double, double>
#define fi first
#define se second
#define ui unsigned int
#define ld long double
#define pb push_back
#define pc putchar
#define lowbit(x) (x & -x)
#define maxr 2000020
#define gc() ((p1 == p2 && (p2 = (p1 = buffer) + fread(buffer, 1, maxr, stdin), p1 == p2)) ? EOF : *p1++)
using namespace std;

namespace Fast_Read{
    char buffer[maxr], *p1, *p2;
    template<class T> void read_signed(T& x){
        char ch = gc(); x = 0; bool f = 1;
        while (!isdigit(ch) && ch != '-') ch = gc();
        if (ch == '-') f = 0, ch = gc();
        while ('0' <= ch && ch <= '9') x = (x << 1) + (x << 3) + ch - '0', ch = gc();
        x = (f) ? x : -x;
    }
    template<class T, class... Args> void read_signed(T& x, Args&... args){
        read_signed(x), read_signed(args...);
    }
    template<class T> void read_unsigned(T& x){
        char ch = gc(); x = 0;
        while (!isdigit(ch)) ch = gc();
        while (isdigit(ch)) x = (x << 1) + (x << 3) + ch - '0', ch = gc();
    }
    template<class T, class... Args> void read_unsigned(T& x, Args&... args){
        read_unsigned(x), read_unsigned(args...);
    }
    #define isletter(ch) ('a' <= ch && ch <= 'z')
    int read_string(char* s){
        char ch = gc(); int l = 0;
        while (!isletter(ch)) ch = gc();
        while (isletter(ch)) s[l++] = ch, ch = gc();
        s[l] = '\0'; return l;
    }
}using namespace Fast_Read;

int _num[20];
template <class T> void write(T x, char sep = '\n'){
	if (!x) {putchar('0'), putchar(sep); return;}
	if (x < 0) putchar('-'), x = -x;
	int c = 0;
	while (x) _num[++c] = x % 10, x /= 10;
	while (c) putchar('0' + _num[c--]);
	putchar(sep);
}

#define read read_signed
#define reads read_string
#define writes puts

#define maxn 520
#define maxm
#define maxs
#define maxb
#define inf
#define eps
#define M
#define ll long long int

int lis[maxn * maxn], cs = 0;
int n, a[maxn];

//#define debug
void update(int p) {
	lis[++cs] = p;
	swap(a[p], a[p + 1]);

	#ifdef debug
		rep(i, 1, n) cerr << a[i] << ' '; cerr << endl;
	#endif
}

int main(){
	int T; read(T);
	while (T--){
		read(n); rep(i, 1, n) read(a[i]);
		if (n <= 3) {
			while (1) {
				bool ok = 1;
				rep(i, 1, n) {
					if (a[i] != i) {
						ok = 0;
						break;
					}
				}
				if (ok) break;

				if ((cs + 1) & 1) {
					update(1);
				}
				else {
					update(2);
				}
			}
			printf("%d\n", cs);
			rep(i, 1, cs) printf("%d ", lis[i]); printf("\n");
			cs = 0;
			continue;
		}
		int ptr = 0; while (ptr <= n && a[ptr] == ptr) ptr++;
		while (ptr <= n) {
			int f = -1;
			rep(i, ptr, n) {
				if (a[i] == ptr) {
					f = i;
					break;
				}
			}
			assert(f != 1 && f != -1);
			if (((f - 1) & 1) == ((cs + 1) & 1)) {
				while (a[ptr] != ptr) {
					update(f - 1);
					f--;
				}
			}
			else {
				if (f < n) {
					update(f);
					update(f - 1);
					while (a[ptr] != ptr) {
						update(f);
						f--;
					}
				}
				else {
					if (ptr - 1 < f - 2) {
						update(f - 2);
						while (a[ptr] != ptr) {
							update(f - 1);
							f--;
						}
					}
					else {
						update(f - 2);
						update(f - 1);
						update(f - 2);
						update(f - 1);
						update(f - 2);
						assert(a[ptr] == ptr);
					}
				}
			}

			while (ptr <= n && a[ptr] == ptr) ptr++;
		}

		printf("%d\n", cs);
		rep(i, 1, cs) printf("%d ", lis[i]); printf("\n");
		cs = 0;
	}
	return 0;
}


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

typedef long long ll;

bool ll_sqrt(ll x, ll& lower_bound, ll& upper_bound)
{
	constexpr ll ll_max = numeric_limits<ll>::max();

	bool first_boost = true;

	lower_bound = 0;
	upper_bound = x;
	while (upper_bound - lower_bound > 1)
	{
		if (first_boost)
		{
			ll guess = (ll)sqrt((double)x);
			lower_bound = max(guess - 1, (ll)0);
			upper_bound = lower_bound + 3;
			first_boost = false;
		}

		ll newval = (lower_bound + upper_bound) / 2;
		if ((newval != 0) && (newval > ll_max / newval))  // newval*newval becomes overflow
			upper_bound = newval;  // because overflow means newval is too big
		else
		{
			ll newval_sqr = newval * newval;
			if (newval_sqr < x)
				lower_bound = newval;
			else
				upper_bound = newval;
		}
	}

	if ((upper_bound != 0) && (upper_bound > ll_max / upper_bound))
	{
		if (lower_bound * lower_bound == x)
			upper_bound = lower_bound;
	}
	else
	{
		if (lower_bound * lower_bound == x)
			upper_bound = lower_bound;
		else if (upper_bound * upper_bound == x)
			lower_bound = upper_bound;
	}
	bool is_exact = (lower_bound == upper_bound);
	return is_exact;
}

ll ll_ceil(ll x, int digit);
ll ll_floor(ll x, int digit);

ll ll_floor(ll x, int digit)
{
	if (x < 0)
		return -ll_ceil(-x, digit);

	ll div = 1;
	while (digit != 0)
	{
		div *= 10;
		digit--;
	}
	ll modval = x % div;
	ll ans = x - modval;
	return ans;
}

ll ll_ceil(ll x, int digit)
{
	if (x < 0)
		return -ll_floor(-x, digit);

	ll div = 1;
	while (digit != 0)
	{
		div *= 10;
		digit--;
	}
	ll modval = x % div;
	ll ans = x - modval;
	if (modval != 0)
		ans += div;
	return ans;
}
int main() {
	ll M,H;
	cin >> M >> H;

	string ans = "No";

	if(H%M==0){
		ans="Yes";
	}

	cout << ans << endl;

  return 0;
}

#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 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 rev(x) reverse(x);
using ll=long long;
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));
}

const int mod = 1000000007;
const int max_n = 200005;
struct mint {
  ll x; // typedef long long ll;
  mint(ll x=0):x((x%mod+mod)%mod){}
  mint operator-() const { return mint(-x);}
  mint& operator+=(const mint a) {
    if ((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += mod-a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator*=(const mint a) { (x *= a.x) %= mod; return *this;}
  mint operator+(const mint a) const { return mint(*this) += a;}
  mint operator-(const mint a) const { return mint(*this) -= a;}
  mint operator*(const mint a) const { return mint(*this) *= a;}
  mint pow(ll t) const {
    if (!t) return 1;
    mint a = pow(t>>1);
    a *= a;
    if (t&1) a *= *this;
    return a;
  }
  bool operator==(const mint &p) const { return x == p.x; }
  bool operator!=(const mint &p) const { return x != p.x; }
  // for prime mod
  mint inv() const { return pow(mod-2);}
  mint& operator/=(const mint a) { return *this *= a.inv();}
  mint operator/(const mint a) const { return mint(*this) /= a;}
};
istream& operator>>(istream& is, mint& a) { return is >> a.x;}
ostream& operator<<(ostream& os, const mint& a) { return os << a.x;}

struct combination {
  vector<mint> fact, ifact;
  combination(int n):fact(n+1),ifact(n+1) {
    assert(n < mod);
    fact[0] = 1;
    for (int i = 1; i <= n; ++i) fact[i] = fact[i-1]*i;
    ifact[n] = fact[n].inv();
    for (int i = n; i >= 1; --i) ifact[i-1] = ifact[i]*i;
  }
  mint operator()(int n, int k) {
    if (k < 0 || k > n) return 0;
    return fact[n]*ifact[k]*ifact[n-k];
  }
}comb(max_n);

int main(){
    ll n,p;cin >> n >>p;
    mint ans=p-1;
    cout << ans*(ans-1).pow(n-1) <<endl;
}


//I still luv you Kashish <3
#include <bits/stdc++.h>
using namespace std ;
#define int                             long long
#define pb                              push_back
#define F                               first
#define S                               second
#define P                               push
#define nl                              "\n"
#define vvi                             vector<vector<int>>
#define vi                              vector<int>
#define vc                              vector<char>
#define pii                             vector<pair<int, int>>
#define sz(a)                           (int)a.size()
#define all(a)                          a.begin(),a.end()
#define sort(v)                         sort(all(v))
#define sortr(v)                        sort(v); reverse(all(v));
#define yes                             cout << "YES"
#define no                              cout << "NO"
#define PeeleMera                       ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
int binpow(int a, int b)                { int res = 1; while (b > 0) { if (b & 1) res = res * a; a = a * a; b >>= 1; } return res;}
int binpowmod(int a, int b, int mod)    { int res = 1; while (b > 0) { if (b & 1) res = res * a , res = res % mod ; a = a * a , a = a % mod ; b >>= 1 ; } return res % mod; }
vi  sieve(int n)                        {int*arr = new int[n + 1](); vi vect; for(int i=2;i<=n;i++)if(arr[i]==0){vect.push_back(i);for(int j=2*i;j<=n;j+=i)arr[j]=1;}return vect;}
// void bin(int n)                         {/* vi v; define karna na bhoole */ if (n > 1)bin(n / 2);v.pb(n%2);}
mt19937                                 rng(chrono::steady_clock::now().time_since_epoch().count());
#define Peele_Mera                             cerr<<"Time : "<<1000*(long double)clock()/(long double)CLOCKS_PER_SEC<<"ms\n";
const int                               N = 1e9 + 7 , N1 = 1e7 + 5 , N2 = 1e6 + 3, N3 = 1e5 + 3;
#define IM                              -1e18
#define IX                              1e18

void solve()
{
    int n;
    cin>>n;
    for(int i=0;i<1e5;i++)
    {
        if(i*(i+1)/2>=n)
        {
            cout<<i;
            break;
        }
    }
}

signed main()
{
    PeeleMera;
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif
    int t=1;
    // cin>>t;./
    // cout<<fixed<<setprecision(9);

    while(t--)
    {
        solve();
        cout<<endl;
    }
    Peele_Mera;
}

#include <iostream>
using namespace std;
bool chek[200001];
int main()
{
    ios::sync_with_stdio(false);
    cin.tie(NULL);
    int n;
    cin >> n;
    int ret = 0, temp;
    for (int i = 0; i < n; i++) {
        cin >> temp;
        chek[temp] = true;
        while (chek[ret])ret++;
        if (i) cout << "\n";
        cout << ret;
    }
    return 0;
}


#include <bits/stdc++.h>

using namespace std;
using ll = long long;
using ld = long double;

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

const ll MOD = 1000000007;
const int _max = 2000000;
vector<ll> fact(_max+1), factinv(_max+1);

//Fast modular exponentiation
long long fast_exp(long long base, long long exp, long long mod) {
    long long res=1;
    while(exp>0) {
       if(exp%2==1) res=(res*base)%mod;
       base=(base*base)%mod;
       exp/=2;
    }
    return res%mod;
}

void precompute(){
        fact[0] = 1;
        for(int i = 1; i <= _max; i++){
                fact[i] = (fact[i-1]*i)%MOD;
        }
        for(int i = 0; i <= _max; i++){
                factinv[i] = fast_exp(fact[i], MOD-2, MOD);
        }
}

void solve(){
    int n, m, k;
    cin >> n >> m >> k;
    if(n-k-1 >= m){
            cout << 0 << "\n";
    }
    else{
            ll total = (((fact[n+m]*factinv[n])%MOD)*factinv[m])%MOD;
            //cout << total << "\n";
            if(n == k){
                    cout << total << "\n";
            }
            else{
                    ll bad = (((fact[n+m]*factinv[n-k-1])%MOD)*factinv[m+k+1])%MOD;
                    ll ans = total - bad;
                    if(ans < 0) ans += MOD;
                    cout << ans << "\n";
            }
    }
}

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

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

using namespace std;

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

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

long long int power(long long int x, long long int n, long long int M) {
	long long int ret = 1;
	long long int by = x;
	while (n) {
		if (n & 1) {
			ret *= by;
			ret %= M;
		}
		by *= by;
		by %= M;
		n >>= 1;
	}
	return ret;
}

long long by[2222222];
long long inv[2222222];

long long ncr(long long n, long long r) {
	if (r<0 || r>n)return 0;
	return by[n] * inv[n - r] % MOD * inv[r] % MOD;
}

void Solve(int a, int b, int c) {
	long long ans = ncr(a + b, a);
	ans += MOD - ncr(a + b, a - (c + 1));
	ans %= MOD;
	cout << ans << endl;
}

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

	by[0] = by[1] = inv[0] = inv[1] = 1;
	for (int i = 2; i < 2222222; i++) {
		by[i] = by[i - 1] * i % MOD;
	}
	inv[2222221] = power(by[2222221], MOD - 2, MOD);
	for (int i = 2222220; i > 0; i--) {
		inv[i] = inv[i + 1] * (i + 1) % MOD;
	}
	cin >> N >> M >> K;
	if (N - M > K) {
		cout << 0 << endl;
		return 0;
	}
	Solve(N, M, K);
}


#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <cmath>
using namespace std;
using ll = long long;

struct UnionFind {
    UnionFind(int n) : p(n, -1) {}
    int root(int u) {
        return p[u] < 0 ? u : p[u] = root(p[u]);
    }
    int size(int u) {
        return -p[root(u)];
    }
    bool same(int u, int v) {
        return root(u) == root(v);
    }
    void unite(int u, int v) {
        u = root(u);
        v = root(v);
        if (u == v) return;
        if (p[u] > p[v]) swap(u, v);
        p[u] += p[v];
        p[v] = u;
    }
    vector<int> p;
};

template <class T, class F>
T LowerBound(T i0, T i1, F f) {
    while (i0 < i1) {
        T i = i0 + (i1 - i0) / 2;
        if (f(i)) i1 = i; else i0 = i + 1;
    }
    return i0;
}

struct P {
    int x, y;
};

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

    vector<P> p(n);
    for (int i = 0; i < n; i++) {
        int x, y;
        cin >> x >> y;

        p[i] = { x, y };
    }

    auto r2 = LowerBound<int>(2, 40001, [&](auto r2) {
        UnionFind uf(n + 2);
        for (int i = 0; i < n; i++) {
            for (int j = 0; j < i; j++) {
                int x = p[i].x - p[j].x;
                int y = p[i].y - p[j].y;
                if (x * x + y * y < r2) uf.unite(i, j);
            }
            for (int h = 0; h < 2; h++) {
                int y = p[i].y - 100 * (h == 0 ? 1 : -1);
                if (y * y < r2) uf.unite(i, n + h);
            }
        }
        return uf.same(n, n + 1);
    }) - 1;

    printf("%.9f\n", sqrt(r2) * 0.5);

    return 0;
}

#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <string>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <iomanip>
#include <utility>
#include <tuple>
#include <functional>
#include <bitset>
#include <cassert>
#include <complex>
#include <stdio.h>
#include <time.h>
#include <numeric>
#include <random>
#include <unordered_map>
#include <unordered_set>
#define all(a) a.begin(),a.end()
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define pb push_back
#define debug(x) cerr << __LINE__ << ' ' << #x << ':' << (x) << '\n'
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
using namespace std;
typedef long long ll;
typedef unsigned int uint;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<ll, ll> P;
typedef complex<ld> com;
template<class T> using prique = priority_queue<T, vector<T>, greater<T>>;
constexpr int inf = 1000000010;
constexpr ll INF = 1000000000000000010;
constexpr int mod1e9 = 1000000007;
constexpr int mod998 = 998244353;
constexpr ld eps = 1e-12;
constexpr ld pi = 3.141592653589793238;
constexpr ll ten(int n) { return n ? 10 * ten(n - 1) : 1; };
int dx[] = { 1,0,-1,0,1,1,-1,-1 }; int dy[] = { 0,1,0,-1,1,-1,1,-1 };
void fail() { cout << "-1\n"; exit(0); } void no() { cout << "No\n"; exit(0); }
template<class T, class U> inline bool chmax(T &a, const U &b) { if (a < b) { a = b; return true; } return false; }
template<class T, class U> inline bool chmin(T &a, const U &b) { if (a > b) { a = b; return true; } return false; }
template<class T> istream &operator >> (istream &s, vector<T> &v) { for (auto &e : v) s >> e; return s; }
template<class T> ostream &operator << (ostream &s, const vector<T> &v) { for (auto &e : v) s << e << ' '; return s; }

struct fastio {
	fastio() {
		cin.tie(0); cout.tie(0);
		ios::sync_with_stdio(false);
		cout << fixed << setprecision(20);
		cerr << fixed << setprecision(20);
	}
}fastio_;

class unionfind {
	vector<int> par;
	vector<int> sz;
public:
	unionfind(int n) {
		par = vector<int>(n);
		for (int i = 0; i < n; i++) par[i] = i;
		sz = vector<int>(n, 1);
	}
	int find(int x) {
		if (par[x] == x) return x;
		else return par[x] = find(par[x]);
	}
	int size(int x) { return sz[find(x)]; }
	bool same(int x, int y) { return find(x) == find(y); }
	void unite(int x, int y) {
		x = find(x);
		y = find(y);
		if (x == y) return;
		if (sz[x] < sz[y]) {
			par[x] = y;
			sz[y] += sz[x];
		}
		else {
			par[y] = x;
			sz[x] += sz[y];
		}
	}
};

bool comp(pair<P, ld> a, pair<P, ld> b) {
	return a.second < b.second;
}

int main() {
	int n;
	cin >> n;
	vector<ld> x(n), y(n);
	rep(i, n) cin >> x[i] >> y[i];
	unionfind uni(n + 2);
	vector<pair<P, ld>> p;
	rep(i, n) {
		rep(j, i) {
			p.pb({ {i,j},sqrtl((x[i] - x[j]) * (x[i] - x[j]) + (y[i] - y[j]) * (y[i] - y[j])) });
		}
	}
	rep(i, n) p.pb({ {n,i},100 - y[i] });
	rep(i, n) p.pb({ { n + 1,i }, y[i] + 100 });
	p.pb({ {n,n + 1},200 });
	sort(all(p), comp);
	for (auto q : p) {
		int x = q.first.first;
		int y = q.first.second;
		uni.unite(x, y);
		if (uni.same(n, n + 1)) {
			cout << q.second / 2 << '\n';
			return 0;
		}
	}
}


#include <bits/stdc++.h>
using namespace std;
const long long mod1 = 1000000007;
using ll = long long;
using pq = priority_queue<ll>;
vector<int> dx = {0,1,0,-1};
vector<int> dy = {-1,0,1,0};

long long pow(long long x,long long n){
    long long ans = 1;
    while(n != 0){
        long long a = x;
        long long z = 1;
        while(z*2 <= n){
            a *=a;
            a=a%mod1;
            z*=2;
        }
        ans*=a;
        ans=ans%mod1;
        n-=z;
    }
    return ans;
}//累乗 x^n

template<typename T>
void input_vec(vector<T> &A,long long N){
    for(int i = 0; i < N; i++){
        cin >> A.at(i);
    }
    return;
}//入力を配列で受け取る

template<typename T>
void output_vec(vector<T> &A,long long N){
    for(int i = 0; i < N; i++){
        if(i != 0){
            cout << " ";
        }
        cout << A.at(i);
    }
    cout << endl;
    return;
}//配列を出力

template<typename T>
long long count_vec(vector<T> &A,T x){
    long long counter = 0;
    for(int i = 0; i < (int)A.size(); i++){
        if(A.at(i) == x){
            counter++;
        }
    }
    return counter;
}//配列内のxの個数をreturn

vector<char> change_vec(string s,int n){
    vector<char> ans(n);
    for(int i = 0; i < n; i++){
        ans.at(i) = s.at(i);
    }
    return ans;
}//文字列を配列に変換

bool can(vector<ll> &a,ll N,ll W){
    if(N == 0)return W == 0;

    return can(a,N-1,W-a.at(N-1)) || can(a,N-1,W);
}

int main(){
    ll N; cin >> N;
    ll ans = N*1.08;
    if(ans<206) cout << "Yay!" << endl;
    else if(ans== 206) cout << "so-so" << endl;
    else cout << ":(" << endl;
}

#include <bits/stdc++.h>
#define INF 1e9
#define INFLL 1ull<<60u
using namespace std;

#define REPR(i,n) for(int i=(n); i >= 0; --i)
#define FOR(i, m, n) for(int i = (m); i < (n); ++i)
#define REP(i, n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define ALL(a)  (a).begin(),(a).end()
#define endl "\n"

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

using vi = vector<int>;
using vvi = vector<vi>;
using vpii = vector<pair<int,int>>;

void solve() {
    int A,B,C; cin >> A >> B >> C;
    bool is_aoki_turn = C;
    while (true) {
        if (is_aoki_turn && B == 0) {
            cout << "Takahashi" << endl;
            return;
        } else if (!is_aoki_turn && A == 0) {
            cout << "Aoki" << endl;
            return;
        }
        if (is_aoki_turn) B--;
        if (!is_aoki_turn) A--;
        is_aoki_turn = !is_aoki_turn;
    }
}

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


#define _USE_MATH_DEFINES
#include <iostream>
#include <sstream>
#include <string>
#include <list>
#include <vector>
#include <queue>
#include <algorithm>
#include <climits>
#include <cstring>
#include <cmath>
#include <stack>
#include <iomanip>
#include <tuple>
#include <functional>
#include <cfloat>
#include <map>
#include <set>
#include <array>
#include <stdio.h>
#include <string.h>
#include <random>
#include <cassert>
using ll = long long;
using ull = unsigned long long;
using uint = unsigned int;
using namespace std;
#define int long long
#define CONTAINS_VEC(v,n) (find((v).begin(), (v).end(), (n)) != (v).end())
#define SORT(v) sort((v).begin(), (v).end())
#define RSORT(v) sort((v).rbegin(), (v).rend())
#define ARY_SORT(a, size) sort((a), (a)+(size))
#define REMOVE(v,a) (v.erase(remove((v).begin(), (v).end(), (a)), (v).end()))
#define REVERSE(v) (reverse((v).begin(), (v).end()))
#define ARY_REVERSE(v,a) (reverse((v), (v)+(a)))
#define REP(i, n) for (int (i)=0; (i) < (n); (i)++)
#define REPE(i, n) for (int (i)=0; (i) <= (n); (i)++)
#define CONTAINS_MAP(m, a) ((m).find((a)) != m.end())
#define CONTAINS_SET(m, a) ((m).find((a)) != m.end())
void YesNo(bool b) { cout << (b ? "Yes" : "No") << endl; exit(0); }
void Yes() { cout << "Yes" << endl; exit(0); }
void No() { cout << "No" << endl; exit(0); }

//---------- 1000000007 ----------
const int MOD = 998244353;
struct mint {
	ll x; // typedef long long ll;
	mint(ll x = 0) :x((x% MOD + MOD) % MOD) {}
	mint operator-() const { return mint(-x); }
	mint& operator+=(const mint a) {
		if ((x += a.x) >= MOD) x -= MOD;
		return *this;
	}
	mint& operator-=(const mint a) {
		if ((x += MOD - a.x) >= MOD) x -= MOD;
		return *this;
	}
	mint& operator*=(const mint a) { (x *= a.x) %= MOD; return *this; }
	mint operator+(const mint a) const { return mint(*this) += a; }
	mint operator-(const mint a) const { return mint(*this) -= a; }
	mint operator*(const mint a) const { return mint(*this) *= a; }
	mint pow(ll t) const {
		if (!t) return 1;
		mint a = pow(t >> 1);
		a *= a;
		if (t & 1) a *= *this;
		return a;
	}

	// for prime mod
	mint inv() const { return pow(MOD - 2); }
	mint& operator/=(const mint a) { return *this *= a.inv(); }
	mint operator/(const mint a) const { return mint(*this) /= a; }
};
istream& operator>>(istream& is, mint& a) { return is >> a.x; }
ostream& operator<<(ostream& os, const mint& a) { return os << a.x; }

mint m_comb(mint n, mint r)
{
	int i;
	mint p = 1;
	for (i = 1; i <= r.x; i++)
	{
		p *= n - i + 1;
		p /= i;
	}
	return p;
}
mint m_comb_with_rep(mint n, mint r)
{
	return m_comb(n + r - 1, r);
}
mint m_perm(mint n, mint r)
{
	mint a = 1;
	for (int i = n.x; i > n.x - r.x; i--)
	{
		a *= i;
	}
	return a;
}

int N;
int A[200001];

signed main()
{
	cin >> N;
	REP(i, N) cin >> A[i];

	ARY_SORT(A, N);

	mint ans = 0;
	mint sum = 0;
	mint b = 1;

	for (int i = 1; i < N; i++)
	{
		mint a = A[0] * A[i];
		sum += a * b;
		b *= 2;
	}

	ans = sum;

	for (int i = 0; i < N - 1; i++)
	{
		sum -= (A[i] * A[i + 1]);
		sum /= 2;
		sum /= A[i];
		sum *= A[i + 1];
		ans += sum;
	}

	for (int i = 0; i < N; i++)
	{
		mint a = A[i] * A[i];
		ans += a;
	}

	cout << ans << endl;
}

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

/*int main(){
    ll a,b,c,ans1,ans2;
    scanf("%lld ^ %lld ^ %lld",&a,&b,&c);
    ans1=modpow(a%MOD,b,MOD);
    ans1=modpow(ans1,c,MOD);
    ans2=modpow(a%MOD,modpow(b%(MOD-1),c,MOD-1),MOD);
    if(a%MOD==0)ans2=0;
    out(ans1,ans2);
}*/

int main(){
    ll ans=0;
    LL(a,b,c);
    ll m=10;
    if(a%10==0)ans=0;
    if(a%10==1)ans=1;
    if(a%10==2)ans=modpow(a%m,modpow(b%4,c,4)+4,10);
    if(a%10==3)ans=modpow(a%m,modpow(b%4,c,4)+4,m);
    if(a%10==4)ans=modpow(a%m,modpow(b%2,c,2)+2,m);
    if(a%10==5)ans=5;
    if(a%10==6)ans=6;
    if(a%10==7)ans=modpow(a%m,modpow(b%4,c,4)+4,m);
    if(a%10==8)ans=modpow(a%m,modpow(b%4,c,4)+4,m);
    if(a%10==9)ans=modpow(a%m,modpow(b%2,c,2)+2,m);
    out(ans);
}


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

using ll = long long int;

const int MAX = (int)(1e5 + 5);
const ll INF = (ll)(1e10 + 5);

const int MAX_N = (int)(2e2 + 5);

int n;
int a[MAX_N];

int dp[MAX_N][200];

vector<vector<int>> candidates;

int get_valid_modulo() {
  if (dp[n][0] >= 3) return 0;

  for (int i = 1; i < 200; ++i) {
    if (dp[n][i] >= 2) return i;
  }

  return -1;
}

bool dfs(int cur, int modulo, vector<int> &hold) {
  if (cur == 0 && modulo == 0) {
    if (hold.empty()) return false;

    vector<int> tmp(hold);
    candidates.push_back(tmp);

    return candidates.size() >= 2;
  }

  if (cur == 0) return false;

  // do not use
  if (dp[cur - 1][modulo] != 0) {
    bool done = dfs(cur - 1, modulo, hold);
    if (done) return true;
  }

  // use
  hold.push_back(cur);
  int prev_modulo = (modulo - a[cur] + 200) % 200;
  if (dp[cur - 1][prev_modulo] != 0) {
    bool done = dfs(cur - 1, prev_modulo, hold);
    if (done) return true;
  }
  hold.pop_back();

  return false;
}

void retrieve(int modulo) {
  vector<int> hold;
  dfs(n, modulo, hold);
}

int main(void) {
  // Here your code !
  scanf("%d", &n);

  for (int i = 1; i <= n; ++i) {
    scanf("%d", &a[i]);
    a[i] %= 200;
  }

  // initialize
  for (int i = 0; i <= n; ++i) {
    for (int j = 0; j < 200; ++j) {
      dp[i][j] = 0;
    }
  }
  dp[0][0] = 1;

  for (int i = 1; i <= n; ++i) {
    for (int j = 0; j < 200; ++j) {
      if (dp[i - 1][j] == 0) continue;

      int next_modulo = (j + a[i]) % 200;
      dp[i][next_modulo] += dp[i - 1][j];  // use a[i]
      dp[i][j] += dp[i - 1][j];            // do not use a[i]

      dp[i][next_modulo] = min(dp[i][next_modulo], 3);
      dp[i][j] = min(dp[i][j], 3);
    }
  }

  int modulo = get_valid_modulo();

  if (modulo < 0) {
    printf("No\n");
    return 0;
  }

  printf("Yes\n");

  retrieve(modulo);

  printf("%d ", candidates[0].size());
  sort(candidates[0].begin(), candidates[0].end());
  for (auto e : candidates[0]) {
    printf("%d ", e);
  }
  printf("\n");

  printf("%d ", candidates[1].size());
  sort(candidates[1].begin(), candidates[1].end());
  for (auto e : candidates[1]) {
    printf("%d ", e);
  }
  printf("\n");

  return 0;
}

#include <bits/stdc++.h>

using namespace std;

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

#define sz(a) int((a).size())
#define pb push_back
#define eb emplace_back
#define fi first
#define se second
#define all(c) (c).begin(),(c).end()
#define rall(c) (c).rbegin(),(c).rend()
#define ini(a, i) memset(a, i, sizeof(a))
#define inin(a, n, i) memset(a, i, sizeof(a[0])*(n))
#define contains(c, i) ((c).find(i) != (c).end())
#define present(i, c) (find(all(c), i) != (c).end())

#define trav(x, c) for(auto& x : c)
#define rep(i, n) for(int i = 0; i < n; i++)
#define repa(i, b, e) for(int i = (b)-((b)>(e)); i != (e)-((b)>(e)); i += 1-2*((b)>(e)))

template<class T> bool chkmax(T &x, T y) { return x < y ? x = y, true : false; }
template<class T> bool chkmin(T &x, T y) { return x > y ? x = y, true : false; }
template<class A, class B> A cvt(B x) { stringstream s; s << x; A r; s >> r; return r; }

void read() {}
void print() {}
template<class T, class... Args> void read(T& a, Args&... args) { cin >> a; read(args...); }
template<class T, class... Args> void print(T a, Args... args) { cout << a << ' '; print(args...); }
template<class... Args> void println(Args... args) { print(args...); cout << '\n'; }

#define debug(args...) { string s_(#args); replace(all(s_), ',', ' '); stringstream ss_(s_); istream_iterator<string> it_(ss_); cerr_(it_, args); }
void cerr_(istream_iterator<string> it) { (void) it; }
template<class T, class... Args> void cerr_(istream_iterator<string> it, T a, Args... args) { cerr << *it << " = " << a << endl; cerr_(++it, args...); }

template<class T, class S>  ostream& operator<<(ostream& os, const pair<T, S>& p) { os << "(" << p.first << ", " << p.second << ")"; return os; }
template<class T> ostream& operator<<(ostream &os, const vector<T> &v) { os << '{'; string sep; for (const auto &x : v) os << sep << x, sep = ", "; return os << '}'; }
template<class T> ostream& operator<<(ostream &os, const set<T> &s) { os << '{'; string sep; for (const auto &x : s) os << sep << x, sep = ", "; return os << '}'; }
template<class T, class S> ostream& operator<<(ostream &os, const map<T, S> &m) { os << '{'; string sep; for (const auto &x : m) os << sep << x, sep = ", "; return os << '}'; }
template<class T, size_t size> ostream& operator<<(ostream &os, const array<T, size> &arr) { os << '{'; string sep; for (const auto &x : arr) os << sep << x, sep = ", "; return os << '}'; }

const int INF = 0x3F3F3F3F;
const int MAXN = (int) 1e6;
const int MOD = (int) 1e9+7;

//=========================

void run_test() {
    int n; read(n);
    vi a(n); rep(i, n) read(a[i]);

    int mx = *max_element(all(a));

    int nmx = 0, ans = 0;
    for(int x = 2; x <= mx; x++) {
        int c = 0;
        rep(i, n) if(a[i] % x == 0) c++;
        if(c > nmx) nmx = c, ans = x;
    }

    println(ans);
}

//=========================

int main() {
	ios::sync_with_stdio(false); cin.tie(nullptr);
	//int t_ = 1, t__; cin >> t__; while(t_ <= t__) { cout << "Case #" << t_++ << ": "; run_test(); }
	// int t_; cin >> t_; while(t_--) run_test();
	run_test();
	return 0;
}


//CODE YOUR WAY ;) -->>
//template owner shivyyy_21

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

#define ll long long int
const ll MOD=1e9+7;
#define Loopi for(ll i=0;i<n;i++)
#define Loopj for(ll j=0;j<m;j++)
#define LoopLR(l,r) for(ll i=l;i<=r;i++)
#define pb push_back
#define Umap unordered_map<ll,ll> UM
#define UmapC unordered_map<char,ll> CM
#define Omap map<ll,ll> OM
#define stringtoll(s) stoll(s,nullptr,10)   // convert string to ll
#define read(a,n) Loopi{  cin>> a[i];  }
#define print(a,n) Loopi{  cout<<a[i]<<" ";  }
#define findsum(a,n) Loopi{  sum+=a[i];  }

bool ispowerof2(ll n)            // ispower of two
{
    if(n==0)
    return false;
    return (ceil(log2(n))==floor(log2(n)));
}

ll prime[1000002]={0};
void sieve()                    // find primes
{
    prime[0]=1;
    prime[1]=1;
    for(ll i=2;i<=1000000;i++)
    {
        if(prime[i]==0)
        {
        for(ll j=i*i;j<=1000000;j+=i)
        {
          prime[j]=1;
        }
        }
    }
}

void print_Divisor(ll n)         //print divisors
{ for(int i=1;i<=sqrt(n);i++)
    {  if (n%i==0)
        {
            if (n/i==i)
               cout<<i<<endl;
            else
               cout<<i<<" "<<n/i<<" "<<endl;
        }
    }
}

ll lcm(ll a,ll b)                //find lcm
{
    return (a*b)/__gcd(a,b);
}
long long int countConsecutive(long long int N)
{
    // constraint on values of L gives us the
    // time Complexity as O(N^0.5)
    long long int count = 0;
    for (long long int L = 1; L * (L + 1) < 2 * N; L++)
    {
        double a = (1.0 * N-(L * (L + 1)) / 2) / (L + 1);
        if (a-(long long int)a == 0.0)
            count++;
    }
    return count;
}
void Doit()                      //Karo_Ya_Maro
{
ll n;
cin>>n;
cout<<(countConsecutive(n)+1)*2;

}

int main()
{

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

// ll t;
// cin>>t;

// while(t--)
// {
    Doit();
//}
}

#include<bits/stdc++.h>
using namespace std;
using ll = long long;
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=int(a);i<int(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define ALL(x) (x).begin(),(x).end()
template<class T>bool umax(T &a, const T &b) {if(a<b){a=b;return 1;}return 0;}
template<class T>bool umin(T &a, const T &b) {if(b<a){a=b;return 1;}return 0;}
#ifdef LOCAL
void _debug_out() { cerr << endl; }
template <typename Head, typename... Tail>
void _debug_out(Head H, Tail... T) { cerr << " " << to_string(H); _debug_out(T...); }
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", _debug_out(__VA_ARGS__)
#define eprintf(...) fprintf(stderr, __VA_ARGS__)
#else
#define debug(...) 42
#define eprintf(...) 42
#endif

double dp[101][101][101];

double rec(int a, int b, int c) {
  double sum = a + b + c;
  if(a==100 || b == 100||c ==100) return 0;

  if(dp[a][b][c] != -1) return dp[a][b][c];
  double ret = 0;
  //a
  ret += (a / sum) * (1 + rec(a+1, b, c));
  //b
  ret += (b / sum) * (1 + rec(a, b+1, c));
  //c
  ret += (c / sum) * (1 + rec(a, b, c+1));

  return dp[a][b][c] = ret;
}

int main() {
  int a,b,c; cin >> a >> b >> c;
  rep(i,101) rep(j,101) rep(k,101) dp[i][j][k] = -1;
  printf("%10lf\n", rec(a,b,c));
}


#include <iostream>
#include <vector>
#include <iomanip>
#include <string>
#include <algorithm>
#include <cmath>
#include <map>
#include <functional>

using ll = long long;
using vll = std::vector<ll>;
using namespace std;
#define REP(i, x, n) for(int i = x; i < (n); i++)
#define rep(i, n) REP(i, 0, n)

int main() {
  int a,b; cin>>a>>b;
  int x=(a+b)/2; int y=(a-b)/2;
  cout<<x<<" "<<y<<endl;
  return 0;
}

#include <cstdio>
#include <iostream>
#include <algorithm>
#include <algorithm>
#include <vector>
#include <queue>
#include <cctype>
#include <cmath>
#include <cstring>
#include <stack>
#include <tuple>
#include <numeric>
#include <iomanip>
#include <assert.h>
#include <bits/stdc++.h>
#define forn(i, n) for(int i = 0; i < int(n); ++i)

typedef long long ll;
typedef long double ld;
#define FASTIO ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define PRECISION cout << fixed << setprecision(20);

using namespace std;

const int mod = 998244353;

struct Mint {
    ll v; explicit operator ll() const { return v; }
    Mint() { v = 0; }
    Mint(ll _v) {
        v = (-mod < _v && _v < mod) ? _v : _v % mod;
        if (v < 0) v += mod;
    }
    friend bool operator==(const Mint& a, const Mint& b) { return a.v == b.v; }
    friend bool operator!=(const Mint& a, const Mint& b) { return !(a == b); }
    friend bool operator<(const Mint& a, const Mint& b) { return a.v < b.v; }

    Mint& operator+=(const Mint& m) { if ((v += m.v) >= mod) v -= mod; return *this; }
    Mint& operator-=(const Mint& m) { if ((v -= m.v) < 0) v += mod; return *this; }
    Mint& operator*=(const Mint& m) { v = v*m.v%mod; return *this; }
    Mint& operator/=(const Mint& m) { return (*this) *= inv(m); }

    friend Mint pow(Mint a, ll p) {
        Mint ans = 1; assert(p >= 0);
        for (; p; p /= 2, a *= a) if (p & 1) ans *= a;
        return ans;
    }

    friend Mint inv(const Mint& a) { assert(a.v != 0); return pow(a, mod-2); }

    Mint operator-() const { return Mint(-v); }
    Mint& operator++() { return *this += 1; }
    Mint& operator--() { return *this -= 1; }
    Mint operator++(int) { Mint temp; temp.v = v++; return temp; }
    Mint operator--(int) { Mint temp; temp.v = v--; return temp; }

    friend Mint operator+(Mint a, const Mint& b) { return a += b; }
    friend Mint operator-(Mint a, const Mint& b) { return a -= b; }
    friend Mint operator*(Mint a, const Mint& b) { return a *= b; }
    friend Mint operator/(Mint a, const Mint& b) { return a /= b; }

    friend ostream& operator<<(ostream& os, const Mint& m) {
        os << m.v; return os;
    }

    friend istream& operator>>(istream& is, Mint& m) {
        ll x; is >> x;
        m.v = x;
        return is;
    }
};

const int N = 200000 + 100;

Mint fact[N];

int ff[N];

void pre() {
    fact[0] = Mint(1);
    for (int i = 1; i < N; i++) fact[i] = Mint(i) * fact[i - 1];

    for (int i = 2; i < N; i++) {
        if (!ff[i]) {
            for (int j = i; j < N; j += i) {
                if (!ff[j]) ff[j] = i;
            }
        }
    }
}

Mint ncr(int n, int r) {
    if (n < r || n < 0 || r < 0) return 0;
    return fact[n] / (fact[n - r] * fact[r]);
}

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

    Mint ans = 0;
    for (ll i = 1; i <= m; i++) {
        ll x = i;
        Mint curr = 1;
        while (x > 1) {
            int cnt = 0;
            int f = ff[x];
            while (x % f == 0) {
                x /= f;
                cnt++;
            }
            curr *= ncr(cnt + n - 1, n - 1);
        }
        ans += curr;
    }

    cout << ans << "\n";
}

int main() {
    FASTIO;
    PRECISION;

    pre();

    int t = 1;

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


#define _USE_MATH_DEFINES
#include <bits/stdc++.h>

using namespace std;
using ll = long long;

int n,s,d;

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

    cin >> n >> s >> d;
    bool ans = false;
    for(int i=0;i<n;i++){
        int x,y;
        cin >> x >> y;
        if(x<s&&y>d) ans = true;
    }
    if(ans) cout << "Yes";
    else cout << "No";
    return 0;
}

#include <bits/stdc++.h>

#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define N 110

using namespace std;
using ll = long long;
using P = pair<int,int>;

int main(){
  int n,s,d,flag=0;
  int x,y;
  cin >> n >> s  >> d;
  REP(i,n)
  {
    cin >> x >> y;
    if(x<s && y>d)
    {
      cout << "Yes" << endl;
      return 0;
    }
  }
      cout << "No" << endl;
      return 0;
}


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

using namespace std;
using namespace std::chrono;

// #pragma GCC target ("avx2")
// #pragma GCC optimization ("O3")
// #pragma GCC optimization ("unroll-loops")
// #pragma optimization_level 3
// #pragma GCC optimize("Ofast,no-stack-protector,unroll-loops,fast-math,O3")
// #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")

#define pb push_back
#define galen_colin {ios_base::sync_with_stdio(false);}
#define orz {cin.tie(NULL); cout.tie(NULL);}
#define fix(prec) {cout << setprecision(prec) << fixed;}
#define mp make_pair
#define f first
#define s second
#define all(v) v.begin(), v.end()

typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<pii> vpi;
typedef vector<pll> vpl;
typedef vector<vi> vvi;
typedef vector<vl> vvl;

template<typename A> ostream& operator<<(ostream &cout, vector<A> const &v);
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 << "\n";
}
template<typename A, typename B> istream& operator>>(istream& cin, pair<A, B> &p) {
	cin >> p.first;
	return cin >> p.second;
}
template<typename A> istream& operator>>(istream& cin, vector<A> &v) {
    for(auto &x:v)cin>>x;
    return cin;
}

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

void usaco(string filename) {
  // #pragma message("be careful, freopen may be wrong")
	freopen((filename + ".in").c_str(), "r", stdin);
	freopen((filename + ".out").c_str(), "w", stdout);
}

const ld pi = 3.14159265358979323846;
const ll mod = 1000000007;
// const ll mod = 998244353;
// ll mod;
const ll INF = 1e9+7;

ll n, m, k, q, l, r, x, y, z;

const ll sz = 1e6 + 1;
ll a[sz] = {0};
ll b[sz];
ll c[sz];
string s, t;
ll ans = 0;

void solve(int tc = 0) {

	cin>>n>>x;
	cin>>s;
	for(int i=0;i<n;i++){
		if(s[i] == 'x')x = max(x-1, 0);
		else x++;
	}
    cout<<x<<"\n";
}

int main() {
	#ifdef HACKX
		auto begin = std::chrono::high_resolution_clock::now();
	#endif

	galen_colin orz

	// usaco("cowland");

	int tc = 1;
	// cin >> tc;
	for (int t = 0; t < tc; t++) solve(t);

	#ifdef HACKX
		auto end = std::chrono::high_resolution_clock::now();
		cout << setprecision(4) << fixed;
		// cout << "Execution time: " << std::chrono::duration_cast<std::chrono::duration<double>>(end - begin).count() << " seconds" << endl;
	#endif
}

#pragma GCC optimize ("Ofast")
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
#define FOR(i, a, b) for (int i=(a); i<(b); i++)
#define FORD(i, a, b) for (int i=(a); i>(b); i--)
#define PPC(x) __builtin_popcount(x)
#define MSB(x) (63 - __builtin_clzll(x))
#define SZ(x) ((int)(x).size())
#define HASK(S, x) (S.find(x) != S.end())
#define pb push_back
#define ALL(x) (x).begin(), (x).end()
#define ithBit(m, i) ((m) >> (i) & 1)
#define ft first
#define sd second
#define kw(a) ((a) * (a))
#ifdef DEBUG
#include "debug.h"
#else
#define dbg(...) 0
#endif
using namespace std;

template <typename T1, typename T2> inline void remin(T1& a, T2 b) { a = min(a, (T1)b);	}

const int maxN = 1 << 19;

char T[maxN], S[maxN];
stack <int> pos;

void solve()
{
	int n;
	scanf ("%d", &n);
	scanf ("%s%s", S, T);
	FORD(i, n-1, -1)
		if (S[i] == '1')
			pos.push(i);

	long long res = 0;

	FOR(i, 0, n)
	{
		if (!pos.empty() and pos.top() == i)
			pos.pop();

		if (S[i] != T[i])
		{
			if (pos.empty())
			{
				res = -1ll;
				break;
			}

			int j = pos.top();
			pos.pop();
			S[j] = '0';
			res += j - i;
		}
	}

	printf("%lld\n", res);
}

int main()
{
	int t = 1;
	//scanf ("%d", &t);
	FOR(tid, 1, t+1)
	{
		//printf("Case #%d: ", tid);
		solve();
	}
	return 0;
}


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

//to insert pair use eb or { }
#define int int64_t
typedef pair<int,int> pii;
const int X=1e9+7;
const int inf=1e18;

#define lld        int
#define pqu        priority_queue
#define eb         emplace_back
#define mp         make_pair
#define fi         first
#define se         second
#define pb         push_back
#define endl       "\n"
#define v          vector
#define Y          998244353
#define EPS        1e-6
#define N          500005
#define pi         3.1415926535897932384626

#define ones(x)     __builtin_popcount(x)
#define zero(a)    memset(a,0,sizeof(a))
#define minus(a)   memset(a,-1,sizeof(a))
#define all(a)     (a).begin(),(a).end()

#define rec(i,s,e)   for(int i=s ; (s<=e)?(i<e):(i>=e) ; (s<=e)?(i++):(i--) )
// rec(i,0,n)
// rec(i,n-1,0)
//for flush dont use endl (\n)

void google(int i)
{  cout<<"Case #"<<i<<": "; }

//use sort function even to sort a string of caharacters or numbers ...
//  sort(s.begin(),s.end());

//floating precision functions
//floor() for low
//ceil() for above
// trunc() removes decimal digits
//round() used to round off
void prec(double n,int d)
{
 cout<<fixed<<setprecision(d)<<n<<endl;
}

//prime[i]==1 if it is prime
int prime[1000001];
void sieve(int n)
{ rec(i,0,n+1)
    prime[i]=1;
   for(int i=2;i*i<=n;i++)
     { if(prime[i]!=1)
          continue;
         for(int j=i*i;j<=n;j=j+i)
          if(prime[j]==1)
           prime[j]=i;
      }
}

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

//fermat a^(m-2)%mod
int bin(int a,int n,int m)
{  int res=1;
 while(n)
  { if(n%2)
      { res=(res*a)%m;
         n--;
      }
     a=(a*a)%m;
     n/=2;
  }
  return res;
}

void dijktra(v<pii> g[], int n)
{
  pqu<pii, v<pii>, greater<pii>> pq;
  v<int> dist(n, inf);
  dist[0] = 0;
  int parent[n];
  minus(parent);
  pq.push({0, 0});

  while (!pq.empty())
  {
    pii x= pq.top();
    pq.pop();

    for(int i=0;i<(int)g[x.se].size();i++)
    {
      pii k = g[x.se][i];
      if (dist[x.se] + k.fi < dist[k.se])
      {
        dist[k.se] = dist[x.se] + k.fi;
        parent[k.se] = x.se;
        pq.push({dist[k.se], k.se});
      }
    }
  }
}

void bfs(int s,v<int> g[],int n)
{
   bool vis[n];
   rec(i,0,n)
    vis[i]=false;

   vis[s]=true;
   deque<int> q;
   q.pb(s);

   while(!q.empty())
   {
      s=q.front();
     q.pop_front();

     for(int i=0;i<g[s].size();i++)
      {
        if(!vis[g[s][i]])
         { vis[g[s][i]]=true;
            q.pb(g[s][i]);
         }
      }
   }
}

void dfs(int u,v<int> g[],bool *vis)
{

   vis[u]=true;
   for(int i=0;i<g[u].size();i++)
     if(!vis[g[u][i]])
          dfs(g[u][i],g,vis);

}
void create_w(v<pii> *g, int n, int m)
{
  rec(i,0, m)
  {
    int u,v,w;
    cin>>u>>v>>w;
    g[u-1].pb({w, v-1});
    g[v-1].pb({w, u-1});
  }
}
void create(v<int> *g,int n,int m)
{
   rec(i,0,m)
    {
       int u,v;
       cin>>u>>v;
       g[u-1].pb(v-1);
       g[v-1].pb(u-1);
    }
}

//always use int
void contest(int t)
{
        int s,p;
    cin>>s>>p;

    rec(i,1,sqrt(p)+1)
    {
        if(p%i!=0)
         continue;
        if((i + (p/i)) == s)
         {
             cout<<"Yes"<<endl;
             return;
         }

    }

    cout<<"No"<<endl;

}
//remember rec

int32_t main()
{
   ios_base::sync_with_stdio(false);
   cin.tie(0); cout.tie(0);
     #ifdef PUNEET_GOEL
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    #endif
    //sieve(1e6);
    int T=1;
    //cin>>T;
    rec(t,0,T)
    {
      contest(t);
    }
  return 0;
}

#include<bits/stdc++.h>
using namespace std;
int main(){
    long long s,p;
    cin>>s>>p;
    int ans=0;
    for(int i=1;i<=sqrt(p);i++)if(p%i==0 && i+p/i==s)ans=1;
    cout<<(ans ? "Yes" : "No")<<endl;
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define INF 0x3f3f3f3f
#define gcd __gcd
#define FOR(i, a, b) for (int i = a; i <= (b); i++)
#define ROF(i, a, b) for (int i = a; i >= (b); i--)
#define pb(x) push_back(x)
#define ALL(x) x.begin(), x.end()
#define RALL(x) x.rbegin(), x.rend()
#define sz(x) ((int)x.size())
#define fir first
#define sec second
typedef long long ll;
typedef long double ld;
const ll mod =  1e9 + 7;
const double PI = acos(-1.0);
const double eps = 1e-10;
ll powmod(ll a,ll b) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
const int maxn = 100005;
ll a[maxn];
int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n;
    cin >> n;
    vector<ll> sum(n + 1);
    FOR(i, 1, n) {
        cin >> a[i];
    }
    ll ans = 1e18;
    sort(a + 1, a + 1 + n);
    FOR(i, 1, n) {
        sum[i] = sum[i - 1] + a[i];
    }
    FOR(i, 1, n - 1) {
        ll x;
        if(2 * i - n > 0) {
            x = a[i];
        }
        else x = a[i + 1];

        ans = min(ans, (2 * i - n) * x + 2 * (sum[n] - sum[i]));
    }
    ans = min(ans, n * a[n]);
    ans = min(ans, 2 * sum[n]);
    cout << setprecision(20) << (ld)1.0 * ans / n / 2 << endl;
	return 0;
}

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

void prepare(){

}
void solve(){
	int n;cin>>n;
	int a[n];
	for(int i=0;i<n;i++)cin>>a[i];
	sort(a,a+n);
    int y=a[n/2],ans=0;
    for(int i=0;i<n;i++)ans+=(y+2*a[i]-min(2*y,2*a[i]));
    cout<<setprecision(12)<<(double)ans/(2*n);
	}

signed main(){
	#ifndef ONLINE_JUDGE
    freopen("input.txt","r",stdin);
    freopen("output.txt","w",stdout);
    #endif
    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    //prepare();
    //cin>>tt;
    //while(tt--)
    solve();
}


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

int main()
{
    double a;
    cin>>a;
    if((int)a%100==0) cout<<100<<endl;
    if((int)a%100!=0) cout<<(ceil((double)a/100)*100)-a<<endl;
}

#include<iostream>
#include<algorithm>
#include<math.h>
#include<cstring>
#include<queue>
#include<vector>
#include<map>
#include<set>
using namespace std;
int main() {

	long long int n;
	cin >> n;
	long long int x[40];
	long long int y[40];
	long long int m3= 0, m5 = 0;

	x[0] = 1; y[0] = 1;
	long long int i;
	for (i = 1; i < 40; i++) {

		x[i] = x[i - 1] * 3;
		if (x[i] > n) {
			m3 = i;
			break;
		}

	}
	for (i = 1; i < 40; i++) {
		y[i] = y[i - 1] * 5;
		if (y[i] > n) {
			m5 = i;
			break;
		}
	}
	int j;
	for(i = 1;i < m3;i++){
		for (j = 1; j < m5; j++) {
			if (x[i] + y[j] == n) {
				cout << i << ' ' << j << endl;
				return 0;
			}
		}

	}
	cout << -1 << endl;
	return 0;

	return 0;

}


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

int n,m;
int a[maxn];
int b[maxn];
int dp[maxn][maxn];

int main() {
	scanf("%d%d",&n,&m);
	for( int i = 1 ; i <= n ; i++ )
		scanf("%d",&a[i]);
	for( int j = 1 ; j <= m ; j++ )
		scanf("%d",&b[j]);
	for( int i = 0 ; i <= n ; i++ )
		for( int j = 0 ; j <= m ; j++ )
			if(i+j) {
				dp[i][j] = INT_MAX;
				if(i)
					dp[i][j] = min(dp[i][j],dp[i-1][j]+1);
				if(j)
					dp[i][j] = min(dp[i][j],dp[i][j-1]+1);
				if(i && j)
					dp[i][j] = min(dp[i][j],dp[i-1][j-1]+(a[i]!=b[j]));
			}
	printf("%d\n",dp[n][m]);
	return 0;
}

 #include<bits/stdc++.h>
using namespace std;
namespace Sakurajima_Mai{
	#define ms(a) memset(a,0,sizeof(a))
	#define repi(i,a,b) for(int i=a,bbb=b;i<=bbb;++i)//attention reg int or reg ll ?
	#define repd(i,a,b) for(int i=a,bbb=b;i>=bbb;--i)
	#define reps(s) for(int i=head[s],v=e[i].to;i;i=e[i].nxt,v=e[i].to)
	#define ce(i,r) i==r?'\n':' '
	#define pb push_back
	#define all(x) x.begin(),x.end()
	#define gmn(a,b) a=min(a,b)
	#define gmx(a,b) a=max(a,b)
	#define fi first
	#define se second
	typedef long long ll;
	typedef unsigned long long ull;
	typedef double db;
	const int infi=1e9;
	const ll infl=4e18;
	inline ll ceil_div(ll a,ll b){ return (a+b-1)/b; }
	//std::mt19937 rnd(time(0));//std::mt19937_64 rnd(time(0));
}
using namespace Sakurajima_Mai;
namespace Fast_Read{
	inline int qi(){
	    int f=0,fu=1; char c=getchar();
	    while(c<'0'||c>'9'){ if(c=='-')fu=-1; c=getchar(); }
	    while(c>='0'&&c<='9'){ f=(f<<3)+(f<<1)+c-48; c=getchar(); }
	    return f*fu;
	}
	inline ll ql(){
		ll f=0;int fu=1; char c=getchar();
	    while(c<'0'||c>'9'){ if(c=='-')fu=-1; c=getchar(); }
	    while(c>='0'&&c<='9'){ f=(f<<3)+(f<<1)+c-48; c=getchar(); }
	    return f*fu;
	}
	inline db qd(){
	    char c=getchar();int flag=1;double ans=0;
	    while((!(c>='0'&&c<='9'))&&c!='-') c=getchar();
	    if(c=='-') flag=-1,c=getchar();
	    while(c>='0'&&c<='9') ans=ans*10+(c^48),c=getchar();
	    if(c=='.'){c=getchar();for(int Bit=10;c>='0'&&c<='9';Bit=(Bit<<3)+(Bit<<1)) ans+=(double)(c^48)*1.0/Bit,c=getchar();}
	    return ans*flag;
	}
}
namespace Read{
	#define si(a) scanf("%d",&a)
	#define sl(a) scanf("%lld",&a)
	#define sd(a) scanf("%lf",&a)
	#define ss(a) scanf("%s",a)
	#define rai(x,a,b) repi(i,a,b) x[i]=qi()
	#define ral(x,a,b) repi(i,a,b) x[i]=ql()
}
namespace Out{
	#define pi(x) printf("%d",x)
	#define pl(x) printf("%lld",x)
	#define ps(x) printf("%s",x)
	#define pc(x) printf("%c",x)
	#define pe() puts("")
}
namespace DeBug{
	#define MARK false
	#define DB if(MARK)
	#define pr(x) cout<<#x<<": "<<x<<endl
	#define pra(x,a,b) cout<<#x<<": "<<endl; \
			repi(i,a,b) cout<<x[i]<<" ";	 \
			puts("");
	#define FR(a) freopen(a,"r",stdin)
	#define FO(a) freopen(a,"w",stdout)
}
using namespace Fast_Read;
using namespace Read;
using namespace Out;
using namespace DeBug;
const int MAX_N=1e5+5;
const int MAX_E=1e5+5;
typedef pair<int,int> P;
struct Edge{int to,nxt;int w;}e[MAX_E<<1];
int head[MAX_N],tote;
void add_edge(int u,int v,int w){e[++tote].to=v,e[tote].w=w,e[tote].nxt=head[u];head[u]=tote;}
int V;//点总数，下标1开始
int dis[MAX_N];
void dijkstra(int s)
{
	repi(i,1,V) dis[i]=infi;
	priority_queue<P,vector<P>,greater<P> > q;
	dis[s]=0,q.push(P(0,s));
	while(!q.empty())
	{
		P now=q.top(); q.pop();
		int u=now.se;
		if(dis[u]<now.fi)	continue;
		reps(u)if(dis[v]>dis[u]+e[i].w) dis[v]=dis[u]+e[i].w,q.push(P(dis[v],v));
	}
}

int k,c[17],g[17][17];
int dp[(1<<17)-1+5][17];
void init(int n)
{
	repi(i,0,n) head[i]=0;
	V=n,tote=0;
}
int main()
{
	int n=qi(),m=qi(); init(n);
	repi(i,1,m){
		int u=qi(),v=qi();
		add_edge(u,v,1),add_edge(v,u,1);
	}
	k=qi(); rai(c,0,k-1);
	repi(i,0,k-1){
		dijkstra(c[i]);
		repi(j,0,k-1) g[i][j]=dis[c[j]];
	}
	repi(i,0,(1<<k)-1)repi(j,0,k-1) dp[i][j]=infi;
	repi(i,0,k-1) dp[1<<i][i]=1;
	repi(i,0,(1<<k)-1)repi(j,0,k-1)if(dp[i][j]!=infi){
		repi(nxt,0,k-1) gmn(dp[i|(1<<nxt)][nxt],dp[i][j]+g[j][nxt]);
	}
	int ans=infi;
	repi(i,0,k-1) gmn(ans,dp[(1<<k)-1][i]);
	if(ans==infi) ans=-1;
	pi(ans),pe();
	return 0;
}


#include <bits/stdc++.h>
using namespace std;
int main(){
  long long n, m = 0, c = -1, x;
  double e = 0.0;
  cin >> n;
  for(int i = 0; i < n; i++){
    cin >> x;
    x = abs(x);
    m += x;
    c = max(c, x);
    e += (double)x * x;
  }
  printf("%lld\n%.15f\n%lld\n", m, sqrt(e), c);
}

#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rep1(i, n) for (int i = 1; i <= (n); ++i)
#define rrep(i, n) for (int i = (n)-1; i >= 0; --i)
#define srep(i, s, t) for (int i = s; i < t; ++i)
#define rng(a) a.begin(), a.end()
#define rrng(a) a.rbegin(), a.rend()
#define isin(x, l, r) ((l) <= (x) && (x) < (r))
#define pb push_back
#define eb emplace_back
#define sz(x) (int)(x).size()
#define pcnt __builtin_popcountll
#define uni(x) x.erase(unique(rng(x)), x.end())
#define snuke srand((unsigned)clock() + (unsigned)time(NULL));
#define show(x) cerr << #x << " = " << x << endl;
#define PQ(T) priority_queue<T, v(T), greater<T>>
#define bn(x) ((1 << x) - 1)
#define dup(x, y) (((x) + (y)-1) / (y))
#define newline puts("")
#define v(T) vector<T>
#define vv(T) v(v(T))
using namespace std;
typedef long long int ll;
typedef unsigned uint;
typedef unsigned long long ull;
typedef pair<int, int> P;
typedef tuple<int, int, int> T;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
typedef vector<T> vt;
int getInt()
{
    int x;
    scanf("%d", &x);
    return x;
}
template <typename T>
istream &operator>>(istream &i, v(T) & v)
{
    rep(j, sz(v)) i >> v[j];
    return i;
}
template <typename T>
string join(const v(T) & v)
{
    stringstream s;
    rep(i, sz(v)) s << ' ' << v[i];
    return s.str().substr(1);
}
template <typename T>
ostream &operator<<(ostream &o, const v(T) & v)
{
    if (sz(v))
        o << join(v);
    return o;
}
template <typename T1, typename T2>
istream &operator>>(istream &i, pair<T1, T2> &v) { return i >> v.fi >> v.se; }
template <typename T1, typename T2>
ostream &operator<<(ostream &o, const pair<T1, T2> &v) { return o << v.fi << "," << v.se; }
template <typename T>
bool mins(T &x, const T &y)
{
    if (x > y)
    {
        x = y;
        return true;
    }
    else
        return false;
}
template <typename T>
bool maxs(T &x, const T &y)
{
    if (x < y)
    {
        x = y;
        return true;
    }
    else
        return false;
}
template <typename T>
ll suma(const v(T) & a)
{
    ll res(0);
    for (auto &&x : a)
        res += x;
    return res;
}
constexpr double eps = 1e-10;
constexpr ll LINF = 1001002003004005006ll;
constexpr int INF = 1001001001;
#define dame        \
    {               \
        puts("-1"); \
        return 0;   \
    }
#define yn           \
    {                \
        puts("Yes"); \
    }                \
    else { puts("No"); }
constexpr int MAX = 1000001;

int main()
{
    cout << fixed << setprecision(20);
    int n;
    long double b = 0, c = 0, d = 0;
    cin >> n;
    for (int i = 0; i < n; i++)
    {
        long double a;
        cin >> a;
        b += max(a, -a);
        c += pow(max(a, -a), 2);
        d = max(d, max(a, -a));
    }
    c = powl(c, 0.5);
    cout << b << "\n";
    cout << c << "\n";
    cout << d << "\n";
    return 0;
}


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

// neal Debugger
template<typename A, typename B> ostream& operator<<(ostream &os, const pair<A, B> &p) { return os << '(' << p.first << ", " << p.second << ')'; }
template<typename T_container, typename T = typename enable_if<!is_same<T_container, string>::value, typename T_container::value_type>::type> ostream& operator<<(ostream &os, const T_container &v) { os << '{'; string sep; for (const T &x : v) os << sep << x, sep = ", "; return os << '}'; }

void dbg_out() { cerr << endl; }
template<typename Head, typename... Tail> void dbg_out(Head H, Tail... T) { cerr << ' ' << H; dbg_out(T...); }

#ifdef LOCAL
#define dbg(...) cerr << "(" << #__VA_ARGS__ << "):", dbg_out(__VA_ARGS__)
#else
#define dbg(...)
#endif

typedef long long ll;
typedef vector<ll> vi; typedef pair<ll,ll> ii;
typedef vector<ii> vii; typedef vector<bool> vb;
#define FIN ios::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define forr(i, a, b) for(int i = (a); i < (int) (b); i++)
#define forn(i, n) forr(i, 0, n)
#define DBG(x) cerr << #x << " = " << (x) << endl
#define RAYA cerr << "===============================" << endl
#define pb push_back
#define mp make_pair
#define all(c) (c).begin(),(c).end()
#define esta(x,c) ((c).find(x) != (c).end())
const int INF = 1e9+15; // const ll INF = 2e18;
const int MOD = 1e9+7;  // const int MOD = 998244353;
const int MAXN  = 2e5+5;

int main(){
    FIN;

    int n; cin >> n;
    cout << n-1;

    return 0;
}

#include <iostream>
#include <math.h>
#include <algorithm>
#include <string>
#include <map>
#include <vector>
#include <cmath>
#include <iomanip>
#include <set>

using namespace std;

void c_neq_min2(void) {
	int n;
	cin >> n;
	vector<int>ans;
	int p;
	int min_val = 0;
	vector<bool>p_map(200001, false);

	for (int i = 0; i < n; i++) {
		cin >> p;
		p_map[p] = true;
		if (min_val == p) {
			while (p_map[min_val])min_val++;
		}
		ans.push_back(min_val);
	}

	for (int i = 0; i < ans.size(); i++)cout << ans[i] << endl;
}

int main()
{
    c_neq_min2();
    return 0;
}


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

int main(){
    int h,w;
    cin >> h >> w;
    vector<string> s(h);
    for(int i=0;i<h;i++){
        cin >> s.at(i);
    }
    int count=0;
    for(int i=0;i<h;i++){
        for(int j=0;j<w-1;j++){
            if(s.at(i).at(j) == '.' && s.at(i).at(j+1) == '.'){
                count++;
            }
        }
    }
    for(int i=0;i<w;i++){
        for(int j=0;j<h-1;j++){
            if(s.at(j).at(i) == '.' && s.at(j+1).at(i) == '.'){
                count++;
            }
        }
    }
    cout << count << endl;
    return 0;
}

#include <iostream>
#include <iomanip>
#include <sstream>
#include <vector>
#include <string>
#include <set>
#include <unordered_set>
#include <map>
#include <unordered_map>
#include <stack>
#include <queue>
#include <deque>
#include <algorithm>
#include <functional>
#include <iterator>
#include <limits>
#include <numeric>
#include <utility>
#include <type_traits>
#include <cmath>
#include <cassert>
#include <cstdio>

using namespace std;
using namespace placeholders;

using LL = long long;
using ULL = unsigned long long;
using VI = vector< int >;
using VVI = vector< vector< int > >;
using VS = vector< string >;
using ISS = istringstream;
using OSS = ostringstream;
using PII = pair< int, int >;
using VPII = vector< pair< int, int > >;
template < typename T = int > using VT = vector< T >;
template < typename T = int > using VVT = vector< vector< T > >;
template < typename T = int > using LIM = numeric_limits< T >;
template < typename T = int > using OSI = ostream_iterator< T >;

template < typename T > inline istream& operator>>( istream &s, vector< T > &v ){ for ( T &t : v ) { s >> t; } return s; }
template < typename T > inline ostream& operator<<( ostream &s, const vector< T > &v ){ for ( int i = 0; i < int( v.size() ); ++i ){ s << ( " " + !i ) << v[i]; } return s; }

void in_impl(){};
template < typename T, typename... TS > void in_impl( T &head, TS &... tail ){ cin >> head; in_impl( tail ... ); }
#define IN( T, ... ) T __VA_ARGS__; in_impl( __VA_ARGS__ );

template < typename T > inline T fromString( const string &s ) { T res; istringstream iss( s ); iss >> res; return res; }
template < typename T > inline string toString( const T &a ) { ostringstream oss; oss << a; return oss.str(); }

#define NUMBERED( name, number ) NUMBERED2( name, number )
#define NUMBERED2( name, number ) name ## _ ## number
#define REP1( n ) REP2( NUMBERED( REP_COUNTER, __LINE__ ), n )
#define REP2( i, n ) REP3( i, 0, n )
#define REP3( i, m, n ) for ( int i = ( int )( m ); i < ( int )( n ); ++i )
#define GET_REP( a, b, c, F, ... ) F
#define REP( ... ) GET_REP( __VA_ARGS__, REP3, REP2, REP1 )( __VA_ARGS__ )
#define FOR( e, c ) for ( auto &&e : c )
#define ALL( c ) begin( c ), end( c )
#define AALL( a ) ( remove_all_extents< decltype( a ) >::type * )a, ( remove_all_extents< decltype( a ) >::type * )a + sizeof( a ) / sizeof( remove_all_extents< decltype( a ) >::type )

#define SZ( v ) ( (int)( v ).size() )
#define EXISTS( c, e ) ( ( c ).find( e ) != ( c ).end() )

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

#define PB push_back
#define EM emplace
#define EB emplace_back
#define BI back_inserter

#define MP make_pair
#define fst first
#define snd second

#define DUMP( x ) cerr << #x << " = " << ( x ) << endl

//     Λ   Λ＿_
//  ／(*ﾟーﾟ)／＼
// ／| ￣U U￣|＼／
//   |      |／

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

	IN( int, H, W );
	VS board( H );
	cin >> board;

	const auto ok = [&]( const int y, const int x )
	{
		return 0 <= y && y < H && 0 <= x && x < W && board[y][x] == '.';
	};

	int res = 0;
	REP( i, H )
	{
		REP( j, W )
		{
			res += ok( i, j ) && ok( i + 1, j );
			res += ok( i, j ) && ok( i, j + 1 );
		}
	}
	cout << res << endl;

	return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define INF 1e9
#define MOD 1000000007
#define foru(i,a,b) for(int i=(a); i<(b); i++)
#define forue(i,a,b) for(int i=(a); i<=(b); i++)
#define forb(i,n) for(int i=n-1; i>=0; i--)
#define forall(it,v) for(auto it=v.begin();it!=v.end();++it)
#define pb push_back
#define fst first
#define snd second
#define pt(x) cout << x << "\n"
#define sz(c) ((int)c.size())
#define add(a, b, w) edges[a].pb(make_pair(b, w))
typedef pair<int,int> iai;
typedef long long int ll;

int a[200010];

int main(){

    //freopen("input.in", "r", stdin);
    //cin.tie(0);
    ios::sync_with_stdio(false);
    cin.tie(0);

    int n,m;
    cin >> n >> m;
    if(!m) pt(1);
    else {
        vector<int> v(m);

        foru(i, 0, m) {
            cin >> v[i];
        }
        sort(v.begin(), v.end());
        priority_queue<int, vector<int>, greater<int>> pq;
        int i = 0;
        int ant = 0;
        while (i < m) {
            if (v[i] - (ant + 1) > 0) {
                pq.push(v[i] - (ant + 1));
            }
            ant = v[i];
            i++;

        }
        if (n - v[m - 1] > 0) {
            pq.push(n - v[m - 1]);
        }
        if (pq.empty()) pt(0);
        else {
            double menor = pq.top();
            pq.pop();
            ll r = 1;
            while (!pq.empty()) {
                double act = pq.top();
                r += (int) ceil(act / menor);
                pq.pop();
            }
            pt(r);
        }
    }
}

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

int main(){
  long long n,m;
  cin >> n >> m;
  vector<long long> a(m+2);
  for (long long i = 0; i < m; i++){
    cin >> a[i];
  }
  a[m] = 0;
  a[m+1] = n+1;
  sort(a.begin(),a.end());
  long long k = 1000000000;
  vector<long long> white(m+1);
  for (long long i = 0; i < m+1; i++){
    long long temp = a[i+1]-a[i]-1;
    if (temp > 0){
      k = min(k,temp);
    }
    white[i] = temp;
  }
  int res = 0;
  for (auto n : white){
    res += n / k;
    if (n % k != 0){
      res++;
    }
  }
  cout << res << endl;
}


#include <bits/stdc++.h>
using namespace std;
#define rep(i,a,b) for(ll i=a;i<b;i++)
#define pb push_back
typedef long long ll;
typedef long double ld;
const ll INF = 9223372036854775807;
const ll MOD = 1000000007;
const long double PI = acos(-1);
#define mp make_pair
#define all(v) v.begin(), v.end()
#define F first
#define S second
typedef vector<ll> vi;
typedef map<int, int> mii;
typedef vector<vi> vvi;

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

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

// debugger end
//global variables

//functions

int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    //int test;
   // cin>>test;
   // while(test--)
   // {
    //    solve();
    //}

    ll n;
    cin>>n;

    vi arr;

    rep(i,0,n)
    {
        ll temp;
        cin>>temp;
        arr.pb(temp%200);
    }

    map <ll,ll> freq;

    rep(i,0,n)
    {
        freq[arr[i]]++;
    }

    ll ans=0;

    for(auto it:freq)
    {
        ans+=it.second*(it.second-1)/2;
    }

    cout<<ans<<endl;

 return 0;
}

#include <bits/stdc++.h>
typedef long long int ll;
#define fr(i, a, b) for (int i = a; i <= b; i++)
#define mset(arr) memset(arr, 0, sizeof(arr))
#define fast_io                       \
    ios_base::sync_with_stdio(false); \
    cin.tie(NULL)
#define mod 1000000007
using namespace std;

ll powrmod(ll a, ll b, ll m)
{
    ll pdt = 1;
    if (b == 0)
        return 1;
    else if (b % 2 == 0)
        return powrmod((a * a) % m, b / 2, m);
    else
        return (a * powrmod((a * a) % m, (b - 1) / 2, m)) % m;
}

void solve()
{
    int n;
    cin >> n;
    ll arr[n];
    fr(i, 0, n - 1) cin >> arr[i];
    ll hash[200];
    mset(hash);
    for (int i = 0; i < n; i++)
    {
        hash[arr[i] % 200]++;
    }
    ll cnt = 0;
    for (int i = 0; i < 200; i++)
    {
        cnt += hash[i] * (hash[i] - 1) / 2;
    }
    cout << cnt;
}

int main()
{

    ll t = 1;
    // cin>>t;
    while (t--)
    {
        solve();
        cout << endl;
    }

    return 0;
}


#include <stdio.h>
#include <string.h>

int main() {
	char x[203];
	scanf("%s", x);
	char *dot_pos = strchr(x, '.');
	if (dot_pos) *dot_pos = '\0';
	puts(x);
	return 0;
}

#include <iostream>
#include <iomanip>
#include <algorithm>
#include <vector>
#include <cmath>
#include <set>

using namespace std;
const long double PI = (acos(-1));
const long long MOD = pow(10, 9) + 7;
bool DEBUG = false;

// long long MOD(long long

int main()
{
	string S, T = {};
	cin >> S;

	for (int i = 0; i < S.size(); i++)
	{
		if (S[i] == '.')
		{
			break;
		}
		T += S[i];
	}
	cout << T << endl;

}


#pragma GCC optimize("Ofast")

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

#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define pop_b pop_back
#define pf push_front
#define pop_f pop_front
#define mt make_tuple
#define eb emplace_back
#define sf(x) sizeof(x)
#define len(x) x.length()
#define sz(x) x.size()
#define fastio() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)

#define LB(x,v) (lower_bound(x.begin(),x.end(),v)-x.begin())
#define UB(x,v) (upper_bound(x.begin(),x.end(),v)-x.begin())
typedef long long ll;
typedef pair<ll,ll> ii;
typedef long double ld;
typedef vector<int> vi;
typedef vector<set<ll>> vset;
typedef vector<ll> vl;
typedef vector<ld> vd;
typedef deque<ll> dql;
typedef deque<int> dqi;
typedef unsigned long long ull;
typedef tuple<int,int,int> State;

#define error(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }
void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
	cerr << *it << " = " << a << "\n";
	err(++it, args...);
}

#define vmax(type)   std::numeric_limits<type>::max()
#define vmin(type)   std::numeric_limits<type>::min()
#define each(a,x) for( auto &a:(x))
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define repr(i, n) for (ll i = (n) - 1; i >= 0; i--)
#define rep2(i, l, r) for (ll i = (l); i < (r); i++)
#define rep2r(i, l, r) for (ll i = (r) - 1; i >= (l); i--)
#define range(a) a.begin(), a.end()
#define deb(x) cout<<#x<<" "<<x<<endl;
#define cinai(a, n) vi a(n); rep(i, n) { cin>>a[i]; }
#define cinal(a, n) vl a(n); rep(i, n) { cin>>a[i]; }
#define coutai(a, n) rep(i, n) { cout<<a[i]<<" "; } ent;
#define coutal(a, n) rep(i, n) { cout<<a[i]<<" "; } ent;
#define ent cout<<endl;
#define resize_vec(a) a.resize(unique(a.begin(), a.end()) - a.begin());
#define ms(dp, x) memset(dp, x, sf(dp))
#define endl '\n'

ll powm(ll a, ll b, ll mod) {
	ll res=1;
	while(b) {
		if(b&1)
			res=(res*a)%mod;
		a=(a*a)%mod;
		b>>=1;
	}
	return res;
}

int db = 0;
const ll mod = 1e9 + 7;
const ll N = 1000005;
const ll inf = 1e9;
#define er if(db) error

class DisjointSet{
public:
    vector<int> parent;
    vector<map<int, int>> pres;
    DisjointSet(int n, vector<int> clas): parent(n) {
    	for(int i=0; i<n; i++)
    		parent[i] = i;
    	pres.resize(n);
    	for(int i = 0; i < n; i++)
    		pres[i][clas[i]] = 1;
    }
    void join(int a, int b) {
    	if(check(a, b))
    		return;
    	if(pres[find(a)].size() < pres[find(b)].size())
    		swap(a, b);
    	int par_a = find(a);
    	for(auto it : pres[find(b)])
    		pres[par_a][it.fi] += it.se;
    	parent[find(b)] = find(a);
    }
    int find(int a){
    	return a == parent[a] ? a : parent[a] = find(parent[a]);
    }
    bool check(int a, int b){
    	return find(a) == find(b);
    }
};

void solve()
{
	int n, q;
	cin>>n>>q;
	cinai(c, n);
	DisjointSet dis(n, c);
	while(q--){
		int tc;
		cin>>tc;
		int a, b;
		cin>>a>>b;
		if(tc == 1){
			dis.join(a-1, b-1);
		}else{
			cout<<dis.pres[dis.find(a-1)][b]<<endl;
		}
	}
}

// #define _DEBUG
// #define testCases
signed main() {
	ios_base::sync_with_stdio(false);
	cin.tie(0), cout.tie(0);
	cout << fixed << setprecision(15);

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

	int tc = 1;
#ifdef testCases
	cin>>tc;
#endif
	for(int t = 1; t <= tc; t++)
	{
#ifdef _DEBUG
	db = 1;
	int tt = clock();
#endif
		// cout<<"Case #"<<t<<": ";
		solve();

#ifdef _DEBUG
		cerr << "TIME = " << clock() - tt << endl;
		tt = clock();
#endif
	}
	return 0;
}

#include <bits/stdc++.h>
using namespace std;
//#include <atcoder/all>
//using namespace atcoder;
using ll=long long;
using Graph=vector<vector<int>>;
#define MAX 1000000
#define MOD 1000000007
#define INF 1000000000000000000

vector<map<int,int>> m;
vector<int> parent;
int find(int x){
  int y=parent[x];
  if(y!=parent[y]){
    y=find(y);
  }
  return parent[x]=y;
}
void unite(int a,int b){
  int x=find(a);
  int y=find(b);
  if(x!=y){
    if(m[x].size()>m[y].size()){
      parent[y]=x;
      for(auto p:m[y]){
        m[x][p.first]+=p.second;
      }
    }else{
      parent[x]=y;
      for(auto p:m[x]){
        m[y][p.first]+=p.second;
      }
    }
  }
}

int main(){
  int N,Q;
  cin>>N>>Q;
  vector<int> C(N);
  for(int i=0;i<N;i++){
    cin>>C[i];
    C[i]--;
  }
  parent.resize(N);
  m.resize(N);
  for(int i=0;i<N;i++){
    parent[i]=i;
    m[i][C[i]]++;
  }
  for(int i=0;i<Q;i++){
    int q,a,b;
    cin>>q>>a>>b;
    a--;b--;
    if(q==1){
      unite(a,b);
    }else{
      cout<<m[find(a)][b]<<endl;
    }
  }
}


#ifdef LOCAL
//#define _GLIBCXX_DEBUG
#endif
//#pragma GCC target("avx512f,avx512dq,avx512cd,avx512bw,avx512vl")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef pair<ll, ll> P;
typedef pair<int, int> Pi;
typedef vector<ll> Vec;
typedef vector<int> Vi;
typedef vector<string> Vs;
typedef vector<char> Vc;
typedef vector<P> VP;
typedef vector<vector<ll>> VV;
typedef vector<vector<int>> VVi;
typedef vector<vector<char>> VVc;
typedef vector<vector<vector<ll>>> VVV;
typedef vector<vector<vector<vector<ll>>>> VVVV;

#define endl '\n'
#define REP(i, a, b) for(ll i=(a); i<(b); i++)
#define PER(i, a, b) for(ll i=(a); i>=(b); i--)
#define rep(i, n) REP(i, 0, n)
#define per(i, n) PER(i, n, 0)
const ll INF=1e18+18;
const ll MOD=1000000007;
#define Yes(n) cout << ((n) ? "Yes" : "No") << endl;
#define YES(n) cout << ((n) ? "YES" : "NO") << endl;
#define ALL(v) v.begin(), v.end()
#define rALL(v) v.rbegin(), v.rend()
#define pb(x) push_back(x)
#define mp(a, b) make_pair(a,b)
#define Each(a,b) for(auto &a :b)
#define rEach(i, mp) for (auto i = mp.rbegin(); i != mp.rend(); ++i)
#ifdef LOCAL
#define dbg(x_) cerr << #x_ << ":" << x_ << endl;
#define dbgmap(mp) cerr << #mp << ":"<<endl; for (auto i = mp.begin(); i != mp.end(); ++i) { cerr << i->first <<":"<<i->second << endl;}
#define dbgset(st) cerr << #st << ":"<<endl; for (auto i = st.begin(); i != st.end(); ++i) { cerr << *i <<" ";}cerr<<endl;
#define dbgarr(n,m,arr) rep(i,n){rep(j,m){cerr<<arr[i][j]<<" ";}cerr<<endl;}
#define dbgdp(n,arr) rep(i,n){cerr<<arr[i]<<" ";}cerr<<endl;
#else
#define dbg(...)
#define dbgmap(...)
#define dbgset(...)
#define dbgarr(...)
#define dbgdp(...)
#endif
#define out(a) cout<<a<<endl
#define out2(a,b) cout<<a<<" "<<b<<endl
#define vout(v) rep(i,v.size()){cout<<v[i]<<" ";}cout<<endl
#define Uniq(v) v.erase(unique(v.begin(), v.end()), v.end())
#define fi first
#define se second

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

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

template<typename T>istream& operator>>(istream&i,vector<T>&v)
{rep(j,v.size())i>>v[j];return i;}

// vector
template<typename T>
ostream &operator<<(ostream &s, const vector<T> &v) {
    int len=v.size();
    for(int i=0; i<len; ++i) {
        s<<v[i];
        if(i<len-1) s<<"	";
    }
    return s;
}

// 2 dimentional vector
template<typename T>
ostream &operator<<(ostream &s, const vector<vector<T> > &vv) {
    int len=vv.size();
    for(int i=0; i<len; ++i) {
        s<<vv[i]<<endl;
    }
    return s;
}

int solve(){
    ll n,m;
    cin>>n>>m;
    Vec a(n);
    Vec b(m);
    cin>>a>>b;

    VV dp(n+2,Vec(m+2,INF));
    dp[0][0] = 0;
    rep(i,n+1){
        rep(j,m+1){
            chmin(dp[i][j+1],dp[i][j]+1);
            chmin(dp[i+1][j],dp[i][j]+1);
            chmin(dp[i+1][j+1],dp[i][j]+1);
            if(i < n && j < m && a[i]==b[j]){
                chmin(dp[i+1][j+1],dp[i][j]);
            }
        }
    }
    out(dp[n][m]);
    return  0;
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout<<std::setprecision(10);
//    ll T;
//    cin>>T;
//    while(T--)
    solve();
}

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> PP;
#define MOD 1000000007
//#define MOD 998244353
#define INF 2305843009213693951
//#define INF 810114514
#define PI 3.141592653589
#define setdouble setprecision
#define REP(i,n) for(ll i=0;i<(n);++i)
#define OREP(i,n) for(ll i=1;i<=(n);++i)
#define RREP(i,n) for(ll i=(n)-1;i>=0;--i)
#define all1(i) begin(i),end(i)
#define GOODBYE do { cout << "-1" << endl; return 0; } while (false)
#define MM <<" "<<
#define Endl endl
#define debug true
#define debug2 false

int main(void){

    ll X,Y,Z;
    cin >> X >> Y >> Z;

    ll Ans = 0;
    REP(i,1010000){
        if(i*X<Y*Z){
            Ans=max(Ans,i);
        }
    }
    cout << Ans << endl;

    return 0;
}


#include<bits/stdc++.h>
#define rep(i, n) for(long long i = 0; i < n; ++i)
#define rrep(i, n) for(long long i = n-1; i >= 0; --i)
#define fi first
#define se second
using namespace std;
using ll = long long;
using ui = unsigned int;
using ul = unsigned long long;
using ld = long double;
using v1i = vector<int>;
using v1ll = vector<ll>;
using v2i = vector<vector<int>>;
using v2ll = vector<vector<ll>>;
using v3i = vector<vector<vector<int>>>;
using v3ll = vector<vector<vector<ll>>>;
using v1b = vector<bool>;
using v2b = vector<vector<bool>>;
using v3b = vector<vector<vector<bool>>>;
using v1c = vector<char>;
using v2c = vector<vector<char>>;
using v3c = vector<vector<vector<char>>>;
constexpr ll MOD = 1000000007;
constexpr ll MOD2 = 998244353;

int main(){
    int n, q; cin >> n >> q;
    v1ll v(n+1), a(n+1);
    rep(i, n) cin >> v[i];
    v[n] = 1e18+1e9;
    sort(v.begin(), v.end());
    rep(i, n+1) a[i] = v[i] - i - 1;
    rep(i, q) {
        ll k; cin >> k;
        int j = lower_bound(a.begin(), a.end(), k) - a.begin();
        ll ans = v[j] - (a[j] - k) - 1;
        cout << ans << "\n";
    }
    return 0;
}

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef double db;
ll merge(vector<int>&arr1,vector<int>&arr2,int s,int e)
{
	int mid=(s+e)/2;
	ll cnt=0;
	int i=s,j=mid+1,k=s;
	while(i<=mid && j<=e){
		if(arr1[i]>arr1[j]){
			cnt+=(mid-i+1);
			arr2[k++]=arr1[j++];
		}
		else{
			arr2[k++]=arr1[i++];
		}
	}
	while(i<=mid)
	 arr2[k++]=arr1[i++];
	while(j<=e)
	 arr2[k++]=arr1[j++];
	for(int i=s; i<=e; i++)
	 arr1[i]=arr2[i];
	return cnt;
}
ll inversion(vector<int>&arr1,vector<int>&arr2,int s,int e)
{
	if(s<e){
		int mid=(s+e)/2;
		ll ans=0;
		ans+=inversion(arr1,arr2,s,mid);
		ans+=inversion(arr1,arr2,mid+1,e);
		ans+=merge(arr1,arr2,s,e);
		return ans;
	}
	return 0;
}
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	int n;
	cin>>n;
	vector<int>arr1(n);
	for(int i=0; i<n; i++)
	 cin>>arr1[i];
	vector<int>arr2(n);
	vector<int>arr3(n);
	arr2=arr1;
	arr3=arr2;
	ll ans=inversion(arr1,arr2,0,n-1);

	if(ans!=n-1){
		cout<<"-1";
		return 0;
	}
	else{
		arr2=arr3;
		vector<ll>temp;
		temp.push_back(arr2[0]);
		vector<ll>diff;
		map<int,int>rel;
		for(int i=1; i<n; i++){
			if(temp.back()<arr2[i])
			 temp.push_back(arr2[i]);
			else{
				temp.push_back(arr2[i]);
				int j=i;
				while(j>0){
					if(temp[j]<temp[j-1]){
						diff.push_back(j);
						if(rel[j]){
							cout<<"-1";
							return 0;
						}
						rel[j]++;
						swap(temp[j],temp[j-1]);
						j--;
					}
					else
					 break;
				}
			}
		}
		for(int i=0; i<diff.size(); i++)
		 cout<<diff[i]<<"\n";
	}
    return 0;
}


#include<iostream>
#include<vector>
#include<cstring>
#include<map>
#include<bitset>
#include<assert.h>
#include<algorithm>
#include<iomanip>
#include<cmath>
#include<set>
#include<queue>
#include<sstream>
#include<unordered_map>
#include<unordered_set>
#include<chrono>
#include<stack>
#include<deque>
#include<random>
#define long long long
using namespace std;

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
const int N=1e6,inf=1e9,mod=1e9+7;

int n;string s;

bool isOk(vector<int>v)
{
  for(int i=1;i<(int)v.size();i++)
  {
    if(v[i]==v[i-1])return false;
    if(v[i-1]<v[i] && s[i-1]=='>')return false;
    if(v[i-1]>v[i] && s[i-1]=='<')return false;
  }
  return true;
}
vector<vector<int> >ans;

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

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

  int lo=1,hi=10000,md;
  while(lo<=hi)
  {
    int md=(lo+hi)/2;

    vector<vector<int> >v(md);int f=1;
    for(int i=0;i<n+1;i++)
    {
      for(int j=0;j<md;j++)
      {
        v[j].push_back(a[i]/md);
      }
      int ex=a[i]%md;
      for(int j=0;j<ex;j++)v[j][i]++;
    }

    for(int j=0;j<md;j++)f&=isOk(v[j]);
    if(f){ans=v;lo=md+1;}
    else hi=md-1;
  }

  cout<<(int)ans.size()<<endl;
  for(auto x:ans)
  {
    for(auto z:x)cout<<z<<" ";cout<<endl;
  }

  return 0;
}

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

void read(int &x) {
    x=0;int f=1;char ch=getchar();
    for(;!isdigit(ch);ch=getchar()) if(ch=='-') f=-f;
    for(;isdigit(ch);ch=getchar()) x=x*10+ch-'0';x*=f;
}

void print(int x) {
    if(x<0) putchar('-'),x=-x;
    if(!x) return ;print(x/10),putchar(x%10+48);
}
void write(int x) {if(!x) putchar('0');else print(x);putchar('\n');}

#define lf double
#define ll long long

#define pii pair<int,int >
#define vec vector<int >

#define pb push_back
#define mp make_pair
#define fr first
#define sc second

#define data asd09123jdf02i3h

#define FOR(i,l,r) for(int i=l,i##_r=r;i<=i##_r;i++)

const int maxn = 200;
const int inf = 1e9;
const lf eps = 1e-8;
const int mod = 1e9+7;

int n,a[maxn];
char s[maxn];

int main() {
    read(n);scanf("%s",s+1);int k=1e9;
    for(int i=1;i<=n+1;i++) read(a[i]);
    for(int i=2;i<=n+1;i++) k=min(k,abs(a[i]-a[i-1]));
    write(k);
    for(int t=1;t<=k;t++) {
        for(int i=1;i<=n+1;i++) printf("%d ",(a[i]+t-1)/k);
        puts("");
    }
    return 0;
}