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

#define LETS_GET_SCHWIFTY ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define ff              first
#define ss              second
#define int             long long
#define ll              long long
#define pb              push_back
#define pii             pair<int,int>
#define vi              vector<int>
#define pqb             priority_queue<int>
#define pqs             priority_queue<int,vi,greater<int> >
#define setbits(x)      __builtin_popcountll(x)
#define zerobits(x)      __builtin_ctzll(x)
#define mod             998244353
#define inf             1e18
#define ps(x,y)         fixed<<setprecision(y)<<x
#define vpii            vector<pair<int,int> >
#define all(x)          x.begin(),x.end()
#define matrixprint(arr,a,b,c,d) for(int i=a;i<=c;i++){for(int j=b;j<=d;j++){cout<<arr[i][j]<<" ";}cout<<"\n";}
#define show(arr,x,y)   for(int i=x;i<=y;i++){cout<<arr[i]<<" ";}cout<<"\n"
#define sz(x)           (int)x.size()
#define db(x)           cout<<x<<"\n";

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

//insert,find_by_order,order_of_key,lower_bound,upper_bound;

#define TRACE
#ifdef TRACE
#define deb(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1) {
    cout << name << " : " << arg1 << std::endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args) {
    const char* comma = strchr(names + 1, ','); cout.write(names, comma - names) << " : " << arg1 << " | "; __f(comma + 1, args...);
}
#else
#define deb(...)
#endif

//////////////////////////////code//////////////////////////////

const int N = 200;

bool cmp(pii p1 , pii p2)
{
        return p1.ss < p2.ss;
}

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

        cout << 6 << " " << 10 << " " << 15 << " ";

        n -= 3;

        for(int i = 16 ; i <= 10000 && n > 0 ; i++)
        {
                if(i % 6 == 0 || i % 10 == 0 || i % 15 == 0 )
                {
                        cout << i << " ";
                        n--;
                }
        }

}

int32_t main()
{

    LETS_GET_SCHWIFTY;

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

    int t = 1;
  // cin >> t;

    while (t--)
        solve();

}

// check out for following mistakes-
// if using pb operation on vector and then trying to access index..check if sizeof that vec could remain 0 only
// is using prime sieve make sure it fits
// when using factorial template or combinatorics make sure that you edit fillfac fun values and array values

//@formatter:off
#include<bits/stdc++.h>
#define overload4(_1,_2,_3,_4,name,...) name
#define rep1(i,n) for (ll i = 0; i < ll(n); ++i)
#define rep2(i,s,n) for (ll i = ll(s); i < ll(n); ++i)
#define rep3(i,s,n,d) for(ll i = ll(s); i < ll(n); i+=d)
#define rep(...) overload4(__VA_ARGS__,rep3,rep2,rep1)(__VA_ARGS__)
#define rrep1(i,n) for (ll i = ll(n)-1; i >= 0; i--)
#define rrep2(i,n,t) for (ll i = ll(n)-1; i >= (ll)t; i--)
#define rrep3(i,n,t,d) for (ll i = ll(n)-1; i >= (ll)t; i-=d)
#define rrep(...) overload4(__VA_ARGS__,rrep3,rrep2,rrep1)(__VA_ARGS__)
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define popcount(x) __builtin_popcount(x)
#define pb push_back
#define eb emplace_back
#ifdef __LOCAL
#define debug(...) { cout << #__VA_ARGS__; cout << ": "; print(__VA_ARGS__); cout << flush; }
#else
#define debug(...) void(0)
#endif
#define INT(...) int __VA_ARGS__;scan(__VA_ARGS__)
#define LL(...) ll __VA_ARGS__;scan(__VA_ARGS__)
#define STR(...) string __VA_ARGS__;scan(__VA_ARGS__)
#define CHR(...) char __VA_ARGS__;scan(__VA_ARGS__)
#define DBL(...) double __VA_ARGS__;scan(__VA_ARGS__)
#define LD(...) ld __VA_ARGS__;scan(__VA_ARGS__)
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<int,int>;
using LP = pair<ll,ll>;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;
using vd = vector<double>;
using vvd = vector<vector<double>>;
using vs = vector<string>;
using vc = vector<char>;
using vvc = vector<vector<char>>;
using vb = vector<bool>;
using vvb = vector<vector<bool>>;
using vp = vector<P>;
using vvp = vector<vector<P>>;
template<class S,class T> istream& operator>>(istream &is,pair<S,T> &p) { return is >> p.first >> p.second; }
template<class S,class T> ostream& operator<<(ostream &os,const pair<S,T> &p) { return os<<'{'<<p.first<<","<<p.second<<'}'; }
template<class T> istream& operator>>(istream &is,vector<T> &v) { for(T &t:v){is>>t;} return is; }
template<class T> ostream& operator<<(ostream &os,const vector<T> &v) { os<<'[';rep(i,v.size())os<<v[i]<<(i==int(v.size()-1)?"":","); return os<<']'; }
template<class T> void vecout(const vector<T> &v,char div='\n') { rep(i,v.size()) cout<<v[i]<<(i==int(v.size()-1)?'\n':div);}
template<class T> bool chmin(T& a,T b) {if(a > b){a = b; return true;} return false;}
template<class T> bool chmax(T& a,T b) {if(a < b){a = b; return true;} return false;}
void scan(){}
template <class Head, class... Tail> void scan(Head& head, Tail&... tail){ cin >> head; scan(tail...); }
template<class T> void print(const T& t){ cout << t << '\n'; }
template <class Head, class... Tail> void print(const Head& head, const Tail&... tail){ cout<<head<<' '; print(tail...); }
template<class... T> void fin(const T&... a) { print(a...); exit(0); }
const string yes[] = {"no","yes"};
const string Yes[] = {"No","Yes"};
const string YES[] = {"NO","YES"};
const int inf = 1001001001;
const ll linf = 1001001001001001001;
//@formatter:on

int main(){
  int a,b,c,d;
  cin>>a>>b>>c>>d;
  cout<<b-c;
}


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

#define int long long
#define ff first
#define ss second
#define endl "\n"
#define all(x) (x).begin(), (x).end()
#define sz(x) (int)(x.size())
int powmod(int a,int l, int md){a%=md; int res=1;while(l){if(l&1)res=res*a%md;l/=2;a=a*a%md;}return res;}
int binpow(int a,int l){int res=1;while(l){if(l&1)res=res*a;l/=2;a=a*a;}return res;}
int invmod(int a, int md){return powmod(a,md-2,md);}
typedef long long ll; typedef unsigned long long ull; typedef long double ld;
typedef vector<int> vi; typedef pair<int, int> ii; typedef vector< ii > vii;
#define pb push_back
int __set(int b, int i) {return b|(1LL<<i);} //set ith bit
int __unset(int b, int i) {return b&(~(1UL<<i));}
int __check(int b, int i) {return b&(1LL<<i);} //returns 0 if ith bit is 0
int mulmod(int a, int b, int md) {return (((a%md)*(b%md))%md+md)%md;}
int addmod(int a, int b, int md) {return ((a%md+b%md)%md+md)%md;}
int submod(int a, int b, int md) {return (((a%md-b%md)%md)+md)%md;}
int divmod(int a, int b, int md) {return mulmod(a, powmod(b, md-2, md), md);} //if md is prime;
const ll inf = 0xFFFFFFFFFFFFFFFL; //very large number
priority_queue<int, vector<int>, greater<int> > pq; //for min priority_queue
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);

signed main(void)
{
	IOS;
	int n; cin>>n;
	vi a(n),b(n);
	for(int i = 0; i < n; i++) {
		cin>>a[i];
	}
	for(int i = 0; i < n; i++)
		cin>>b[i];
	int pre[n];
	pre[0]=a[0]*b[0];
	int mx=a[0];
	for(int i = 1; i < n; i++) {
		mx=max(mx,a[i]);
		pre[i]=max(pre[i-1],mx*b[i]);
	}
	for(int i = 0; i < n; i++)
		cout<<pre[i]<<endl;
	return 0;
}

#include <bits/stdc++.h>

#include <iostream>
#include <set>
#include <vector>

using namespace std;
typedef long long ll;

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

int main() {
  ll N;
  cin >> N;
  ll min = 1000, max = 0;
  for (int i = 0; i < N; i++) {
    ll A;
    cin >> A;
    if (max < A) max = A;
  }
  for (int i = 0; i < N; i++) {
    ll B;
    cin >> B;
    if (min > B) min = B;
  }
  ll ans = min - max + 1;
  if (ans < 0) ans = 0;
  cout << ans << endl;
  return 0;
}


#include <bits/stdc++.h>

using namespace std;

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

#define int long long
string s;
int n, k;
char w[200][200];
int d[200][200];

char lmao(char a, char b) {
	if(a == b) return a;

	else if(a == 'R') {
		if(b == 'P') return b;
		else return a;
	}else if(a == 'P') {
		if(b == 'S') return b;
		else return a;
	}else {
		if(b == 'R') return b;
		else return a;
	}
}
 main () {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);

	cin >> n >> k;
	cin >> s;

	for(int i = 0; i < n; i++)
		w[i][0] = s[(i)%n];
	for(int i = 0; i < n; i++) {
		d[i][0] = i;
	}
	for(int j = 1; j <= 150; j++) {

	for(int i = 0; i< n; i++){
			int nx = d[i][j - 1];

			nx++;
			nx %= n;
			d[i][j] = d[nx][j - 1];
		}
	}

	for(int j = 1; j <= k; j++) {

	for(int i = 0; i < n; i++) {
			int nx = d[i][j - 1];
			nx++;
			nx %= n;

			w[i][j] = lmao(w[i][j - 1], w[nx][j - 1]);
		}
	}
	cout << w[0][k];
}


#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll a[10][10],num[10];
int main()
{
	ll n,k,res=0;
	cin>>n>>k;
	for(int i=1;i<=n;i++)
		for(int j=1;j<=n;j++)
			cin>>a[i][j];
	for(int i=1;i<=n;i++)
		num[i]=i;
	do
	{
		ll last,now,sum=0;
		for(int i=1;i<n;i++)
		{
			last=num[i];
			now=num[i+1];
			sum=sum+a[last][now];
		}
		sum=sum+a[1][num[n]];
		if(sum==k)
			res++;
	}while(next_permutation(num+2,num+1+n));
	cout<<res;
	return 0;
}

#include<cstdio>
#include<iostream>
#include<cmath>
#include<algorithm>
#include<cstring>
#include<cstdlib>
#include<string>
#include<ctime>
#include<map>
#include<set>
#include<bitset>
#include<queue>
#include<deque>
#include<vector>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef unsigned int uint;
typedef long double ld;
inline int read(){
	int x=0;
	bool f=0;
	char ch=getchar();
	while(ch<'0'||ch>'9'){
		if(ch=='-'){
			f=1;
		}
		ch=getchar();
	}
	while(ch>='0'&&ch<='9'){
		x=(x<<1)+(x<<3)+(ch^48);
		ch=getchar();
	}
	if(f){
		return -x;
	}
	return x;
}
inline uint readu(){
	uint x=0;
	char ch=getchar();
	while(ch<'0'||ch>'9'){
		ch=getchar();
	}
	while(ch>='0'&&ch<='9'){
		x=(x<<1)+(x<<3)+(ch^48);
		ch=getchar();
	}
	return x;
}
void fp(){
	freopen(".in","r",stdin);
	freopen(".out","w",stdout);
}
int a[105],sum[105];
ll c[105][105],dp[105][10005],A[105];
const int mod=998244353;
inline ll modd(ll x){
	if(x<0){
	    return x+mod;
	}
	if(x>=mod){
		return x-mod;
	}
	return x;
}
int main(){
	//fp();
	dp[0][0]=1;
	int n=read(),i,j,k;
	ll ans=0;
	A[0]=1;
	for(i=1;i<=n;i++){
		A[i]=A[i-1]*i%mod;
	}
	for(i=1;i<=n;i++){
		a[i]=read();
		sum[i]=sum[i-1]+a[i];
	}
	if(sum[n]&1){
		printf("0");
		return 0;
	}
	for(i=1;i<=n;i++){
		for(j=i;j;j--){
			for(k=a[i];k<=sum[i];k++){
				dp[j][k]+=dp[j-1][k-a[i]];
				dp[j][k]=modd(dp[j][k]);
			}
		}
	}
	for(i=1;i<n;i++){
		ans+=dp[i][sum[n]>>1]*A[i]%mod*A[n-i]%mod;
		ans=modd(ans);
	}
	printf("%lld",ans);
	return 0;
}


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

#define pb push_back
#define S second
#define F first
#define FAST ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define vll vector<long long int>
#define pll pair<long long int,long long int>
#define mod 1000000007
#define mod2 998244353
#define ll long long int
#define ld long double
#define pi 3.141592653589793238
#define Endl endl
#define endl "\n"
const int N = 1e5 + 5;
const ll infP = 1e18;

void solve()
{
        deque<char> d;
        string s;
        cin >> s;
        bool rev = false;
        for(auto x:s)
        {
                if(x == 'R')
                        rev = !rev;
                else
                {
                        if(rev)
                        {
                                if(d.size() and d.front() == x)
                                        d.pop_front();
                                else
                                        d.push_front(x);
                        }
                        else
                        {
                                if(d.size() and d.back() == x)
                                        d.pop_back();
                                else
                                        d.push_back(x);
                        }
                }
        }
        string ans;
        for(auto x:d)
                ans += x;
        if(rev)
                reverse(ans.begin(),ans.end());
        cout << ans;
}

void debug(ll tt) {}

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

#include <bits/stdc++.h>
#define rep3(i, s, n, a) for (long long i = (s); i < (long long)(n); i += a)
#define rep2(i, s, n) rep3(i, s, n, 1)
#define rep(i, n) rep2(i, 0, n)

using namespace std;
using ld = long double;
using ll = long long;
using ull = unsigned long long;
using P = pair<int, int>;
using Pll = pair<ll, ll>;

int main() {
    string s;
    cin >> s;
    vector<vector<P>> indbox(2);
    int nowind = 0, start = 0;
    int slen = s.size();
    rep(i, slen){
        if(s[i]=='R'){
            indbox[nowind].emplace_back(start, i); // [start, i)
            nowind ^= 1;
            start = i+1;
        }
    }
    string res = "";
    int reslen = 0;
    indbox[nowind].emplace_back(start, slen);
    int indlen = indbox[nowind^1].size();
    for(int i=indlen-1;i>=0;i--){
        P now = indbox[nowind^1][i];
        for(int j=now.second-1;j>=now.first;j--){
            // cout << s[j];
            if(reslen == 0 || res[reslen-1]!=s[j]){
                res += s[j];
                reslen++;
            }else{
                if(reslen > 0){
                    res.erase(reslen-1);
                    reslen--;
                }
            }
            // cout << reslen << endl;
        }
    }
    indlen = indbox[nowind].size();
    rep(i, indlen){
        P now = indbox[nowind][i];
        rep2(j, now.first, now.second){
            // cout << s[j];
            if(reslen == 0 || res[reslen-1]!=s[j]){
                res += s[j];
                reslen++;
            }else{
                if(reslen > 0){
                    res.erase(reslen-1);
                    reslen--;
                }
            }
            // cout << reslen << endl;
        }
    }
    cout << res << endl;
    return 0;
}


#include<iostream>
#include<string>
#include<vector>
#include<cmath>
#include<queue>
#include<stack>
#include<set>
#include<algorithm>
#include<utility>
#include<map>
#include<tuple>
#include<deque>
using namespace std;
const int mod = 1000000007;
const int INF = 1001001001;
const long long LINF = 1001002003004005006;
const double PI = acos(-1);
int dir4row[] = { 1,0,-1,0 };
int dir4col[] = { 0,1,0,-1 };
int dir8row[] = { 1,1,0,-1,-1,-1,0,1 };
int dir8col[] = { 0,1,1,1,0,-1,-1,-1 };

/*-----------------------------------------------*/

vector<long long> a, b;

struct UnionFind {
	vector<int> r;
	vector<long long> sum1, sum2;
	int N;
	UnionFind(int n) {
		r = vector<int>(n, -1);
		N = n;
		sum1 = vector<long long>(n);
		sum2 = vector<long long>(n);
		for (int i = 0; i < n; ++i) {
			sum1[i] = a[i];
			sum2[i] = b[i];
		}
	}
	int root(int x) {
		if (r[x] < 0) {
			return x;
		}
		return r[x] = root(r[x]);
	}
	bool unite(int a, int b) {
		a = root(a);
		b = root(b);
		if (a == b) {
			return false;
		}
		if (r[a] > r[b]) {
			swap(a, b);
		}
		sum1[a] += sum1[b];
		sum1[b] = 0;
		sum2[a] += sum2[b];
		sum2[b] = 0;
		r[a] += r[b];
		r[b] = a;
		return true;
	}
	bool solve() {
		for (int i = 0; i < N; ++i) {
			if (sum1[i] != sum2[i]) {
				return false;
			}
		}
		return true;
	}
};

int main() {
	int n, m; cin >> n >> m;
	a = vector<long long>(n);
	b = vector<long long>(n);
	for (int i = 0; i < n; i++) {
		cin >> a[i];
	}
	for (int i = 0; i < n; i++) {
		cin >> b[i];
	}
	UnionFind uf(n);
	for (int i = 0; i < m; i++) {
		int c, d; cin >> c >> d;
		c--;
		d--;
		uf.unite(c, d);
	}
	if (uf.solve()) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}
	return 0;
}

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> l_l;
typedef pair<int, int> i_i;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<string> vs;
typedef vector<vs> vvs;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
const ll mod = 1000000007;

int main() {
    int N, M; cin >> N >> M;
    vi As(N);
    rep(i, N) cin >> As[i];
    vi Bs(N);
    rep(i, N) cin >> Bs[i];
    vi Cs(M);
    vi Ds(M);
    vvi adj(N, vi(0));
    rep(i, M) {
        cin >> Cs[i] >> Ds[i];
        Cs[i]--;
        Ds[i]--;
        adj[Cs[i]].push_back(Ds[i]);
        adj[Ds[i]].push_back(Cs[i]);
    }
    // グループの合計値が前後一致していればOK

    vector<bool> seen(N, false);
    int groupCnt = -1;
    vvi G(N, vi(0));
    rep(i, N){
        if(seen[i]) continue;
        seen[i] = true;
        groupCnt++;
        G[groupCnt].push_back(i);
        queue<int> q;
        q.push(i);
        while(!q.empty()){
            int cur = q.front();
            q.pop();
            for(int x: adj[cur]){
                if(seen[x]) continue;
                q.push(x);
                seen[x] = true;
                G[groupCnt].push_back(x);
            }
        }
    }
    string ans = "Yes";
    rep(i, groupCnt + 1){
        ll beforeSum = 0;
        ll afterSum = 0;
        for(int x: G[i]){
            beforeSum += As[x];
            afterSum += Bs[x];
        }
        if(beforeSum != afterSum){
            ans = "No";
            break;
        }
    }
    cout << ans << endl;

    return 0;
}


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

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

    int genzai = X / 100;
    //cout << "genzai " << genzai << endl;
    int ans = (genzai + 1)*100 - X;

    cout << ans << endl;

    return 0;
}

#include<bits/stdc++.h>
#include<iostream>
#define ll long long
#define rep(i,a) for(int i=0;i<a;i++)
#define int long long
#define di(a) int a;cin>>a;
#define dia di(a)
#define dix di(x)
#define diy di(y)
#define diz di(z)
#define dib di(b)
#define din di(n)
#define db double
#define all(x) x.begin(),x.end()
#define fast ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
using namespace std;
signed main()
{
    din
    int x=n%100;
  cout<<100-x;
    return 0;
}


#include <bits/stdc++.h>

using namespace std;
using llong = long long;
using ldbl = long double;
using lpair = pair<llong, llong>;

#define ALL(x) x.begin(), x.end()

constexpr llong mod = 1e9+7;
constexpr llong inf = mod * mod;

struct point {
  int h;
  int w;

  point() = default;
  point(int h, int w):
    h(h),
    w(w)
  {};
};

struct node {
  double eval = 0;
  int tile_sum = 0;
  point left_up;
  point right_down;
  point now;
  vector<int> action;
  bitset<2500> visited;

  node() = default;
  node(int e, point n, vector<int> a, bitset<2500> v):
    eval(e),
    now(n),
    action(a),
    visited(v)
  {};

  bool operator<(const node &right) const {
    return eval < right.eval;
  }
  bool operator>(const node &right) const {
    return eval > right.eval;
  }

  bool invalid_walk(point next);
  int bounding_box();
  int edge_dis();
  void make_next(point next, int dir);
  void evaluation();
};

const array<llong, 4> nw = {0, 1, 0, -1};
const array<llong, 4> nh = {-1, 0, 1, 0};
const string ans_char = "URDL";

point start_pos;
vector<vector<int>> tile_id(50, vector<int>(50));
vector<vector<int>> area(50, vector<int>(50));

point get_next_pos(point now, int dir) {
  return point(now.h + nh[dir], now.w + nw[dir]);
}

int node::bounding_box() {
  return (right_down.h - left_up.h) * (right_down.w - left_up.w);
}
bool node::invalid_walk(point next) {
  return next.h < 0 || next.w < 0 || next.h >= 50 || next.w >= 50 ||
      visited[tile_id[next.h][next.w]];
}

void node::make_next(point next, int dir) {
  now = next;
  visited[tile_id[next.h][next.w]] = 1;
  tile_sum += area[next.h][next.w];
  action.push_back(dir);
  left_up.h = min(left_up.h, next.h);
  left_up.w = min(left_up.w, next.w);
  right_down.h = max(right_down.h, next.h);
  right_down.w = max(right_down.w, next.w);
  evaluation();
}

int get_dis(point a, point b) {
  // return abs(b.h - a.h) + abs(b.w - a.w);
  return max(abs(b.h - a.h), abs(b.w - a.w));
}

int node::edge_dis() {
  return min({now.h, now.w, 50 - now.h, 50 - now.w});
}

void node::evaluation() {
  eval += pow(25 - edge_dis(), 2);
  int sum = 0;
  for (int i = 0; i < 4; i++) {
    sum += !invalid_walk(get_next_pos(now, i));
  }
  eval += pow(sum, 2) * 5;
  // eval += bounding_box() * 10;
}

vector<int> beam_search() {
  const double simulate_time = 1700000;
  clock_t s = clock(), f;
  priority_queue<node, vector<node>> que;
  node ret;

  node start_node;
  start_node.make_next(start_pos, -1);
  start_node.action.pop_back();
  que.push(start_node);

  int max_score = 0;
  while (f = clock(), f - s < simulate_time && que.size()) {
    for (int i = 0; i < 1000 && que.size(); i++) {
      node now_node = que.top();
      que.pop();

      bool walked = false;
      for (int j = 0; j < 4; j++) {
        point next_pos = get_next_pos(now_node.now, j);
        if (now_node.invalid_walk(next_pos)) {
          continue;
        }
        walked = true;
        node next_node = now_node;
        next_node.make_next(next_pos, j);

        que.push(next_node);
      }

      if (!walked && now_node.tile_sum > max_score) {
        max_score = now_node.tile_sum;
        ret = now_node;
      }
    }
  }

  cerr << que.size() << endl;
  while (que.size()) {
    node n = que.top();
    que.pop();
    if (n.tile_sum > max_score) {
      max_score = n.tile_sum;
      ret = n;
    }
  }

  return ret.action;
}

vector<int> solve() {
  clock_t s = clock();
  return beam_search();
}

int main() {
  cin >> start_pos.h >> start_pos.w;
  for (auto &in: tile_id) {
    for (auto &inin: in) {
      cin >> inin;
    }
  }
  for (auto &in: area) {
    for (auto &inin: in) {
      cin >> inin;
    }
  }

  auto ans = solve();
  for (auto a: ans) {
    cout << ans_char[a];
  }
  cout << endl;

  return 0;
}

#include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define fastio ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define vi vector<int>
#define mk make_pair
#define vll vector<long long >
#define loop(i,a,b) for(int i=a;i<=b;i++)
#define loopr(i,a,b) for(int i=b;i>=a;i--)
#define vii vector<vector<int>>
#define ll long long
void io()
{
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
}
unordered_map < ll, ll > dp;
ll dfs(ll y, ll x) {
	if (x == y)
		return 0;
	if (y == 1)
		return dp[y] = abs(x - y);

	if (dp.find(y) != dp.end())
		return dp[y];
	if (y > x) {
		if (y % 2 == 0) {
			return dp[y] =  min(y - x, 1 + dfs( y / 2, x));
		}
		else

			return dp[y] = min(1 + dfs(y - 1, x), 1 + dfs(y + 1, x));
	}
	else {
		return dp[y] = abs(x - y);
	}

}

int main()
{

	ll x, y;
	dp.clear();
	cin >> x >> y;

	cout << dfs(y, x) << endl;
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
const int inf = 5e8;
int dp[20][150000];
int adj[20][20];
int n;
int no[20][3];
int dist(int u, int v){ //u -> v
	return abs(no[u][0]-no[v][0])+abs(no[u][1]-no[v][1]) + max(0,no[v][2]-no[u][2]);
}

int tcp(int u, int mask){
	if(mask ==  (1<<n) - 1)return adj[u][0];
	if(dp[u][mask] != inf) return dp[u][mask];

	for(int v=0;v<n;v++){
		if(v==u || ( mask & (1<<v) )   )continue;
		int d1 = adj[u][v] + tcp(v,mask|(1<<v));
		if(d1 < dp[u][mask]){
			dp[u][mask]=d1;
		}
	}
	return dp[u][mask];
}
int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	for(int i=0;i<20;i++){
		for(int j=0;j<150000;j++){
			dp[i][j]=inf;
		}
	}
	cin>>n;
	for(int i=0;i<n;i++){
		for(int j=0;j<3;j++){
			cin>>no[i][j];
		}
	}

	for(int i=0;i<n;i++){
		for(int j=0;j<n;j++){
			adj[i][j]=dist(i,j);
		}
	}
	cout<<tcp(0,1)<<'\n';

	return 0;
}

//翻标签不犯规！
//数据范围如此别出心裁。。。
#include<cstdio>
#include<cstring>
#define int long long
#define noti(x,i) x&~(1<<i)
int n;
int f[262155][20];
struct node{int x,y,z;}a[20];
int abs(int x){return x>=0?x:-x;}
int max(int x,int y){return x>y?x:y;}
int min(int x,int y){return x<y?x:y;}
int dist(int x,int y){
    node c=a[x],d=a[y];
    return
    abs(d.y-c.y)+abs(d.x-c.x)+max(0,d.z-c.z);
}
signed main(){
	memset(f,0x3f,sizeof(f));
	scanf("%lld",&n);
	f[0][0]=0;
	for(int i=0;i<n;++i){
        scanf("%lld%lld%lld",
        &a[i].x,&a[i].y,&a[i].z);
    }
    a[n].x=a[0].x;
    a[n].y=a[0].y;
    a[n].z=a[0].z;
	int siz=1<<n+1;
	for(int i=0;i<siz;++i){
		for(int j=0;j<=n;++j){
			if(i&(1<<j)){
				for(int k=0;k<=n;++k){
					if(i&(1<<k)){
						int w=i|1<<j|1<<k;
						f[w][j]=
						min(f[noti(i,j)][k]
                        +dist(k,j),f[w][j]);
					}
				}
			}
		}
	}
	printf("%lld",f[siz-1][n]);
	return 0;
}


#include<cstdio>
#include<algorithm>
#define N 300010
#define db double
#define ll long long
#define fo(x,a,b) for(int x=(a);x<=(b);x++)
#define fd(x,a,b) for(int x=(a);x>=(b);x--)
using namespace std;
struct node{ll x; int id;}a[N];
int n,t[4],tot1=0,tot2=0,tot3=0,tot4=0;
ll b[N],c[N],d[N],e[N];
ll ans=(1ll<<50),ans1=(1ll<<50),ans2=(1ll<<50);

inline ll read() {
	ll x=0;int f=0;char c=getchar();
	while (c<'0'||c>'9') f=(c=='-')?1:f,c=getchar();
	while (c>='0'&&c<='9') x=x*10+c-'0',c=getchar();
	return f?-x:x;
}

int gc() {
	char c=getchar(); while (c!='R'&&c!='G'&&c!='B') c=getchar();
	if (c=='R') return 1; else if (c=='G') return 2; else return 3;
}

inline bool cmp(node x,node y) {return x.x<y.x;}

void calc1() {
	ans1=ans2=(1ll<<50);
	int pos=-1;
	fo(i,1,tot1) {
		int l=1,r=tot2,mid;
		ll res=(1ll<<50);
		while (l<=r) {
			mid=(l+r)>>1; res=min(res,abs(c[mid]-b[i]));
			if (c[mid]>=b[i]) r=mid-1; else l=mid+1;
		}
		if (res<ans1) ans1=res,pos=i;
	}
	fo(i,1,tot1) {
		int l=1,r=tot3,mid;
		ll res=(1ll<<50);
		while (l<=r) {
			mid=(l+r)>>1; res=min(res,abs(d[mid]-b[i]));
			if (d[mid]>=b[i]) r=mid-1; else l=mid+1;
		}
		if (res<ans2&&i!=pos) ans2=res;
	}
	ans=min(ans,ans1+ans2);
}

void calc2() {
	ans1=ans2=(1ll<<50);
	int pos=-1;
	fo(i,1,tot1) {
		int l=1,r=tot3,mid;
		ll res=(1ll<<50);
		while (l<=r) {
			mid=(l+r)>>1; res=min(res,abs(d[mid]-b[i]));
			if (d[mid]>=b[i]) r=mid-1; else l=mid+1;
		}
		if (res<ans2) ans2=res,pos=i;
	}
	fo(i,1,tot1) {
		int l=1,r=tot2,mid;
		ll res=(1ll<<50);
		while (l<=r) {
			mid=(l+r)>>1; res=min(res,abs(c[mid]-b[i]));
			if (c[mid]>=b[i]) r=mid-1; else l=mid+1;
		}
		if (res<ans1&&i!=pos) ans1=res;
	}
	ans=min(ans,ans1+ans2);
}

int main() {
	n=read();n=2*n;
	fo(i,1,n) {
		a[i].x=read(),a[i].id=gc(),t[a[i].id]++;
		if (a[i].id==1) b[++tot1]=a[i].x;
		else if (a[i].id==2) c[++tot2]=a[i].x;
		else d[++tot3]=a[i].x;
	}
	sort(a+1,a+n+1,cmp);
	if (t[1]%2==0&&t[2]%2==0&&t[3]%2==0)
		return 0&printf("0\n");
	sort(b+1,b+tot1+1);
	sort(c+1,c+tot2+1);
	sort(d+1,d+tot3+1);
	if (tot2%2==0) {
		swap(b,c),swap(tot1,tot2);
	}
	else if (tot3%2==0) {
		swap(b,d),swap(tot1,tot3);
	}
	fo(i,1,tot2) {
		int l=1,r=tot3,mid;
		ll res=(1ll<<50);
		while (l<=r) {
			mid=(l+r)>>1; res=min(res,abs(d[mid]-c[i]));
			if (d[mid]>=c[i]) r=mid-1; else l=mid+1;
		}
		ans=min(ans,res);
	}
	calc1();
	calc2();
	printf("%lld\n",ans);
	return 0;
}

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

using namespace std;

// Aの中でvalに最も近い値を二分探索で探し、差の絶対値を返す
long long findClosestVal(vector<long long> *A, long long val)
{
    long long lb, ub;
    lb = 0;
    ub = A->size() - 1;
    while (lb + 1 < ub)
    {
        long long mid = (lb + ub) / 2;
        if ((*A)[mid] <= val)
        {
            lb = mid;
        }
        else
        {
            ub = mid;
        }
    }
    return min(abs(val - (*A)[lb]), abs(val - (*A)[ub]));
}

int main()
{
    int N;
    cin >> N;
    vector<long long> R, G, B;
    for (int i = 0; i < 2 * N; i++)
    {
        long long a;
        string c;
        cin >> a >> c;
        if (c == "R")
            R.push_back(a);
        if (c == "G")
            G.push_back(a);
        if (c == "B")
            B.push_back(a);
    }

    if (R.size() % 2 == 0 && G.size() % 2 == 0 && B.size() % 2 == 0)
    {
        cout << 0 << endl;
        return 0;
    }

    vector<long long> *pO1, *pO2, *pE;
    if (R.size() % 2 == 0)
    {
        pE = &R;
        pO1 = &G;
        pO2 = &B;
    }
    else if (G.size() % 2 == 0)
    {
        pE = &G;
        pO1 = &B;
        pO2 = &R;
    }
    else if (B.size() % 2 == 0)
    {
        pE = &B;
        pO1 = &R;
        pO2 = &G;
    }

    sort(pO1->begin(), pO1->end());
    sort(pO2->begin(), pO2->end());
    sort(pE->begin(), pE->end());

    long long ans = 1e15;
    for (vector<long long>::iterator iter = pO1->begin(); iter < pO1->end(); iter++)
    {
        long long tmp = findClosestVal(pO2, *iter);
        ans = min(ans, tmp);
    }
    // cout << "ans " << ans << endl;

    long long val1, val2;
    val1 = 1e15;
    val2 = 1e15;
    for (vector<long long>::iterator iter = pE->begin(); iter < pE->end(); iter++)
    {
        long long tmp1 = findClosestVal(pO1, *iter);
        long long tmp2 = findClosestVal(pO2, *iter);
        val1 = min(val1, tmp1);
        val2 = min(val2, tmp2);
    }
    ans = min(ans, val1 + val2);
    cout << ans << endl;
}


#include<bits/stdc++.h>
#define ll long long
using namespace std;
ll read()
{
    char c;
    ll w=1;
    while((c=getchar())>'9'||c<'0')if(c=='-')w=-1;
    ll ans=c-'0';
    while((c=getchar())>='0'&&c<='9')ans=(ans<<1)+(ans<<3)+c-'0';
    return ans*w;
}
struct node
{
	ll a,b;
	bool operator<(const node&w)const
	{
		return a+a+b<w.a+w.a+w.b;
	}
}e[1000005];
int n;
int main(){
	n=read();
	ll now=0;
	for(int i=1;i<=n;i++)
	{
		e[i].a=read();
		now-=e[i].a;
		e[i].b=read();
	}
	sort(e+1,e+n+1);
	for(int i=n;i>=1;i--)
	{
		if(now>0)
		{
			cout<<n-i<<endl;
			return 0;
		}
		now+=e[i].a;
		now+=e[i].a;
		now+=e[i].b;
	}
	if(now>0)
	{
		cout<<n<<endl;
	}
	return 0;
}

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

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

  int temp = N;
  vector<int> vec;
  for(int i = 0; i < 10; i++) {
    vec.push_back(temp % 10);
    temp = temp / 10;
    if(temp == 0) {
      break;
    }
  }

  int count = 0;
  for(int i = 0; i < vec.size(); i++) {
    if(vec.at(i) != 0) {
      count = i;
      break;
    }
  }

  if (count != 0){
  	for(int i = 0; i < count; i++) {
    	vec.erase(vec.begin());
  	}
  }

  bool ret;
  if(vec.size() < 2) {
    ret = true;
  }
  else {
      int l = vec.size();
      l = l / 2;
	for(int i = 0; i < l; i++) {
   	 	int f = vec[i];
    	int b = vec[vec.size() - 1 - i];

        if(f == b) {
            ret = true;
        }
        else {
            ret = false;
            break;
        }
    }
  }

  if(ret) {
    cout << "Yes" << endl;
  } else {
    cout << "No" <<endl;
  }

  return 0;
}


#include <bits/stdc++.h>
#define REP(i,n) for (int i = 0; i < (n); ++i)
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;}
using namespace std;
using ll = long long;
using P = pair<int,int>;
using Pl = pair<long long,long long>;
using veci = vector<int>;
using vecl = vector<long long>;
using vecveci = vector<vector<int>>;
using vecvecl = vector<vector<long long>>;
const int MOD = 1000000007;
const double pi = acos(-1);
ll gcd(ll a, ll b) {if(b == 0) return a; else return gcd(b,a%b);}
ll lcm(ll a, ll b) {return a*b/gcd(a,b);}

template<int MOD> struct Fp {
    long long val;
    constexpr Fp(long long v = 0) noexcept : val(v % MOD) {
        if (val < 0) val += MOD;
    }
    constexpr int getmod() { return MOD; }
    constexpr Fp operator - () const noexcept {
        return val ? MOD - val : 0;
    }
    constexpr Fp operator + (const Fp& r) const noexcept { return Fp(*this) += r; }
    constexpr Fp operator - (const Fp& r) const noexcept { return Fp(*this) -= r; }
    constexpr Fp operator * (const Fp& r) const noexcept { return Fp(*this) *= r; }
    constexpr Fp operator / (const Fp& r) const noexcept { return Fp(*this) /= r; }
    constexpr Fp& operator += (const Fp& r) noexcept {
        val += r.val;
        if (val >= MOD) val -= MOD;
        return *this;
    }
    constexpr Fp& operator -= (const Fp& r) noexcept {
        val -= r.val;
        if (val < 0) val += MOD;
        return *this;
    }
    constexpr Fp& operator *= (const Fp& r) noexcept {
        val = val * r.val % MOD;
        return *this;
    }
    constexpr Fp& operator /= (const Fp& r) noexcept {
        long long a = r.val, b = MOD, u = 1, v = 0;
        while (b) {
            long long t = a / b;
            a -= t * b; swap(a, b);
            u -= t * v; swap(u, v);
        }
        val = val * u % MOD;
        if (val < 0) val += MOD;
        return *this;
    }
    constexpr bool operator == (const Fp& r) const noexcept {
        return this->val == r.val;
    }
    constexpr bool operator != (const Fp& r) const noexcept {
        return this->val != r.val;
    }
    friend constexpr ostream& operator << (ostream &os, const Fp<MOD>& x) noexcept {
        return os << x.val;
    }
    friend constexpr Fp<MOD> modpow(const Fp<MOD> &a, long long n) noexcept {
        if (n == 0) return 1;
        auto t = modpow(a, n / 2);
        t = t * t;
        if (n & 1) t = t * a;
        return t;
    }
};

using mint = Fp<MOD>;

int main() {
    int N; cin >> N;
    veci x(N),y(N);
    REP(i,N) cin >> x[i] >> y[i];

    int ans = 0;

    for(int i = 0; i < N-1; i++) {
        for(int j = i+1; j < N; j++) {
            if(abs(x[i]-x[j]) >= abs(y[i]-y[j])) ans++;
        }
    }

    cout << ans << endl;
}

#include <bits/stdc++.h>
using namespace std;
using ll=long long;
int main(){
	ll n,x=0;
	cin>>n;
	vector<ll>a(n);
	vector<ll>b(n);
	vector<ll>p(n);
	for(ll i=0;i<n;i++){
		cin>>a[i]>>b[i];
		x+=a[i];
		p[i]=2*a[i]+b[i];
	}
	sort(p.rbegin(),p.rend());
	ll i=0;
	while(x>=0){
		x-=p[i];
		i++;
	}
	cout<<i<<endl;
}


#include <bits/stdc++.h>
#define LL long long
#define ULL unsigned long long
#define pb push_back
#define st first
#define nd second
#define INF 0x3f3f3f3f
#define LINF 0x3f3f3f3f3f3f3f3f
template <class T> T read(T &a) {
    a=0;char x=getchar();bool f=0;
    for(;x<'0'||x>'9';x=getchar())f|=x=='-';
	for(;x>='0'&&x<='9';x=getchar())a=(a<<3)+(a<<1)+x-'0';
    if(f)a=-a;
    return a;
}
using namespace std;

bool vis[10005];

int main() {
    int n;
    read(n);
    for (int i = 1; i <= 10000; ++i) {
        if (i % 6 == 0 || i % 15 == 0 || i % 10 == 0) vis[i] = 1;
    }
    vis[6] = vis[10] = vis[15] = 0;
    printf("6 10 15 ");
    n -= 3;
    for (int i = 1; n; i++) {
        if (vis[i]) printf("%d ", i), n--;
    }
	return 0;
}

#include<bits/stdc++.h>

using namespace std;

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

    int count = 0;
    for( long long i = 1; i <= k; i++ )
    {
        for( long long j = 1; j <= k/i; j++ )
        {
            for( long long m = 1; m <= k/(i*j); m++ )
            {
                if( i*j*m <= k )
                count++;
            }
        }
    }
    cout<<count;
}


#include <iostream>
#include <sstream>
#include <cmath>
#include <functional>
#include <vector>
#include <map>
#include <queue>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); ++i)
using ll = long long;
using ull = unsigned long long;
using ld = long double;
using P = pair<int, int>;

int main() {
    int a, b, w;
    cin >> a >> b >> w;
    w *= 1000;

    int mx = -1;
    int mn = 1001001001;
    for (int i = 1; i <=1e6; ++i) {
        double p = (double)w / i;
        if (a <= p && p <= b) {
            mx = max(mx, i);
            mn = min(mn, i);
        }
    }

    if (mx == -1 && mn == 1001001001) { cout << "UNSATISFIABLE" << endl; }
    else { cout << mn << " " << mx << endl; }
    return 0;
}

#include <bits/stdc++.h>
using namespace std;
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
#define indexed_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
//find_by_order = returns pointer to element at that pos
//order_of_key = returns pos of the given element
#define indexed_multiset tree<int, null_type,less_equal<int>, rb_tree_tag,tree_order_statistics_node_update>
#define all(x)  (x).begin(),(x).end()
#define mem1(a)  memset(a,-1,sizeof(a))
#define mem0(a)  memset(a,0,sizeof(a))
#define int long long
#define endl "\n"
typedef vector<int> vi;
typedef pair<int,int> pi;
#define F first
#define S second
#define PB push_back
#define MP make_pair
#define rep(i,a,b) for (int i = a; i <b; i++)
int MOD = 1e9 + 7;
#define boost
#define debug1(x) cout<<#x<<" "<<x<<endl;
#define debug2(x,y) cout<<#x<<" "<<x<<" "<<#y<<" "<<y<<endl;
#define debug3(x,y,z) cout<<#x<<" "<<x<<" "<<#y<<" "<<y<<" "<<#z<<" "<<z<<endl;
template<typename T1,typename T2>istream& operator>>(istream& in,pair<T1,T2> &a){in>>a.F>>a.S;return in;}
template<typename T1,typename T2>ostream& operator<<(ostream& out,pair<T1,T2> a){out<<a.F<<" "<<a.S;return out;}
template<class _T>inline void read(_T &_a)
{
    bool f=0; char _c=getchar(); _a=0;
    while(_c<'0'||_c>'9'){ if(_c=='-') f=1; _c=getchar(); }
    while(_c>='0'&&_c<='9'){ _a=(_a<<3)+(_a<<1)-'0'+_c; _c=getchar(); }
    if(f) _a=-_a;
}

const long long INF=1e18;
int T;
//modular expoentiation
int modularExponentiation(int x,int n,int M)
{
    if(n==0)
        return 1;
    else if(n%2 == 0)        //n is even
        return modularExponentiation((x*x)%M,n/2,M);
    else                             //n is odd
        return ((x%M)*((modularExponentiation((x*x)%M,(n-1)/2,M))%M))%M;

}

int32_t main()
{
   /*  ios_base::sync_with_stdio(false);
    cin.tie(NULL);cout.tie(NULL); */
    int a,b,c;
cin>>a>>b>>c;
    a=a%10;
    int d=0;
    int temp= a;
    for(int i=1;i<100;i++)
    {
            temp *=a;

        if((temp)%10==a)
        {
            d=i;
            break;
        }

    }
/*     debug1(d); */
    int ans = modularExponentiation(b,c,d);
    if(ans==0)
    ans=d;
  int op =a;
    for(int i=0;i<ans-1;i++)
    op=op*a;

    cout<<op%10<<endl;

	// you should actually read the stuff at the bottom

/* stuff you should look for
	* int overflow, array bounds
	* special cases (n=1?)
	* do smth instead of nothing and stay organized
	* WRITE STUFF DOWN
	* DON'T GET STUCK ON ONE APPROACH
*/
return 0;
}


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

int main(){
    int h,w;
    cin >> h >> w;
    rep(i,h)rep(j,w) cin >> maze[i][j];
    int ans = 0;
    rep(i,h)rep(j,w){
        if(maze[i][j] == '#') ans += 4;
    }
    rep(i,h-1)rep(j,w-1){
        int cnt = 0;
        if(maze[i][j] == '#') ++cnt;
        if(maze[i+1][j] == '#') ++cnt;
        if(maze[i][j+1] == '#') ++cnt;
        if(maze[i+1][j+1] == '#') ++cnt;
        if(cnt == 2) ans -= cnt;
        if(cnt == 4) ans -= cnt;
        if(cnt == 3) ans -= cnt-1;
    }
    cout << ans << endl;
    return 0;
}

#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(i64 i=0; i<n; i++)
#define all(v) v.begin(),v.end()
#define pp pair<int,int>
using Graph=vector<vector<int>>;
using i64=int64_t;

int main() {
    int si,sj;cin>>si>>sj;
    vector<vector<int>> t(50,vector<int>(50));
    rep(i,50) {
        rep(j,50) {
            cin>>t[i][j];
        }
    }
    vector<vector<int>> p(50,vector<int>(50));
    rep(i,50) {
        rep(j,50) {
            cin>>p[i][j];
        }
    }
    vector<char>ans;
    if(si<=48) {
        if(t[si][sj]!=t[si+1][sj]) {
            ans.push_back('D');
        } else {
            ans.push_back('U');
        }
    } else {
        if(sj<=48) {
            if(t[si][sj]!=t[si][sj+1]) {
                ans.push_back('R');
            } else {
                ans.push_back('L');
            }
        } else {
            if(t[si][sj]!=t[si][sj-1]) {
                ans.push_back('L');
            } else {
                ans.push_back('U');
            }
        }
    }
    rep(i,ans.size()) {
        cout << ans[i];
    }
}


#include <iostream>
using namespace std;
int main(void){
    // Your code here!
    int N;
    cin >> N;
    cout << (N - 1) / 100 + 1 << endl;
}

/* CODER::==>ARYAN KANSAGARA
  CF HANDLE:=>Good_Devil
-----------------------------------------------*/

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

#define int long long int
#define endl "\n"

int32_t main() {
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
	freopen("error.txt", "w", stderr);
#endif
	ios_base::sync_with_stdio(false);
	cin.tie(NULL); cout.tie(NULL);
	int n;
	cin >> n;
	int sum = 0;
	int ans;
	for (int i = 1; i <= n; ++i)
	{
		sum += i;
		if (sum >= n)
		{
			ans = i;
			break;
		}
	}
	cout << ans;

	return 0;
}


#include <iostream>
#include <iomanip>
#include <cstdio>
#include <vector>
#include <bitset>
#include <string>
#include <cstring>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <deque>
#include <utility>
#include <algorithm>
#include <random>
#include <cmath>
#include <cassert>
#include <climits>
#include <ctime>
#include <chrono>

/*
#pragma GCC optimize("Ofast")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,sse4.1,sse4.2,popcnt,abm,mmx,avx,avx2,tune=native")
*/

#ifdef LOCAL
    #define dbg(x) cout << #x << " : " << x << endl;
#else
    #define dbg(x)
#endif

#define int long long
#define pb push_back
#define ppb pop_back()
#define mp make_pair
#define fi(a, b) for (int i = a; i < b; i++)
#define fj(a, b) for (int j = a; j < b; j++)
#define fk(a, b) for (int k = a; k < b; k++)
#define fi1(a, b) for (int i = a - 1; i >= b; i--)
#define fj1(a, b) for (int j = a - 1; j >= b; j--)
#define fk1(a, b) for (int k = a - 1; k >= b; k--)
#define fx(x, a) for (auto& x : a)
#define rep(i, a, b) for (int i = a; i < b; ++i)
#define rep1(i, a, b) for (int i = a - 1; i >= b; --i)
#define siz(x) (int)x.size()
#define lb lower_bound
#define ub upper_bound
#define all(x) x.begin(), x.end()

using namespace std;

template<typename T1, typename T2>inline void mine(T1 &x, const T2 &y) { if (y < x) x = y; }
template<typename T1, typename T2>inline void maxe(T1 &x, const T2 &y) { if (x < y) x = y; }

ostream& operator << (ostream &out, const vector<int> &b) {
    for (auto k : b) out << k << ' ';
    return out;
}

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef char ch;
typedef string str;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<pii> vpii;
typedef vector<vpii> vvpii;
typedef vector<ch> vch;
typedef vector<vch> vvch;
typedef vector<str> vs;

int MOD = 1000000007;
const int INF = 1000000050;
const long long BIG = (long long)2e18 + 50;
const int MX = 200010;
const double EPS = 1e-9;

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

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

ll sub(ll a, ll b) {
	a -= b;
	if (a < 0) return a + MOD;
	return a;
}

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

ll powmod(ll a, ll p) {
	if (p == 0) return 1;
	if (p & 1) return mult(a, powmod(a, p - 1));
	return powmod(mult(a, a), p / 2);
}

ll rev(ll a) {
	return powmod(a, MOD - 2);
}
int32_t main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);

    int n;
    int MOD1;
    cin >> n >> MOD1;
    MOD = MOD1 * MOD1;
    int pw2 = powmod(10, n);
    int pw1 = pw2 % MOD1;
    for (int r = 0; r < MOD1; ++r) {
    	if (mult(r, MOD1) == sub(pw2, pw1)) {
    		cout << r << '\n';
    	}
    }
}

#include<bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define mkp(x,y) make_pair(x,y)
#define pb(x) push_back(x)
#define sz(v) (int)v.size()
typedef long long LL;
typedef double db;
template<class T>bool ckmax(T&x,T y){return x<y?x=y,1:0;}
template<class T>bool ckmin(T&x,T y){return x>y?x=y,1:0;}
#define rep(i,x,y) for(int i=x,i##end=y;i<=i##end;++i)
#define per(i,x,y) for(int i=x,i##end=y;i>=i##end;--i)
inline int read(){
	int x=0,f=1;char ch=getchar();
	while(!isdigit(ch)){if(ch=='-')f=0;ch=getchar();}
	while(isdigit(ch))x=x*10+ch-'0',ch=getchar();
	return f?x:-x;
}
const int N=200005;
const int inf=0x3f3f3f3f;
int n,k,f[N],g[N];
vector<int>e[N];
int num;
void dfs(int u,int ft,int o){
	f[u]=-inf,g[u]=inf;
	for(int v:e[u]){
		if(v==ft)continue;
		dfs(v,u,o);
		ckmax(f[u],f[v]+1);
		ckmin(g[u],g[v]+1);
	}
	if(f[u]+g[u]<=o)f[u]=-inf;
	if(g[u]>o)ckmax(f[u],0);
	if(f[u]==o)++num,f[u]=-inf,g[u]=0;
}
bool check(int mid){
	num=0;
	dfs(1,0,mid);
	if(f[1]>=0)++num;
	return num<=k;
}
signed main(){
	cin>>n>>k;
	rep(i,2,n){
		int x=read(),y=read();
		e[x].pb(y),e[y].pb(x);
	}
	int l=0,r=n,res=n;
	while(l<=r){
		int mid=(l+r)>>1;
		if(check(mid))res=mid,r=mid-1;
		else l=mid+1;
	}
	cout<<res<<'\n';
}


#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
int T;
long long n;
int main(){
	for(cin>>T;T;T--){
		cin>>n;
		int cnt=0;
		while(n%2ll==0)cnt++,n>>=1ll;
		if(cnt==0)puts("Odd");
		else if(cnt==1)puts("Same");
		else puts("Even");
	}
}

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

#define MOD 1000000007
#define MOD99 998244353

int main(){
    int n;
    cin >> n;
    long long a,man = 0,che = 0,all = 0;
    double euc;

    for(int i = 0;i < n;i++){
        cin >> a;
        a = abs(a);
        man += a;
        all += a * a;
        che = max(che,a);
    }
    euc = sqrt(all);
    cout << fixed << setprecision(15);
    cout << man << endl;
    cout << euc << endl;
    cout << che << endl;
}


#include <bits/stdc++.h>
#define rep(i,a,b) for(int i=a,i##end=b;i<=i##end;i++)
#define drep(i,a,b) for(int i=a,i##end=b;i>=i##end;i--)
inline int read() {
	int x=0,f=1;char c=getchar();
	while(c<48||c>57){if(c=='-')f=-1;c=getchar();}
	while(c>=48&&c<=57)x=(x<<1)+(x<<3)+(c^48),c=getchar();
	return x*f;
}
using namespace std;
const int M=1e5+5;
typedef long long ll;
int n,m;
struct node {
	int t,c,d;
};
vector <node> E[M];
struct PR {
	int x;ll d;
	bool operator <(const PR &a)const {return d>a.d;}
};
priority_queue <PR> q;
ll dis[M];
bool vis[M];
int main() {
	n=read(),m=read();
	rep(i,1,m){
		int u=read(),v=read(),c=read(),d=read();
		E[u].push_back((node){v,c,d});
		E[v].push_back((node){u,c,d});
	}
	rep(i,1,n)dis[i]=2e18;
	dis[1]=0;
	q.push((PR){1,0});
	while(!q.empty()){
		int top=q.top().x;q.pop();
		if(vis[top])continue;
//		printf("top=%d,E=%d\n",top,E[top].size());
		vis[top]=1;
//		puts("A");
		rep(i,0,E[top].size()-1){
			int to=E[top][i].t,c=E[top][i].c,d=E[top][i].d;
//			printf("to=%d\n",to);
			ll t1=dis[top]+c+d/(dis[top]+1);
			ll x=sqrt(d);
			for(ll j=max(dis[top],x-600);j<=x+600;j++)t1=min(t1,0ll+j+c+d/(j+1));
//			printf("to=%d\n",to);
			if(dis[to]>t1)q.push((PR){to,dis[to]=t1});
		}
//		puts("B");
	}
//	puts("A");
	if(dis[n]==2e18)puts("-1");
	else printf("%lld\n",dis[n]);
	return 0;
}

#include <bits/stdc++.h>

using namespace std;

#define MS(a, b) memset(a, b, sizeof(a))
#define REP(a, b, c) for (register int a = b, _n = c; a <= _n; ++a)
#define DREP(a, b, c) for (register int a = b, _n = c; a >= _n; --a)
#define FOR(a, b, c) for (register int a = b, _n = c; a < _n; ++a)
#define EREP(a, b) for (register int a = head[b]; a; a = edge[a].nxt)

inline int rd() {
    int x = 0; char c = getchar(); bool f = 0;
    while (c < '0' && c != '-') c = getchar();
    if (c == '-') f = 1, c = getchar();
    while (c >= '0') x = (x << 3) + (x << 1) + (c ^ 48), c = getchar();
    return f ? -x : x;
}

const int SIZE = 2e5 + 100;

int n;

int head[SIZE], ecnt;
struct Edge {
	int v, nxt;
} edge[SIZE << 1];
void Add_Edge (int u, int v) {
	edge[++ecnt] = (Edge) { v, head[u] };
	head[u] = ecnt;
}

int dep[SIZE], F[SIZE];
int mx[SIZE][2];
int Len = -1, A, B;
void dfs (int u, int fa) {
	F[u] = fa;
	dep[u] = dep[fa] + 1;
	mx[u][0] = mx[u][1] = u;
	EREP (i, u) {
		int v = edge[i].v;
		if (v == fa) continue;
		dfs(v, u);
		if (dep[mx[v][0]] > dep[mx[u][0]])
			mx[u][1] = mx[u][0], mx[u][0] = mx[v][0];
		else if (dep[mx[v][0]] > dep[mx[u][1]])
			mx[u][1] = mx[v][0];
	}
	if (dep[mx[u][0]] + dep[mx[u][1]] - 2 * dep[u] > Len) {
		Len = dep[mx[u][0]] + dep[mx[u][1]] - 2 * dep[u];
		A = mx[u][0];
		B = mx[u][1];
	}
}
bool mark[SIZE];
int E;
int ans[SIZE];
void D (int u, int fa) {
	++E;
	ans[u] = E;
	EREP (i, u) {
		int v = edge[i].v;
		if (v == fa) continue;
		if (!mark[v]) D(v, u);
	}
	EREP (i, u) {
		int v = edge[i].v;
		if (v == fa) continue;
		if (mark[v]) D(v, u);
	}
	++E;
}

void _main () {
	n = rd();
	FOR (i, 1, n) {
		int u = rd(), v = rd();
		Add_Edge(u, v);
		Add_Edge(v, u);
	}
	dfs(1, 0);
	int T = A;
	while (A != B) {
		if (dep[A] < dep[B]) swap(A, B);
		mark[A] = 1;
		A = F[A];
	} mark[A] = 1;
	D(T, 0);
	REP (i, 1, n) printf ("%d ", ans[i]);
}

int main () {
#ifdef LOCAL
	freopen("in.txt", "r", stdin);
#endif
	_main();
	return 0;
}


#include <bits/stdc++.h>
using namespace std;
using lint = long long int;
using P = pair<int, int>;
using PL = pair<lint, lint>;
#define FOR(i, begin, end) for(int i=(begin),i##_end_=(end);i<i##_end_;i++)
#define IFOR(i, begin, end) for(int i=(end)-1,i##_begin_=(begin);i>=i##_begin_;i--)
#define REP(i, n) FOR(i,0,n)
#define IREP(i, n) IFOR(i,0,n)
#define ALL(a)  (a).begin(),(a).end()
constexpr int MOD = 1000000007;
constexpr lint B1 = 1532834020;
constexpr lint M1 = 2147482409;
constexpr lint B2 = 1388622299;
constexpr lint M2 = 2147478017;
constexpr int INF = 2147483647;
void yes(bool expr) {cout << (expr ? "Yes" : "No") << "\n";}
template<class T>void chmax(T &a, const T &b) { if (a<b) a=b; }
template<class T>void chmin(T &a, const T &b) { if (b<a) a=b; }
int main()
{
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  lint A, B;
  cin >> A >> B;
  lint N = B - A + 1;
  vector<lint> X(N);
  vector<lint> prime = {2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71};
  vector<vector<bool>> isprime(N, vector<bool>(20));
  REP(i, N) REP(j, 20) if((A+i)%prime[j] == 0) X[i] += (1<<j);
  vector<vector<lint>> dp(N+1, vector<lint>(1<<20));
  dp[0][0] = 1;
  REP(i, N) REP(bit, 1<<20) {
    dp[i+1][bit] += dp[i][bit];
    if((bit&X[i]) == X[i]) {
      dp[i+1][bit] += dp[i][bit^X[i]];
    }
  }
  lint ans = 0;
  REP(bit, 1<<20) {
    ans += dp[N][bit];
    //if(dp[N][bit] > 0) cout << bit << " " << dp[N][bit] << endl;
  }
  cout << ans << endl;
}

/*
    /\ In The Name Of Allah /\
    Author : Jawahiir Nabhan
*/
#include <bits/stdc++.h>
#define pb push_back
using namespace std;
typedef long long ll;
const char nl = '\n';

int main()
{
    ll N,K; cin>> N >> K;
    for(int i = 0;i < K;i++){
        if(N % 200 == 0) N /= 200;
        else N = N*1000 + 200;
    }
    cout<< N << nl;
}


#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N=2e5+5;
int n,m;
ll d;
pair<ll,ll> exgcd(ll a,ll b){
	if(!b){
		d=a;
		return {1,0};
	}
	pair<ll,ll> ret,ans=exgcd(b,a%b);
	ret.first=ans.second;
	ret.second=ans.first-(a/b)*ans.second;
	return ret;
}
int main(){
	ll i,j;
	int T;cin>>T;
	while(T--){
		ll x,y,p,q;cin>>x>>y>>p>>q;
		pair<ll,ll> ans=exgcd(x+y+x+y,p+q);
		ll answ=9e18;
		for(i=x+y+1;i<=x+y+y;i++){
			for(j=1;j<=q;j++){
				if((i-j)%d) continue;
				ll a=ans.first*((i-j)/d);
				ll mda=(p+q)/d,mdb=(x+y)*2/d;
				ll ta=(a%mda+mda)%mda;
				if(ta==0) ta+=mda;
				ll b=ans.second*(i-j)/d;
				ll tb=(b%mdb+mdb)%mdb;
				if(tb>=0) tb-=mdb;tb=-tb;
				answ=min(answ,max(ta*(x+y)*2-i,tb*(p+q)-j));
			}
		}
		if(answ==9e18) cout<<"infinity"<<endl;
		else cout<<answ<<endl;
	}
	return 0;
}

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

#define fr(i,n) for(int i = 0; i<n; i++)
#define sz(v) (int)(v.size())
#define prin(a) cout << #a << " = " << a << endl
#define prinv(v) cout << #v << " = "; for(auto it : v) cout << it << ", "; cout << endl
#define all(v) (v).begin(),(v).end()

typedef long long ll;

#define rmin(a,b) a = min<ll>(a,b)
#define rmax(a,b) a = max<ll>(a,b)

#define fi first
#define se second

ll div(ll a, ll b, bool ceil){
	ll ans = abs(a/b);
	bool pos = (a<0)==(b<0);
	if(a%b and ceil==pos) ans++;
	if(!pos) ans*=-1;
	return ans;
}

ll gcd_ext(ll a, ll b, ll &xo, ll &yo){
	if(b==0){
		xo = 1, yo = 0;
		return a;
	}
	ll x1, y1;
	ll g = gcd_ext(b,a%b,x1,y1);
	xo = y1;
	yo = x1-(a/b)*y1;
	return g;
}

/*
Retorna qual o menor x positivo que satisfaz
a*x + b*y = c (obviamente o y correspondente eh negativo)
(ou -1 se nao existe)

Util em CRT para achar menor r positivo que
	r = ra (mod a)
	r = rb (mod b)
	->
	a*x-b*y = rb-ra
	r = a*x + ra
*/
ll qual_sol(ll a, ll b, ll c){
	ll xo, yo;
	ll g = gcd_ext(a,b,xo,yo);
	if(c%g!=0) return -1;
	c/=g, a/=g,b/=g;
	xo*=c,yo*=c;

	ll k = div(-xo,b,b>0);

	return xo+k*b;
}

ll mins(ll ra, ll a, ll rb, ll b){
	ll minx = qual_sol(a,-b,rb-ra);
	if(minx==-1) return minx;
	return a*minx+ra;
}

int main(){
	ios::sync_with_stdio(0); cin.tie(0);
	ll t; cin >> t;
	fr(tt,t){
		ll X, Y, P, Q; cin >> X >> Y >> P >> Q;

		ll t1 = P+Q, t2 = 2*X+2*Y;
		ll ans = LLONG_MAX;
		fr(i,Q) fr(j,Y){
			ll cand = mins(P+i,t1,X+j,t2);
			if(cand!=-1) rmin(ans,cand);
		}
		//prin(t1);
		//prin(t2);
		if(ans<LLONG_MAX){
			cout << ans << "\n";
		} else{
			cout << "infinity\n";
		}
	}
}


#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <numeric>
#include <utility>
#include <tuple>

#define rep(i, a, b) for (int i = int(a); i < int(b); i++)
using namespace std;
using ll = long long int;
using P = pair<ll, ll>;

// clang-format off
#ifdef _DEBUG_
#define dump(...) do{ cerr << __LINE__ << ":\t" << #__VA_ARGS__ << " = "; PPPPP(__VA_ARGS__); cerr << endl; } while(false)
template<typename T> void PPPPP(T t) { cerr << t; }
template<typename T, typename... S> void PPPPP(T t, S... s) { cerr << t << ", "; PPPPP(s...); }
#else
#define dump(...) do{ } while(false)
#endif
template<typename T> vector<T> make_v(size_t a, T b) { return vector<T>(a, b); }
template<typename... Ts> auto make_v(size_t a, Ts... ts) { return vector<decltype(make_v(ts...))>(a, make_v(ts...)); }
template<typename T> bool chmin(T &a, T b) { if (a > b) {a = b; return true; } return false; }
template<typename T> bool chmax(T &a, T b) { if (a < b) {a = b; return true; } return false; }
template<typename T> void print(T a) { cout << a << '\n'; }
template<typename T, typename... Ts> void print(T a, Ts... ts) { cout << a << ' '; print(ts...); }
template<typename T> istream &operator,(istream &in, T &t) { return in >> t; }
// clang-format on

P convert(ll n, ll m) {
    return {n / m, n % m};
}

P multiple(P p1, P p2, ll m) {
    ll bd = p1.second * p2.second;
    return {(p1.first * p2.second + p1.second * p2.first + bd / m) % m, bd % m};
}

P mypow(ll n, ll m) {
    if (n == 0) {
        return convert(1, m);
    }
    if (n % 2 == 0) {
        P res = mypow(n / 2, m);
        return multiple(res, res, m);
    }
    return multiple(mypow(n - 1, m), convert(10, m), m);
}

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    ll n, m;
    cin, n, m;
    P res = mypow(n, m);
    print(res.first);
    return 0;
}

#include<bits/stdc++.h>
#define ll long long
#define in insert
#define pb push_back
#define endl '\n'
#define ub upper_bound
#define lb lower_bound
#define pf pop_front
#define all(v) (v).begin(),(v).end()
#define fi first
#define se second
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);srand(time(0));
using namespace std;
ll po(ll x,ll y,ll z)
{
	if(y==0)return 1;

	ll r=po(x,y/2,z);
	r=(r*r)%z;

	if(y&1)r=(r*x)%z;

	return r;
}
void fun()
{
	ll a,b;cin>>a>>b;

	ll r=b*b;

	ll x=po(10,a,r);
	cout<<x/b;
}
int main()
{
    fast;
    int t=1;
    //cin>>t;
    while(t--)
    {
    	fun();
	}
}


// execute g++ main.cpp -std=c++14 -I C:\Users\naoya\Desktop\code\Atcoder
#include<bits/stdc++.h>
//#include<atcoder/all>
typedef long long ll;
typedef long double ld;
using namespace std;
//using namespace atcoder;

using Pii = pair<int, int>;
using Pll = pair<ll, ll>;

//ordered_set 重複不可
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
template<typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
// use set_function + find_by_order(select itr-num)

#define REP(i, l, n) for(int i=(l), i##_len=(n); i<i##_len; ++i)
#define ALL(x) (x).begin(),(x).end()
#define pb push_back

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

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

char alpha[26] = {'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z'};
char Alpha[26] = {'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z'};

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

//cout << std::fixed << std::setprecision(15) << y << endl; //小数表示

const ll MOD = 998244353;

const ll MAX = 1000000; //テーブルの数

long long fac[MAX], finv[MAX], inv[MAX];
// finv ->階乗割り算
// fac ->階乗掛け算

// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

// 二項係数計算
long long COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return (fac[n] * (finv[k] * finv[n - k] % MOD)) % MOD;
}

int n, m;

map<ll, ll> mp;

ll solve(ll sum){ //残りを計算する
  if(sum % 2 == 1){
      return 0;
  }
  if(mp.count(sum)){
      return mp[sum];
  }
  ll mid = 0;
  for(int i = 0; i <= n; i+=2){
      ll c = COM(n, i);
      if(sum - i < 0){
          break;
      }
      mid += c * solve((sum - i) / 2);
      mid %= MOD;
  }
  mp[sum] = mid;
  //cout << sum <<  " " << mid << endl;
  return mid;
}

int main(){
    COMinit();
    cin >> n >> m;
    if(m % 2 == 1){
        cout << 0 << endl;
        return 0;
    }
    mp[0] = 1;
    cout << solve(m) << endl;
}

#include<bits/stdc++.h>
using namespace std;
#define int long long
const int maxn=5005;
const int mod=998244353;
int n,m;
int dp[15][maxn];
int C[maxn][maxn];
void init() {
	C[0][0]=1;
	for(int i=1 ; i<maxn ; i++) {
		for(int j=0 ; j<=i ; j++) {
			if(!j||j==i) C[j][i]=1;
			else C[j][i]=C[j-1][i-1]+C[j][i-1];
			if(C[j][i]>=mod) C[j][i]-=mod;
		}
	}
}
signed main() {
	//freopen("bruh.inp","r",stdin);
	//freopen("bruh.out","w",stdout);
	init();
	cin>>n>>m;
	dp[13][0]=1;
	for(int bit=12 ; bit>=0 ; bit--) {
		for (int val=0 ; val<=m ; val+=(1<<bit+1)) {
            for (int x=0,nval=val ; nval>=0 ; x+=2 , nval-=(1<<bit+1)) {
                dp[bit][val]+=(dp[bit+1][nval]*C[x][n])%mod;
                dp[bit][val]%=mod;
                // if(dp[bit][val]) cout<<"dp "<<bit<<" "<<val<<" = "<<dp[bit][val]<<endl;
            }
        }
	}
	cout<<dp[0][m];
}


#include <bits/stdc++.h>

using namespace std;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int tt = 1;
  //cin >> tt;
  while(tt--) {
    int x, y;
    cin >> x >> y;
    int a=min(x, y);
    int b = max(x, y);
    if(a+3 > b) {
      cout << "Yes\n";
    } else {
      cout << "No\n";
    }
  }
  return 0;
}

/*
ID: jerrywcy
LINK:
TITLE:
LANG: C++
STATUS:
*/
#include <bits/stdc++.h>
#define DEBUG

#define init(array,x) memset(array,x,sizeof(array))

using namespace std;

typedef long long ll;

const int inf=0x3f3f3f3f;

ll sx,sy,gx,gy;
double ans;

int read(){
    int f=1,x=0;
    char ss=getchar();
    while(ss<'0'||ss>'9'){if(ss=='-')f=-1;ss=getchar();}
    while(ss>='0'&&ss<='9'){x=x*10+ss-'0';ss=getchar();}
    return f*x;
}

int main()
{
    sx=read();sy=read();gx=read();gy=read();
    if (sx>gx){swap(sx,gx);swap(sy,gy);}
    ans=sx+double(gx-sx)*sy/(gy+sy);
    printf("%.8lf\n",ans);

    return 0;
}


#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i, s, n) for (int i = (s); i < (n); ++i)
#define rrep(i, n) for (int i = n - 1; i >= 0; --i)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define len(x) (int)(x).size()
#define pb push_back
#define em emplace_back
#define vi vector<int>
#define vl vector<long long>
#define vs vector<string>
#define vc vector<char>
#define vd vector<double>
#define vb vector<bool>
#define vvi vector<vector<int>>
#define vvl vector<vector<long long>>
#define fast  \
  cin.tie(0); \
  ios::sync_with_stdio(false);
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<int, int>;

int main() {
  fast;
  int h, w;
  cin >> h >> w;
  vs s(h + 2, "");
  rep(i, 0, w + 2) {
    s[0] += '.';
    s[h + 1] += '.';
  }
  rep(i, 1, h + 1) cin >> s[i];
  int a = h + 1, b = w + 1;
  rep(i, 1, h + 1) {
    s[i] = "." + s[i];
    s[i] += ".";
  }
  int ans = 0;
  rep(i, 0, a) rep(j, 0, b) {
    int cnt = 0;
    if (s[i][j] == '.') ++cnt;
    if (s[i][j + 1] == '.') ++cnt;
    if (s[i + 1][j] == '.') ++cnt;
    if (s[i + 1][j + 1] == '.') ++cnt;
    if (cnt == 3 || cnt == 1) ++ans;
  }
  cout << ans << endl;
  return 0;
}

#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
#pragma GCC loop-opt(on)

#define rep(i, a, b) for(int i = a; i <= b; i++)
#define rrep(i, a, b) for(int i = b; i >= a; i--)
#define print(x) cout << #x <<" = " << x <<"\n"
#define pprint(x) cout << #x <<" = (" << x.first <<", " << x.second <<")\n"
#define all(x) x.begin(), x.end()
#define ceil(a, b) ((a + b - 1) / (b))

#define INF 1000000000000000000
#define MAXN 200
#define MOD 1000000007
#define eps (1e-9)

#define int long long int
#define lld long double
#define pii pair<int, int>
#define random mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count())

using namespace std;
int n, m, c[MAXN * MAXN], d[MAXN * MAXN];
int ans[MAXN*MAXN], v[MAXN*MAXN];
pii p[MAXN*MAXN];
int mp[MAXN][MAXN], timestamp, a, b;
void dfs(int x) {
	d[x] = ++timestamp;
	rep(i, 1, n) {
		if(c[i] == c[x] && !d[i] && mp[i][x]) {
			mp[x][i] = -1, mp[i][x] = -2;
			dfs(i);
		}
	}
	return;
}
void solve() {
	timestamp = 0;
	rep(i, 1, n) {
		if(!d[i]) d[i] = 1, dfs(i);
	}
	rep(i, 1, m) {
		tie(a, b) = p[i];
		if(c[a] > c[b]) ans[i] = -1;
		else if(c[b] > c[a]) ans[i] = -2;
		else if(mp[a][b] < 0) ans[i] = mp[a][b];
		else ans[i] = (d[a] > d[b] ? -1 : -2);
		mp[a][b] = ans[i];
		mp[b][a] = -3 - ans[i];
	}
	return ;
}
int dfs1(int x) {
	int cnt = 1; v[x] = 1;
	rep(i, 1, n) {
		if(!v[i] && mp[x][i] == -1) cnt += dfs1(i);
	}
	return cnt;
}
bool check() {
	rep(i, 1, n) {
		memset(v, 0, sizeof(v));
		if(dfs1(i) != c[i]) return false;
	}
	return true;
}
signed main() {
	ios::sync_with_stdio(false), cin.tie(0);
	cin >> n >> m;
	rep(i, 1, m) {
		cin >> a >> b;
		p[i] = {a, b};
		mp[a][b] = mp[b][a] = 1;
	}
	rep(i, 1, n) cin >> c[i];
	solve();
	assert(check());
	rep(i, 1, m) {
		if(ans[i] == -1) cout <<"->\n";
		else cout <<"<-\n";
	}
	return 0;
}


#include<iostream>
#include<cstdio>
#include<algorithm>
#include<queue>
using namespace std;
const int R=2e5 + 5;
const int N=1e5 + 3;
const int M = 2e3 + 3;
const int INF=0x3f3f3f3f;
struct edge{
	int v,w,next;
}e[R*2];
int dis[N],head[2*N],cnt=0;
int a[M][M];
struct node{
	int u,d;
	bool operator <(const node&rhs) const{
	  return d>rhs.d;
	}
};
inline void addedge(int u,int v,int w){
	e[++cnt].v=v;
	e[cnt].w=w;
	e[cnt].next=head[u];
	head[u]=cnt;
}
int n,m,s;
inline void Dij(){
	for(int i=1;i<=n;i++) dis[i]=INF;
	dis[s]=0;
	priority_queue<node> Q;
	Q.push((node){s,0});
	while(!Q.empty()){
		node fr=Q.top();Q.pop();
		int u=fr.u,d=fr.d;
		if(d!=dis[u]) continue;
		for(int i=head[u];i;i=e[i].next){
			int v=e[i].v,w=e[i].w;
			if(dis[u]+w<dis[v]){
				dis[v]=dis[u]+w;
				Q.push((node){v,dis[v]});
			}
		}
	}
}
int main(){
	cin>>n>>m;
	for(int i=1;i<=m;i++){
		int x,y,z;
		cin>>x>>y>>z;
		if(!a[x][y]) a[x][y] = z;
		a[x][y] = min(a[x][y], z);
		addedge(x,y,z);
	}
	for(int i = 1; i <= n; ++i) {
		s = i;
		Dij(); int ans = -1;
		for(int j = 1; j <= n; ++j) if(dis[j] != INF && a[j][i]) {
			if(ans == -1) ans = dis[j] + a[j][i];
			ans = min(ans, dis[j] + a[j][i]);

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

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

struct E {
    int to, co;
    E(int to=0, int co=0):
    to(to), co(co) {}
};

int main(){
    int n, m;
    cin >> n >> m;
    vector<vector<E>> g(n);
    rep(i, m){
        int a, b, c;
        cin >> a >> b >> c;
        --a, --b;
        g[a].emplace_back(b, c);
    }
    const int INF = 1001001001;
    rep(sv, n){
        vector<int> dist(n, INF);
        priority_queue<P, vector<P>, greater<P>> q;
        auto push = [&](int v, int d){
            if(dist[v] <= d) return;
            dist[v] = d;
            q.emplace(d, v);
        };
        for (auto&&  e: g[sv]) push(e.to, e.co);
        while(!q.empty()){
            int d = q.top().first;
            int v = q.top().second;
            q.pop();
            if(dist[v] != d) continue;
            for (auto&& e : g[v]){
                push(e.to, d+e.co);
            }
        }
        int ans = dist[sv];
        if (ans == INF) ans = -1;
        cout << ans << endl;
    }
}


#include <bits/stdc++.h>
using namespace std;
#define DEBUG
#ifdef DEBUG
template <class T, class U>
ostream &operator<<(ostream &os, const pair<T, U> &p) {
    os << '(' << p.first << ',' << p.second << ')';
    return os;
}
template <class T> ostream &operator<<(ostream &os, const vector<T> &v) {
    os << '{';
    for(int i = 0; i < (int)v.size(); i++) {
        if(i) { os << ','; }
        os << v[i];
    }
    os << '}';
    return os;
}
void debugg() { cerr << endl; }
template <class T, class... Args>
void debugg(const T &x, const Args &... args) {
    cerr << " " << x;
    debugg(args...);
}
#define debug(...)                                                             \
    cerr << __LINE__ << " [" << #__VA_ARGS__ << "]: ", debugg(__VA_ARGS__)
#define dump(x) cerr << __LINE__ << " " << #x << " = " << (x) << endl
#else
#define debug(...) (void(0))
#define dump(x) (void(0))
#endif
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<char> vc;
typedef vector<string> vs;
typedef vector<bool> vb;
typedef vector<double> vd;
typedef pair<ll,ll> P;
typedef pair<int,int> pii;
typedef vector<P> vpl;
typedef tuple<ll,ll,ll> tapu;
#define rep(i,n) for(int i=0; i<(n); i++)
#define REP(i,a,b) for(int i=(a); i<(b); i++)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
const int inf = 1<<30;
const ll linf = 1LL<<62;
const int MAX = 510000;
ll dy[8] = {0,-1,0,1,1,-1,-1,1};
ll dx[8] = {-1,0,1,0,1,-1,1,-1};
const double pi = acos(-1);
const double eps = 1e-7;
template<typename T1,typename T2> inline bool chmin(T1 &a,T2 b){
	if(a>b){
		a = b; return true;
	}
	else return false;
}
template<typename T1,typename T2> inline bool chmax(T1 &a,T2 b){
	if(a<b){
		a = b; return true;
	}
	else return false;
}
template<typename T> inline void print(T &a){
    int sz = a.size();
    for(auto itr = a.begin(); itr != a.end(); itr++){
		cout << *itr;
        sz--;
        if(sz) cout << " ";
	}
    cout << "\n";
}
template<typename T1,typename T2> inline void print2(T1 a, T2 b){
	cout << a << " " << b << "\n";
}
template<typename T1,typename T2,typename T3> inline void print3(T1 a, T2 b, T3 c){
	cout << a << " " << b << " " << c << "\n";
}
void mark() {cout << "#" << "\n";}
ll pcount(ll x) {return __builtin_popcountll(x);}
const int mod = 1e9 + 7;
//const int mod = 998244353;

int main(){
    int n,m; cin >> n >> m;
    vector<vpl> G(n);
    rep(i,m){
        int u,v,c; cin >> u >> v >> c; u--; v--; c--;
        G[u].emplace_back(v,c);
        G[v].emplace_back(u,c);
    }
    vl ans(n,-1);
    auto dfs = [&](auto &&dfs, int u) -> void{
        for(auto v : G[u]){
            if(ans[v.first] != -1) continue;
            if(ans[u] == v.second) ans[v.first] = (v.second+1) % n;
            else ans[v.first] = v.second;
            dfs(dfs,v.first);
            //cout << v.second << "\n";
        }
    };
    ans[0] = 0;
    dfs(dfs,0);
    rep(i,n) cout << ans[i]+1 << "\n";
}

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

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

    vector<pair<int, int> > g[n];
    int ans[n];
    ans[0] = 1;

    for(int i = 0; i<m; i++){
        int u, v, c;
        cin >> u >> v >> c;

        g[u - 1].push_back({v - 1, c});
        g[v - 1].push_back({u - 1, c});
    }

    vector<pair<int, int> > dfs;
    int vis[n];
    fill(vis, vis + n, 0);
    vis[0] = 1;
    dfs.push_back({0, 1});

    while(!dfs.empty()){
        auto x = dfs.back();
        dfs.pop_back();

        for(auto to: g[x.first]){
            if(vis[to.first] == 0){
                vis[to.first] = 1;
                dfs.push_back(to);

                if(ans[x.first] == to.second){
                    if(ans[x.first] == 1) ans[to.first] = 2;
                    else ans[to.first] = 1;
                }

                else ans[to.first] = to.second;
            }
        }
    }

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

}


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

#define fo(i, x, y) for (int i = (x); i <= (y); ++i)
#define fd(i, x, y) for (int i = (x); i >= (y); --i)

typedef long long ll;

ll n;
ll f[100];
vector<int> ans;

int getint()
{
	char ch;
	int res = 0, p;
	while (!isdigit(ch = getchar()) && (ch ^ '-'));
	p = ch == '-'? ch = getchar(), -1 : 1;
	while (isdigit(ch))
		res = (res << 3) + (res << 1) + (ch ^ 48), ch = getchar();
	return res * p;
}

int main()
{
	//freopen("t.in", "w", stdout);
	cin >> n;
	ll s = 86;
	f[0] = f[1] = 1;
	fo(i, 2, s) f[i] = f[i - 1] + f[i - 2];
	fo(i, 0, s)
	{
		if (i > 0)
		{
			if (i & 1) ans.push_back(4);
			else ans.push_back(3);
		}
		if (f[s - i] > n) continue;
		n -= f[s - i];
		if (i & 1) ans.push_back(2);
		else ans.push_back(1);
	}
	printf("%d\n", ans.size());
	fo(i, 0, (int)ans.size() - 1) printf("%d\n", ans[i]);
	//cerr << "#" << n << endl;
	return 0;
}

#include <algorithm>
#include <iostream>
#include <vector>
#include <map>
#include <cstdio>
#include <string>
#include <cmath>
#include <queue>
#include <tuple>
#include <bitset>
#include <cassert>
#include <chrono>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <random>
#include <set>
#include <stack>
#include <time.h>
#include <unordered_map>
#include <unordered_set>

//#include <bits/stdc++.h>
#define maxs(x,y) x = max(x,y)
#define mins(x,y) x = min(x,y)
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define repr(i, n) for (int i = (n) - 1; i >= 0; i--)
#define FOR(i,i0,n) for(int (i)=(i0);(i)<(n);(i)++)
#define FORR(i,i0,n) for(int (i)=(n)-1; (i)>=(i0);(i)--)
#define SORT(x) sort(x.begin(),x.end())
#define SORTR(x) sort(x.begin(),x.end(),greater<int>())

#define fi first
#define se second
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define mt make_tuple

using namespace std;
using ll = long long;
using LL = long long;

typedef std::pair<int, int> pii;
typedef std::pair<int, double> pid;
typedef std::vector<int> vi;
typedef std::vector<pii> vii;

const double PI = 3.14159265358979323846264338327950L;
const int mod = 1e9+7;

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

  // for prime mod
  mint inv() const {
    return pow(mod-2);
  }
  mint& operator/=(const mint a) {
    return (*this) *= a.inv();
  }
  mint operator/(const mint a) const {
    mint res(*this);
    return res/=a;
  }
};

const ll INF = 1LL<<60;

struct container {
    int bottom, top, id;
    container(int id, int bottom, int top) : top(top), bottom(bottom), id(id) {
    }
};

struct Edge {
    ll to, from, cost;
    Edge(ll to, ll from, ll cost) :to(to), from(from), cost(cost) {}
    Edge(): to(-1), from(-1), cost(0){}
};

struct Data {
    ll cost,val;
    Data(ll cost=0, ll val=0) : cost(cost), val(val){}
    bool operator<(const Data& a) const {
        return cost > a.cost;
    }
};

struct edge{
    int a,b,c;
    edge(int a = -1,int b = -1, int c = -1):a(a),b(b),c(c){}
    bool operator<(const edge& a) const {
        return c > a.c;
    }
};

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];
  }
};

void solve(){
    int a,b,c,d;
    cin >> a >> b >> c >> d;
    cout << b-c;

}

int main() {
    int T = 1;
    // cin >> T;

    while (T--) {
        solve();
        // cout << endl;
    }
}


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

int a[4];

int main() {
	cin>>a[1]>>a[2]>>a[3];
	sort(a+1,a+4);
	if(a[2]-a[1]==a[3]-a[2]) {
		puts("Yes");
	} else {
		puts("No");
	}
	return 0;
}


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

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

char ss1[512345], ss2[512345];
char s1[512345], s2[512345];

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

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

int n;
std::string s, t;
std::vector<int> a, b;

int main() {
    std::ios::sync_with_stdio(false), std::cin.tie(nullptr);
    std::cin >> n >> s >> t;
    for (int i = 0; i < s.length(); ++i)
        if (s[i] == '0')
            a.push_back(i);
    for (int i = 0; i < t.length(); ++i)
        if (t[i] == '0')
            b.push_back(i);
    if (a.size() != b.size()) return std::cout << "-1\n", 0;
    int ans = 0;
    for (int i = 0; i < a.size(); ++i)
        if (a[i] != b[i])
            ++ans;
    std::cout << ans << '\n';
    return 0;
}


//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<int,int>;
using PL = pair<ll,ll>;
using PPL = pair<pair<ll,ll>,ll>;
#define INF 1000000000
#define rep(i, s, n) for (int i = (int)(s); i < (int)(n); i++)
#define repp(i, n, s) for (int i = (int)(n); i >= (int)(s); i--)
#define mp make_pair
#define tp make_tuple
#define ALL(vec) vec.begin(), vec.end()

long long modinv(long long a, long long m) {
    long long b = m, u = 1, v = 0;
    while (b) {
        long long t = a / b;
        a -= t * b; swap(a, b);
        u -= t * v; swap(u, v);
    }
    u %= m;
    if (u < 0) u += m;
    return u;
}
int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll INFLL = numeric_limits<ll>::max();
    ll t;cin>>t;
    rep(_,0,t){
        ll x,y,p,q;cin>>x>>y>>p>>q;
        ll mod1 = (2*x+2*y)%(p+q);
        ll ans = INFLL;

        rep(i,x,x+y){
            if (mod1==0 && p<=i%(p+q) && i%(p+q) <p+q){
                ans = min(ans, (ll)i);
                continue;
            }
            rep(j,p,p+q){
                ll num = i%(p+q);
                ll num2 = j%(p+q);
                ll num3 = (num2-num+p+q)%(p+q);

                ll d = __gcd(__gcd((ll)num3,mod1),p+q);
                ll mod3 = mod1 / d;
                num3/=d;
                ll mod2 = (p+q)/d;
                if (__gcd(mod3,mod2)==1){
                    ll a1 = modinv(mod3, mod2);
                    ans = min(ans, (a1*num3)%mod2*(2*x+2*y)+i);
                }
            }
        }
        if (ans==INFLL){
            cout<<"infinity"<<endl;
            continue;
        }
        cout<<ans<<endl;
    }
}

/**
 * author : cuber_coder
 * created : 09/05/2021 19:43:08
 **/
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define endl "\n"

void Solve() {
    int k, n, m;
    cin >> k >> n >> m;
    vector<int> a(k);
    for (auto &i : a) {
        cin >> i;
    }
    set<pair<long double, int>> b;
    for (int i = 0; i < k; i++) {
        long double val = 1.0 * a[i] * m / n;
        a[i] = (a[i] * m) / n;
        b.insert({val - a[i], i});
    }
    m -= accumulate(begin(a), end(a), 0LL);
    for (int i = 0; i < m; i++) {
        int idx = (*b.rbegin()).second;
        b.erase(*b.rbegin());
        a[idx] += 1;
    }
    for (auto i : a) cout << i << " ";
}

int32_t main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    int testcases = 1;
    // cin >> testcases;

    for (int i = 1; i <= testcases; i++) {
        Solve();
    }
    return 0;
}


#include <bits/stdc++.h>
#define ar array

using namespace std;

const int mxN = 2e5;
vector<int> kids[mxN], starts[mxN], inTs[mxN];
int inT[mxN], outT[mxN];

void dfs(int &T, int cur, int d) {
  inTs[d].push_back(T);
  inT[cur] = T++;
  for (int nxt : kids[cur])
    dfs(T, nxt, d+1);
  outT[cur] = T++;
}

int main() {
  cin.tie(0)->sync_with_stdio(0);

  int n; cin >> n;
  for (int i = 1; i < n; ++i) {
    int j; cin >> j; --j;
    kids[j].push_back(i);
  }

  { int T = 0; dfs(T, 0, 0); }

  int q; cin >> q;

  for (int qq = 0; qq < q; ++qq) {
    int i, d; cin >> i >> d; --i;

    auto lo = lower_bound(inTs[d].begin(), inTs[d].end(), inT[i]);
    auto hi = upper_bound(inTs[d].begin(), inTs[d].end(), outT[i]);

    cout << hi-lo << '\n';
  }

}

#include <cstdio>
#include <vector>
#include <iostream>
#include <map>
using namespace std;
const int M = 200005;
#define pii pair<int,int>
#define make make_pair
int read()
{
	int x=0,f=1;char c;
	while((c=getchar())<'0' || c>'9') {if(c=='-') f=-1;}
	while(c>='0' && c<='9') {x=(x<<3)+(x<<1)+(c^48);c=getchar();}
	return x*f;
}
int n,m,tot,f[M],dep[M],ans[M];map<int,int> mp[M];
struct edge
{
    int v,next;
}e[2*M];vector<pii> v[M];
void dfs(int u,int fa)
{
    dep[u]=dep[fa]+1;
    mp[u][dep[u]-1]=1;
    for(int i=f[u];i;i=e[i].next)
    {
        int v=e[i].v;
        if(v==fa) continue;
        dfs(v,u);
        if(mp[u].size()<=mp[v].size()) swap(mp[u],mp[v]);
        map<int,int>::iterator it=mp[v].begin();
        for(;it!=mp[v].end();it++)
            mp[u][(*it).first]+=(*it).second;
    }
    for(int i=0;i<v[u].size();i++)
        ans[v[u][i].second]=mp[u][v[u][i].first];
}
signed main()
{
    n=read();
    for(int i=2;i<=n;i++)
    {
        int j=read();
        e[++tot]=edge{i,f[j]},f[j]=tot;
        e[++tot]=edge{j,f[i]},f[i]=tot;
    }
    m=read();
    for(int i=1;i<=m;i++)
    {
        int u=read(),d=read();
        v[u].push_back(make(d,i));
    }
    dfs(1,0);
    for(int i=1;i<=m;i++)
        printf("%d\n",ans[i]);
}


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

long long inversion_number(vector<int> &A){
    int N = A.size();
    vector<int> B = A;
    sort(B.begin(), B.end());
    map<int, int> mp;
    for (int i = 0; i < N; i++) mp[B[i]] = i + 1;
    for (int i = 0; i < N; i++) A[i] = mp[A[i]];
    long long ans = 0;
    vector<int> BIT(N + 1, 0);
    for (int i = 0; i < N; i++){
        ans += i; int j;
        j = A[i]; while (j > 0){ ans -= BIT[j]; j -= j & -j; }
        j = A[i]; while (j <= N){ BIT[j]++; j += j & -j; }
    }
    return ans;
}

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

    int N; cin >> N;
    vector<int> a(N);
    rep(i,N) cin >> a[i];
    auto b = a;
    ll ans = inversion_number(b);
    cout << endl;
    rep(i,N){
        cout << ans << endl;
        ans = ans + N - 1 - a[i] - a[i];
    }
}

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

#define REP(i,n) for(ll i=0;i<(ll)n;i++)
#define dump(x)  cerr << "Line " << __LINE__ << ": " <<  #x << " = " << (x) << "\n";
#define spa << " " <<
#define fi first
#define se second
#define ALL(a)  (a).begin(),(a).end()
#define ALLR(a)  (a).rbegin(),(a).rend()

using ld = long double;
using ll = long long;
using ull = unsigned long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using pdd = pair<ld, ld>;

template<typename T> using V = vector<T>;
template<typename T> using P = pair<T, T>;
template<typename T> vector<T> make_vec(size_t n, T a) { return vector<T>(n, a); }
template<typename... Ts> auto make_vec(size_t n, Ts... ts) { return vector<decltype(make_vec(ts...))>(n, make_vec(ts...)); }
template<class S, class T> ostream& operator << (ostream& os, const pair<S, T> v){os << "(" << v.first << ", " << v.second << ")"; return os;}
template<typename T> ostream& operator<<(ostream &os, const vector<T> &v) { for (auto &e : v) os << e << ' '; return os; }
template<class T> ostream& operator<<(ostream& os, const vector<vector<T>> &v){ for(auto &e : v){os << e << "\n";} return os;}
struct fast_ios { fast_ios(){ cin.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(20); }; } fast_ios_;

template <class T> void UNIQUE(vector<T> &x) {sort(ALL(x));x.erase(unique(ALL(x)), x.end());}
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; }
void fail() { cout << -1 << '\n'; exit(0); }
inline int popcount(const int x) { return __builtin_popcount(x); }
inline int popcount(const ll x) { return __builtin_popcountll(x); }
template<typename T> void debug(vector<vector<T>>&v,ll h,ll w){for(ll i=0;i<h;i++)
{cerr<<v[i][0];for(ll j=1;j<w;j++)cerr spa v[i][j];cerr<<"\n";}};
template<typename T> void debug(vector<T>&v,ll n){if(n!=0)cerr<<v[0];
for(ll i=1;i<n;i++)cerr spa v[i];
cerr<<"\n";};

const ll INF = (1ll<<62);
// const ld EPS   = 1e-10;
// const ld PI    = acos(-1.0);
const ll mod = (int)1e9 + 7;
//const ll mod = 998244353;

int main(){

    ll N;
    cin >> N;
    V<ll> C(N);
    REP(i, N) cin >> C[i];
    V<ll> A(N-1), B(N-1);
    REP(i, N-1) cin >> A[i] >> B[i], A[i]--, B[i]--;

    using Graph = V<V<ll>>;
    Graph G(N);
    REP(i, N-1){
        G[A[i]].push_back(B[i]);
        G[B[i]].push_back(A[i]);
    }

    V<ll> used(202020, 0);
    V<ll> res;

    auto dfs = [&](auto self, ll now, ll par)->void{
        if(used[C[now]] == 0) res.push_back(now);
        used[C[now]]++;
        for(auto next: G[now]){
            if(next == par) continue;
            self(self, next, now);
        }
        used[C[now]]--;
    };

    dfs(dfs, 0, -1);

    sort(ALL(res));

    for(auto x: res) cout << x+1 << endl;

    return 0;
}


#include<bits/stdc++.h>
using namespace std;
typedef unsigned long long int ll;
const int MOD = 1000000007;

void solve(){
	int n,m;
	cin>>n>>m;
	int **arr = new int*[n];
	int s = INT_MAX;
	for(int i=0;i<n;i++){
		arr[i] = new int[m]();
		for(int j=0;j<m;j++){
			cin>>arr[i][j];
			s = min(s,arr[i][j]);
		}
	}
	int ans = 0;
	for(int i=0;i<n;i++){
		for(int j=0;j<m;j++){
			ans = ans + (abs(arr[i][j]-s));
		}
	}
	cout<<ans<<endl;
	return;
}

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

#include <algorithm>
#include <bitset>
#include <cmath>
#include <complex>
#include <cstdio>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <sys/types.h>
#include <unistd.h>
#include <vector>

#pragma region macros
#define _overload(_1, _2, _3, name, ...) name
#define _rep(i, n) _range(i, 0, n)
#define _range(i, a, b) for (int i = int(a); i < int(b); ++i)
#define rep(...) _overload(__VA_ARGS__, _range, _rep, )(__VA_ARGS__)
#define _rrep(i, n) _rrange(i, n, 0)
#define _rrange(i, a, b) for (int i = int(a) - 1; i >= int(b); --i)
#define rrep(...) _overload(__VA_ARGS__, _rrange, _rrep, )(__VA_ARGS__)
#pragma endregion macros

using namespace std;

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

using ll    = long long;
using R     = long double;
const R EPS = 1e-9L;  // [-1000,1000]->EPS=1e-8 [-10000,10000]->EPS=1e-7
inline int sgn(const R &r) {
    return (r > EPS) - (r < -EPS);
}
inline R sq(R x) {
    return sqrt(max(x, 0.0L));
}

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

const pid_t pid = getpid();
// Problem Specific Parameter:

using edge = struct { int to; };
using G    = vector<vector<edge>>;

vector<int> bfs(const G &graph, int s, int inf) {
    const int n = graph.size();
    vector<int> dist(n, inf);

    queue<int> q;
    dist[s] = 0, q.push(s);

    while (!q.empty()) {
        int v = q.front();
        q.pop();
        for (auto &e: graph[v]) {
            int nc = dist[v] + 1, nv = e.to;
            if (chmin(dist[nv], nc))
                q.push(nv);
        }
    }
    return dist;
}
int dp[1 << 17][17];

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

    G graph(n);

    rep(i, m) {
        int a, b;
        cin >> a >> b;
        graph[a - 1].push_back({b - 1});
        graph[b - 1].push_back({a - 1});
    }

    int k;
    cin >> k;
    vector<int> c(k);
    rep(i, k) {
        cin >> c[i];
        c[i]--;
    }

    const int inf = 1 << 25;
    int cost[20][20];

    rep(i, k) {
        const int src    = c[i];
        vector<int> dist = bfs(graph, src, inf);
        rep(j, k) {
            cost[i][j] = dist[c[j]];
        }
    }

    rep(mask, 1 << k) rep(i, k) {
        dp[mask][i] = inf;
    }

    rep(i, k) {
        dp[1 << i][i] = 0;
    }

    rep(mask, 1 << k) rep(i, k) {
        if ((mask >> i) & 1) {
            rep(j, k) {
                if ((mask >> j) & 1) {
                    continue;
                }
                const int nmask = mask | (1 << j);
                chmin(dp[nmask][j], dp[mask][i] + cost[i][j]);
            }
        }
    }

    int ans = inf;
    rep(i, k) {
        chmin(ans, dp[(1 << k) - 1][i] + 1);
    }

    if (ans == inf) {
        ans = -1;
    }

    cout << ans << endl;

    return 0;
}


#line 2 "/home/defineprogram/Desktop/Library/template/template.cpp"
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define rep(i, n) for (int i = 0; i < n; i++)
#define REP(i, n) for (int i = 1; i < n; i++)
#define rev(i, n) for (int i = n - 1; i >= 0; i--)
#define REV(i, n) for (int i = n - 1; i > 0; i--)
#define all(v) v.begin(), v.end()
#define PL pair<ll, ll>
#define PI pair<int,int>
#define len(s) (int)s.size()

template <class T, class U>
inline bool chmin(T &a, U b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template <class T, class U>
inline bool chmax(T &a, U b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
constexpr ll inf = 3e18;
#line 3 "/home/defineprogram/Desktop/Library/structure/UnionFind.cpp"

class UnionFind {
    int N;
    vector<int> par, siz;

   public:
    int find(int x) {
        assert(x < N);
        return (par[x] == x ? x : par[x] = find(par[x]));
    }
    void merge(int x, int y) {
        assert(x < N && y < N);
        x = find(x);
        y = find(y);
        if (x == y) return;
        if (siz[x] > siz[y]) swap(x, y);
        par[x] = y;
        siz[y] += siz[x];
    }
    bool same(int x, int y) {
        return find(x) == find(y);
    }
    int size(int x) {
        return siz[find(x)];
    }
    UnionFind(int N) : N(N), siz(N, 1), par(N) {
        iota(all(par), 0);
    }
};

/*
@brief Union Find
@docs docs/UnionFind.md
*/
#line 3 "main.cpp"

int H,W;
int main() {
    cin.tie(0); ios::sync_with_stdio(false);
    cin>>H>>W;
    UnionFind uf(H+W);
    uf.merge(0,H-1);
    uf.merge(0,H);
    uf.merge(0,H+W-1);
    rep(i,H)rep(j,W){
        char c; cin>>c;
        if(c=='#')uf.merge(i,j+H);
    }
    set<int>ans1,ans2;
    rep(i,H){
        ans1.insert(uf.find(i));
    }
    rep(i,W){
        ans2.insert(uf.find(i+H));
    }
    cout<<min(len(ans1),len(ans2))-1<<"\n";
}

#include <bits/stdc++.h>
//#include <atcoder/all>
#define endl "\n"
using namespace std;
typedef long long ll;
typedef pair<ll, ll> l_l;
typedef pair<int, int> i_i;
template<class T>
inline bool chmax(T &a, T b) {
    if(a < b) {
        a = b;
        return true;
    }
    return false;
}

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

const long long INF = 1e18;
//const ll mod = 1000000007;
ll N;
ll A[301000];
ll B[301000];
struct SegmentTree {
private:
    int n;
    vector<ll> node;

public:
    SegmentTree() {
        int sz = 201000;
        n = 1; while(n < sz) n *= 2;
        node.resize(2*n-1, 0);
        for(int i=0; i<sz; i++) node[i+n-1] = 0;
        for(int i=n-2; i>=0; i--) node[i] = (node[2*i+1] + node[2*i+2]);
    }

    void update(int x, int val) {
        x += (n - 1);
        node[x] = val;
        while(x > 0) {
            x = (x - 1) / 2;
            node[x] = (node[2*x+1] +node[2*x+2]);
        }
    }
    // hannkaikukann
    ll getsum(int a, int b, int k=0, int l=0, int r=-1) {
        if(r < 0) r = n;
        if(r <= a || b <= l) return 0;
        if(a <= l && r <= b) return node[k];

        ll vl = getsum(a, b, 2*k+1, l, (l+r)/2);
        ll vr = getsum(a, b, 2*k+2, (l+r)/2, r);
        return (vl + vr);
    }
};

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cin >> N;
    map<ll, vector<ll>> mpA, mpB;
    for(int i = 0; i < N; i++) {
        cin >> A[i];
        mpA[A[i]+i].push_back(i);
    }
    for(int i = 0; i < N; i++) {
        cin >> B[i];
        mpB[B[i]+i].push_back(i);
    }
    vector<ll> p(N);
    for(auto tmp : mpA) {
        auto v = tmp.second;
        auto u = mpB[tmp.first];
        if(v.size() != u.size()) {
            cout << "-1" << endl;
            return 0;
        }
        for(int i = 0; i < u.size(); i++) {
            p[u[i]] = v[i];
        }
    }
    ll ans = 0;
    SegmentTree seg;
    for(auto val : p) {
        ans += seg.getsum(val, N);
        seg.update(val, 1);
    }
    cout << ans << endl;
    return 0;
}


#include <bits/stdc++.h>
#define REP(i, s, n) for (int i = s; i < (int)(n); i++)
#define ALL(a) a.begin(), a.end()
#define MOD 1000000007
using namespace std;
using ll = long long;

int main() {
    int N, Q; cin >> N;
    vector<int> A(N), T(N);
    REP(i, 0, N) cin >> A[i] >> T[i];

    cin >> Q;
    vector<ll> X(Q);
    REP(i, 0, Q) cin >> X[i];

    set<ll> S;
    REP(i, 0, Q) S.insert(X[i]);

    ll offset = 0;
    REP(i, 0, N) {
        if (T[i] == 1) {
            offset += A[i];
        } else if (T[i] == 2) {
            auto itr = S.lower_bound(A[i] - offset);

            bool deleted = false;
            auto jtr = S.begin();
            while (jtr != itr) {
                jtr = S.erase(jtr);
                deleted = true;
            }
            if (deleted) {
                S.insert(A[i] - offset);
            }
        } else {
            auto itr = S.lower_bound(A[i] - offset);

            bool deleted = false;
            while (itr != S.end()) {
                itr = S.erase(itr);
                deleted = true;
            }
            if (deleted) {
                S.insert(A[i] - offset);
            }
        }
    }
    // for (auto x : S) cout << x << " ";
    // cout << endl;

    REP(i, 0, Q) {
        auto itr = S.lower_bound(X[i]);
        if (itr != S.begin() && (itr == S.end() || *itr > X[i])) itr = prev(itr);
        // cout << "# i : " << i << ", X[i] : " << X[i] << ", itr : " << *itr << endl;
        cout << *itr + offset << endl;
    }
    return 0;
}

#include <bits/stdc++.h>

#define int long long

using namespace std;

signed main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    int n;
    cin >> n;
    int a[n], t[n];
    for (int i = 0; i < n; i++) cin >> a[i] >> t[i];
    int q;
    cin >> q;
    int x[q];
    for (int i = 0; i < q; i++) cin >> x[i];
    int lazy = 0;
    int lo = -1e17, hi = 1e17;
    for (int i = 0; i < n; i++) {
        if (t[i] == 1) lazy += a[i];
        else if (t[i] == 2) lo = max(lo, a[i]-lazy);
        else hi = min(hi, a[i]-lazy);
    }
    int loVal = lo;
    int hiVal = hi;
    for (int i = 0; i < n; i++) {
        if (t[i] == 1) {
            loVal += a[i];
            hiVal += a[i];
        }
        if (t[i] == 2) {
            loVal = max(loVal, a[i]);
            hiVal = max(hiVal, a[i]);
        }
        if (t[i] == 3) {
            loVal = min(loVal, a[i]);
            hiVal = min(hiVal, a[i]);
        }
    }
    for (int i = 0; i < q; i++) {
        if (x[i] <= lo) cout << loVal << '\n';
        else if (x[i] >= hi) cout << hiVal << '\n';
        else cout << x[i]+lazy << '\n';
    }
    cout << '\n';
}
/*

*/


// Created by ash_98

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

#define mx 200005
#define ll long long
#define mod 1000000007

int ar[mx];
char ch[mx];
int n,m,ii,k;

pair<ll,int> chk(vector<ll>c,vector<ll>b,int bat)
{
    vector<ll>a;
    int sz=c.size();
    for(int i=0;i<sz;i++)
    {
        if(i!=bat)a.push_back(c[i]);
    }
    int sz1=a.size();
    int sz2=b.size();
    ll re=1e18;
    int id=-1;
    for(int i=0;i<sz1;i++)
    {
        int be=0,en=sz2-1;
        int shuru=-1;
        while(be<=en)
        {
            int mid=(be+en)/2;
            if(b[mid]<a[i])
            {
                shuru=mid;
                be=mid+1;
            }
            else en=mid-1;
        }
        if((shuru+1)<sz2)
        {
            ll val=abs(a[i]-b[shuru+1]);
            if(val<re)
            {
                re=val;
                id=i;
            }
        }
        if(shuru!=-1)
        {
            ll val=abs(a[i]-b[shuru]);
            if(val<re)
            {
                re=val;
                id=i;
            }
        }

    }

    return {re,id};
}

ll func(vector<ll>a,vector<ll>b,vector<ll>c)
{
    ll re=chk(a,b,-1).first;

    int sz3=c.size();
    if(sz3<2)return re;

    pair<ll,int>re1=chk(c,a,-1);
    pair<ll,int>re2=chk(c,b,re1.second);

    re=min(re,re1.first+re2.first);

    re1=chk(c,b,-1);
    re2=chk(c,a,re1.second);

    re=min(re,re1.first+re2.first);

   return re;

}

void solve()
{
    vector<ll>R,B,G;
    scanf("%d",&n);
    n*=2;
    for(int i=1;i<=n;i++)
    {
        ll x;
        char cc;
        cin>>x>>cc;
        if(cc=='R')R.push_back(x);
        else if(cc=='B')B.push_back(x);
        else G.push_back(x);
    }
    int sz1=R.size();
    int sz2=B.size();
    int sz3=G.size();
    sort(R.begin(),R.end());
    sort(G.begin(),G.end());
    sort(B.begin(),B.end());
    if(sz1%2==0 && sz2%2==0 && sz3%2==0)
    {
        printf("0\n");
        return;
    }
    if(sz1%2==0)
    {
        printf("%lld\n",func(B,G,R));
    }
    else if(sz2%2==0)
    {
        printf("%lld\n",func(G,R,B));
    }
    else
    {
        printf("%lld\n",func(B,R,G));
    }
}

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

#include<bits/stdc++.h>
#define For(a,b,c) for(int a=b;a<=c;++a)
#define Dor(a,b,c) for(int a=b;a>=c;--a)
#define CC(_...) fprintf(stderr,_)
using namespace std;
typedef long long LL;
enum{N=400007};
int n,S[3];
LL ans;
struct O {
LL a; int c;
bool operator < (const O &_) const {
	return a<_.a;
}
}A[N];
int main() {
	scanf("%d",&n);
	For(i,1,n*2) {
		char c[9];
		scanf("%lld%s",&A[i].a,c);
		if(*c=='R') A[i].c=0;
		if(*c=='G') A[i].c=1;
		if(*c=='B') A[i].c=2;
	}
	For(i,1,n*2) ++S[A[i].c];
	LL a=(S[0]&1),b=(S[1]&1),c=(S[2]&1),p,q,ac,bc,ca,cb;
	if(!a&&!b&&!c) {
		puts("0");
		return 0;
	}
	if(a&&b) p=0,q=1;
	if(a&&c) p=0,q=2;
	if(b&&c) p=1,q=2;
	sort(A+1,A+1+n*2);
	a=b=c=-1LL<<59,ac=bc=ca=cb=ans=1LL<<59;
	For(i,1,n*2) {
		if(A[i].c==p) {
			ca=min(ca,A[i].a-c);
			ans=min(ans,A[i].a-b);
			a=A[i].a;
		}
		else if(A[i].c==q) {
			cb=min(cb,A[i].a-c);
			ans=min(ans,A[i].a-a);
			b=A[i].a;
		}
		else {
			ac=min(ac,A[i].a-a);
			bc=min(bc,A[i].a-b);
			c=A[i].a;
		}
	}
	ans=min(ans,min(ca,ac)+min(cb,bc));
	printf("%lld",ans);
	return 0;
}