#include <iostream>
#include <fstream>
#include <cstdlib>
#include <bitset>
#include <map>
#include <iomanip>
#include <string>
#include <vector>
#include <cmath>
#include <queue>
#include <algorithm>
#include <sstream>
#include <unordered_set>

using namespace std;

#define ll long long
#define vecll vector<long long>
#define vec2ll vector<vector<long long>>
#define vecdouble vector<double>
#define vecchar vector<char>
#define vecstr vector<string>
#define vec2str vector<vector<string>>
#define vecbool vector<bool>
#define vec2bool vector<vector<bool>>
#define pairll pair<ll,ll>
#define vecpairll vector<pair<long long,long long>>
#define vec2pairll vector<vector<pair<long long,long long>>>
#define forll(s,a,b) for(long long s = a;s < b;s++)
#define forllde(s,a) for(long long s = a;s > 0;s--)
#define forbit(s,a) for(int s = 0; s < (1 << a); s++)

#define INF 1000000000000
#define Pi 3.1415926535897932384626

ll gcd(ll a, ll b)
{
	if (min(a, b) == 0)
		return max(a, b);

	return gcd(min(a, b), max(a, b) % min(a, b));
}

ll lcm(ll a, ll b)
{
	ll buf = gcd(a, b);

	return abs(a * b) / buf;
}

string toBaseNum(ll n, ll base)
{
	string s;

	while (n > 0)
	{
		s = to_string(n % base) + s;
		n /= base;
	}

	return s;
}

int main() {
	ll n, m,k, ans = 0;
	string s = "No";
	bool flag = false;

	cin >> n;

	vecll a(n);

	forll(i, 0, a.size())
		cin >> a[i];

	vecpairll num(n);

	forll(i, 0, n)
	{
		num[i] = { a[i],1 };

		forll(j, i+1, n)
		{
			if (a[j] < num[i].first)
			{
				ans = max(ans, num[i].first * num[i].second);
				num[i].first = a[j];
			}

			num[i].second++;
		}

		ans = max(ans, num[i].first * num[i].second);
	}

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

#include<bits/stdc++.h>
using namespace std;
int main()
{
	int n,ans=0;
	cin>>n;
	int a[n+1];
	for(int i=1;i<=n;i++)
		cin>>a[i];

	for(int l=1;l<=n;l++)
	{
		int x=a[l];
		for(int r=l;r<=n;r++){
		x=min(x,a[r]);
		ans=max(ans,x*(r-l+1));}
	}
	cout<<ans;
	return 0;
	}


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

#define Mod(x) (x>=P)&&(x-=P)
#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)
#define erep(i,a) for(int i=hd[a];i;i=nxt[i])

typedef long long ll;
void Max(int &x,int y){(x<y)&&(x=y);}
void Min(int &x,int y){(x>y)&&(x=y);}

bool vio;
char IO;
int rd(int res=0){
	bool f=0;
	while(IO=getchar(),IO<48||IO>57)
		f=IO=='-';
	do res=(res<<1)+(res<<3)+(IO^48);
	while(IO=getchar(),isdigit(IO));
	return f?-res:res;
}
const int M=1e6+10;
int nxt[M<<1],to[M<<1],hd[M],ecnt;
void Add(int a,int b){
	nxt[++ecnt]=hd[a],to[hd[a]=ecnt]=b;
}
int Mx,tp,bot,L[M],R[M],n;
void dfs(int x,int f,int d){
	static int tot;
	if(d>Mx)tp=x,Mx=d;
	L[x]=++tot;
	erep(i,x){
		int y=to[i];
		if(y==f)continue;
		dfs(y,x,d+1);
	}
	R[x]=tot;
}
bool FA(int a,int b){
	return L[a]<=L[b]&&L[b]<=R[a];
}
int nw=1,ans[M];
void redfs(int x,int f){
	ans[x]=nw;
	erep(i,x){
		int y=to[i];
		if(y==f||FA(y,tp))continue;
		nw++,redfs(y,x);
	}
	erep(i,x){
		int y=to[i];
		if(y!=f&&FA(y,tp))nw++,redfs(y,x);
	}
	nw++;
}
bool let;
int main(){
	cerr<<(&vio-&let)/1024.0/1024<<endl;
	rep(i,2,n=rd()){
		int a=rd(),b=rd();
		Add(a,b),Add(b,a);
	}
	Mx=0,dfs(1,0,0);
	bot=tp,Mx=0,dfs(tp,0,0);
	ans[1]=1;
	redfs(bot,0);
	rep(i,1,n)printf("%d ",ans[i]);
}

#include <iostream>
#include <iomanip>
#include <fstream>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <climits>
#include <algorithm>
#include <numeric>
#include <utility>
#include <random>
#include <chrono>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>

using namespace std;

using LL = long long;
using ULL = unsigned long long;
using PII = pair<int, int>;
using PIL = pair<int, LL>;
using PLL = pair<LL, LL>;
// const int mod = 1e9 + 7;
// const int mod = 998244353;

inline void quickread() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
}

int n, x, y;
vector<vector<int>> edges;
int p = 0, pdist = 0;
bool path[200010];
int ans[200010];
int val = 1;

void dfs(int u, int fa, int dist) {
    if (dist > pdist) {
        p = u;
        pdist = dist;
    }
    for (int v: edges[u]) {
        if (v != fa) {
            dfs(v, u, dist + 1);
        }
    }
}

bool dfs2(int u, int fa) {
    if (u == p) {
        return path[u] = true;
    }
    for (int v: edges[u]) {
        if (v != fa) {
            dfs2(v, u);
            path[u] |= path[v];
        }
    }
    return path[u];
}

void dfs3(int u, int fa) {
    ans[u] = val;
    for (int v: edges[u]) {
        if (v != fa && !path[v]) {
            ++val;
            dfs3(v, u);
            ++val;
        }
    }
    for (int v: edges[u]) {
        if (v != fa && path[v]) {
            ++val;
            dfs3(v, u);
        }
    }
}

inline void work() {
    cin >> n;
    edges.resize(n + 1);
    for (int i = 1; i < n; ++i) {
        cin >> x >> y;
        edges[x].push_back(y);
        edges[y].push_back(x);
    }

    // u-v is the diameter
    dfs(1, 0, 0);
    int u = p;
    pdist = 0;
    dfs(p, 0, 0);
    int v = p;
    dfs2(u, 0);
    dfs3(u, 0);

    for (int i = 1; i <= n; ++i) {
        cout << ans[i] << "\n";
    }
}

int main() {
    // freopen("input.txt", "r", stdin);
    quickread();
    work();
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using uint = unsigned int;
#define rep(i,n) for(int i=0;i<int(n);i++)
#define rep1(i,n) for(int i=1;i<=int(n);i++)
#define per(i,n) for(int i=int(n)-1;i>=0;i--)
#define per1(i,n) for(int i=int(n);i>0;i--)
#define all(c) c.begin(),c.end()
#define si(x) int(x.size())
#define pb emplace_back
#define fs first
#define sc second
template<class T> using V = vector<T>;
template<class T> using VV = vector<vector<T>>;
template<class T,class U> void chmax(T& x, U y){if(x<y) x=y;}
template<class T,class U> void chmin(T& x, U y){if(y<x) x=y;}
template<class T> void mkuni(V<T>& v){sort(all(v));v.erase(unique(all(v)),v.end());}
template<class T> int lwb(const V<T>& v, const T& a){return lower_bound(all(v),a) - v.begin();}
template<class S,class T> ostream& operator<<(ostream& o,const pair<S,T> &p){
	return o<<"("<<p.fs<<","<<p.sc<<")";
}
template<class T> ostream& operator<<(ostream& o,const vector<T> &vc){
	o<<"{";
	for(const T& v:vc) o<<v<<",";
	o<<"}";
	return o;
}
constexpr ll TEN(int n) { return (n == 0) ? 1 : 10 * TEN(n-1); }

#ifdef LOCAL
#define show(x) cerr << "LINE" << __LINE__ << " : " << #x << " = " << (x) << endl
void dmpr(ostream& os){os<<endl;}
template<class T,class... Args>
void dmpr(ostream&os,const T&t,const Args&... args){
	os<<t<<" ~ ";
	dmpr(os,args...);
}
#define shows(...) cerr << "LINE" << __LINE__ << " : ";dmpr(cerr,##__VA_ARGS__)
#define dump(x) cerr << "LINE" << __LINE__ << " : " << #x << " = {";  \
	for(auto v: x) cerr << v << ","; cerr << "}" << endl;
#else
#define show(x) void(0)
#define dump(x) void(0)
#define shows(...) void(0)
#endif

struct BIT{
	using D = int;
	int N;
	vector<D> bit;
	BIT(int n){		//nは区間幅!!!
		N=n;
		bit.assign(n+1,0);
	}
	BIT(){}
	void init(int n){
		N=n;
		bit.assign(n+1,0);
	}
	D sum(int i){		//i個の和a[0]+..a[i-1]
		D s=0;
		while(i>0){
			s+=bit[i];
			i-=(i&-i);
		}
		return s;
	}
	D val(int i){	//return a[i]	(0-ind)
		return sum(i+1)-sum(i);
	}
	void add(int i,D x){	//a[i]+=x (0-indexed)
		i++;
		while(i<=N){
			bit[i]+=x;
			i+=(i&-i);
		}
	}
};

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);		//DON'T USE scanf/printf/puts !!
	cout << fixed << setprecision(20);

	auto f = [&](int H,int W,VV<int> x2ys,VV<int> y2xs){
		V<int> res(H);
		y2xs[0].pb(H);
		rep(i,y2xs[0][0]){
			res[i] = (x2ys[i].empty() ? W : x2ys[i][0]);
		}
		return res;
	};
	int H,W,N; cin >> H >> W >> N;
	VV<int> x2ys(H),y2xs(W);
	rep(i,N){
		int x,y;cin>>x>>y;x--,y--;
		x2ys[x].pb(y);y2xs[y].pb(x);
	}
	rep(i,H) sort(all(x2ys[i]));
	rep(i,W) sort(all(y2xs[i]));

	auto a = f(H,W,x2ys,y2xs);
	auto b = f(W,H,y2xs,x2ys);
	show(a);show(b);
	VV<int> h2bs(H);
	rep(i,W){
		if(b[i]) h2bs[b[i]-1].pb(i);
	}
	ll ans = 0;

	BIT bit(W);
	per(i,H){
		for(int j: h2bs[i]) bit.add(j,1);
		ans += a[i] + bit.sum(W) - bit.sum(a[i]);
	}
	cout << ans << endl;
}

#include <bits/stdc++.h>
using namespace std;
//#include <atcoder/all>
//using namespace atcoder;
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define rep1(i,n) for (int i = 1; i <= (n); ++i)
#define bit(n,k) ((n>>k)&1) //nのk　bit目
#define vec(T) vector<T>
#define vvec(T) vector<vector<T>>
using ll = long long;
using P = pair<int,int>;

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const ll llINF = 1LL << 60;
const int iINF = 1e9;

//---20210207---------------------------------------------
struct Solver{

    struct path{
        int to,cost;
        path(int to=0, int cost=0):to(to),cost(cost){}
    };

    void solve(){
        int N,M;
        cin >> N>>M;

        vvec(path) r(N);
        vec(int) selfr(N,iINF);
        rep(i,M){
            int a,b,c;
            cin >> a >> b >> c;
            a--;b--;
            if(a==b) chmin(selfr[a],c);
            else r[a].emplace_back(b,c);
        }

        vvec(int) d(N,vec(int)(N,iINF));
        rep(st,N){
            d[st][st]=0;
            priority_queue<P,vector<P>,greater<P>> q;
            q.emplace(0,st);

            while(q.size()){
                int c0 = q.top().first;
                int now = q.top().second;
                q.pop();
                if(d[st][now]<c0) continue;
                for(path t:r[now]){
                    int c1 = c0+t.cost;
                    if( d[st][t.to] <= c1 ) continue;
                    d[st][t.to] = c1;
                    q.emplace(c1, t.to);
                }
            }
        }

        rep(st,N){
            int ans = selfr[st];
            rep(gl,N){
                if(st==gl) continue;
                chmin(ans, d[st][gl]+d[gl][st] );
            }
            if(ans==iINF) ans = -1;
            cout << ans << endl;
        }

    }
};

int main(){
    int testcasenum=1;
    //cin >> testcasenum;
    rep1(ti,testcasenum){
        Solver solver;
        solver.solve();
    }
    return 0;
}

//---20210206------------------------------------------
/*

struct Solver{

    struct path{
        int to,c;
        path(int to=0, int c=0):to(to),c(c){}
    };

    vvec(path) r = vvec(path)(2021);
    vec(int) used = vec(int)(2021);

    int res;
    int start;
    void dfs(int now, int c){
        for(auto t:r[now]){
            if(used[t.to]) continue;
            if(t.to==start){
                chmin(res,c+t.c);
                continue;
            }
            used[t.to]=1;
            dfs(t.to, c+t.c);
        }
        used[now]=0;
        return;
    }

    void solve(){
        int N,M;
        cin >> N>>M;
        rep(i,M){
            int a,b,c;
            cin >> a >> b >> c;
            r[a].emplace_back(b,c);
        }

        rep1(st,N){
            rep(i,2021) used[i]=0;
            res = iINF;
            start = st;
            dfs(st,0);
            if(res==iINF) cout << -1 << endl;
            else cout << res << endl;
        }
    }

};

int main(){
    int testcasenum=1;
    //cin >> testcasenum;
    rep1(ti,testcasenum){
        Solver solver;
        solver.solve();
    }
    return 0;
}
*/


#include<bits/stdc++.h>
using namespace std;
const int N=1E5+5;
typedef long long ll;
int n,m;
ll a[N],ans[N];
struct hzy{int id;long long x;}q[N];
bool mycmp(hzy a,hzy b){return a.x<b.x;}
int main(){
	scanf("%d%d",&n,&m);
	for(int i=1;i<=n;i++){
		scanf("%lld",&a[i]);
	}
	for(int i=1;i<=m;i++){
		scanf("%lld",&q[i].x);
		q[i].id=i;
	}
	sort(q+1,q+m+1,mycmp);
	int t=0;
	for(int i=1;i<=m;i++){
		q[i].x+=t;
		while(t<n&&q[i].x>=a[t+1]){
			t++;
			q[i].x++;
		}
		ans[q[i].id]=q[i].x;
	}
	for(int i=1;i<=m;i++)printf("%lld\n",ans[i]);
}

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

#define FASTIO	ios_base::sync_with_stdio(false),cin.tie(NULL),cout.tie(NULL)
#define ll long long
#define mset(A,val) memset(A,val,sizeof(A))
#define fi(a,b) for(int i=a;i<=b;++i)
#define fj(a,b) for(int j=a;j<=b;++j)
#define all(x) x.begin(),x.end()
#define vi vector<int>
#define pii pair<int,int>
#define int long long

// ---------------------------------------------------------------------------
const int mod = 1e9+7;
const int maxn = 2e5 + 9;

// ---------------------------------------------------------------------------

// ---------------------------------------------------------------------------
void test_case(int tc)
{
	// cout<<"Case #"<<tc<<": ";
	int n,w;cin>>n>>w;
    int hash[maxn+100];
    mset(hash,0);
    fi(1,n){
        int l,r,c;cin>>l>>r>>c;
        l++,r++;
        hash[r]-=c;
        hash[l]+=c;
    }

    fi(1,n+9){
        hash[i]+=hash[i-1];
        if(hash[i]>w){
            cout<<"No";
            return;
        }
    }
    cout<<"Yes";
}

int32_t main()
{
	FASTIO;
	#ifndef ONLINE_JUDGE
		freopen("input.txt","r",stdin);
		freopen("output.txt","w",stdout);
	#endif

	int t=1;
	//cin>>t;
	for(int tc=1;tc<=t;++tc)test_case(tc);
}


// #pragma GCC target("avx,avx2,fma")
// #pragma GCC optimization ("Ofast")
// #pragma GCC optimization ("unroll-loops")
#include <bits/stdc++.h>

using namespace std;
// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp>
// using namespace __gnu_pbds;
// template <typename T>
// using o_set = tree <T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
// #define sfind(i) find_by_order(i)
// #define ord(i) order_of_key(i)
typedef long long ll;
typedef pair<int , int> pii;
typedef pair<ll, ll> pll;
typedef vector<pii> vii;
typedef vector<pll> vll;
using cd = complex<double>;
const double pi = acos(-1);
#define mod 1000000007
#define rep(i, a, b) for(ll i = a; i < b; i++)
#define repc(i, a, b, c) for (ll i = a; (c > 0 ? i < b : i > b) and c != 0; i += c)
#define vi vector<int>
#define vl vector<ll>
#define _max(vec) (*max_element(all(vec)))
#define _min(vec) (*min_element(all(vec)))
#define fi first
#define si second
#define pb push_back
#define all(name) name.begin(), name.end()
#define ral(name) name.rbegin(), name.rend()
#define fact(n) rep(i, 1, n+1)ft.pb((ft[i-1]*i)%mod)
#define mod_in(a) power(a, mod - 2)
#define ncr(n, r) (n>=r?((ft[n]*mod_in((ft[r]*ft[(n)-(r)])%mod))%mod):0LL)
#define deb(x) cerr << "[" << #x << " " << x << "]" << endl;
#define endl '\n'  //....????
#define int ll
vector<ll> ft(1, 1LL);

/*======================================================================*/
void solve(){
    int x, y, a, b, ans = 0;
    cin >> x >> y >> a >> b;
    while(x < (y/a + (y%a!=0)) and b > (a-1)*x)x *= a, ans++;
    ans += (y-x-1)/b;
    cout << ans;
}
signed main() {
	cin.sync_with_stdio(0); cin.tie(0);
	cin.exceptions(cin.failbit);
    int t = 1;
    // cin >> t;
    while(t--){
        solve();
    }
}

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

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

constexpr int INF = 1e9;
constexpr ll INFL = 1LL<<61;
constexpr ll mod = 1e9+7;

int main(){
  ll X, Y, A, B;
  cin >> X >> Y >> A >> B;
  Y--;
  ll ans = 0;
  for(ll i = 0; i < 65; i++){
    ll diff = Y - X;
    if(diff < 0) break;
    ll ex = i + diff / B;
    ans = max(ans, ex);
    ll before = X;
    X *= A;
    if(X <= 0) break;
    if(Y < X) break;
    if(X / A != before) break;
    if(X / before != A) break;
  }
  cout << ans << endl;
  return 0;
}


#include <bits/stdc++.h>
using namespace std;
// type alias
typedef long long LL;
typedef pair<int,int> II;
typedef tuple<int,int,int> III;
typedef vector<int> VI;
typedef vector<string> VS;
typedef unordered_map<int,int> MAPII;
typedef unordered_set<int> SETI;
template<class T> using VV=vector<vector<T>>;
// minmax
template<class T> inline T SMIN(T& a, const T b) { return a=(a>b)?b:a; }
template<class T> inline T SMAX(T& a, const T b) { return a=(a<b)?b:a; }
// repetition
#define FORE(i,a,b) for(int i=(a);i<=(b);++i)
#define REPE(i,n)  for(int i=0;i<=(n);++i)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  for(int i=0;i<(n);++i)
#define FORR(x,arr) for(auto& x:arr)
#define SZ(a) int((a).size())
// collection
#define ALL(c) (c).begin(),(c).end()
// DP
#define MINUS(dp) memset(dp, -1, sizeof(dp))
#define ZERO(dp) memset(dp, 0, sizeof(dp))
// stdout
#define println(args...) fprintf(stdout, ##args),putchar('\n');
// debug cerr
template<class Iter> void __kumaerrc(Iter begin, Iter end) { for(; begin!=end; ++begin) { cerr<<*begin<<','; } cerr<<endl; }
void __kumaerr(istream_iterator<string> it) { (void)it; cerr<<endl; }
template<typename T, typename... Args> void __kumaerr(istream_iterator<string> it, T a, Args... args) { cerr<<*it<<"="<<a<<", ",__kumaerr(++it, args...); }
template<typename S, typename T> std::ostream& operator<<(std::ostream& _os, const std::pair<S,T>& _p) { return _os<<"{"<<_p.first<<','<<_p.second<<"}"; }
#define __KUMATRACE__ true
#ifdef __KUMATRACE__
#define dump(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); __kumaerr(_it, args); }
#define dumpc(ar) { cerr<<#ar<<": "; FORR(x,(ar)) { cerr << x << ','; } cerr << endl; }
#define dumpC(beg,end) { cerr<<"~"<<#end<<": "; __kumaerrc(beg,end); }
#else
#define dump(args...)
#define dumpc(ar)
#define dumpC(beg,end)
#endif

// $ cp-batch FlipDigits | diff FlipDigits.out -
// $ g++ -std=c++14 -Wall -O2 -D_GLIBCXX_DEBUG -fsanitize=address FlipDigits.cpp && ./a.out

/*

 11/15/2020

 7:17-7:30, 8:40-8:55 WA
 10:00 WA
 11:00 give up

 */

string S,T;
int N;

void nope() {
  cout<<-1<<endl;
  exit(0);
}
void solve() {
  VI ss,ts;
  REP(i,N) {
    if(S[i]=='1') ss.push_back(i);
    if(T[i]=='1') ts.push_back(i);
  }

  //dumpc(ss);
  //dumpc(ts);

  if(SZ(ts)>SZ(ss)) nope();

  LL res=0;

  int i=0;
  FORR(ti,ts) {
    if(i==SZ(ss)) nope();
    //dump(i,ss[i],ti,res);
    while(ss[i]<ti) {
      if(i+1>=SZ(ss)) nope();
      res+=ss[i+1]-ss[i],i+=2;
    }
    if(i==SZ(ss)) nope();
    assert(ss[i]>=ti);
    res+=ss[i]-ti,i+=1;
  }
  if((SZ(ss)-i)%2) nope();
  while(i<SZ(ss)) {
    res+=ss[i+1]-ss[i],i+=2;
  }

  cout<<res<<endl;
}

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

  cin>>N>>S>>T;
  solve();

  return 0;
}

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

#define rep(i,n) for(int i = 0; i<n; ++i)
#define REP(i,n) for(int i = 1; i<=n; ++i)
#define all(x) begin(x),end(x)
#define show(obj) for(auto x:obj)cout<<x<<' ';cout<<endl;
typedef long long ll;
typedef pair<int,int> P;
typedef pair<ll,ll> lp;
typedef pair<double, double> FP;
const int inf = 1001001000;
const ll INF = 1LL<<60;
const int MOD = (int)1e9 + 7;

void update(int id, int asp);

struct d1{
    int x, y, r;
};
struct d2{
    int a, b, c, d;
};

const int EDGE = 10000;
const double tlimit = 3.0000;
int n;
vector<d1> req(200);
vector<d2> ans(200);
vector<vector<bool>> nap(10000, vector<bool>(10000, false));

int main(){
    clock_t stime = clock();
    random_device seed;
    mt19937_64 gen(seed());
    cin >> n;

    rep(i,n){
        cin >> req[i].x >> req[i].y >> req[i].r;
        ans[i].a = req[i].x;
        ans[i].b = req[i].y;
        ans[i].c = req[i].x + 1;
        ans[i].d = req[i].y + 1;
        nap[req[i].x][req[i].y] = true;
    }

    while(((clock() - stime) / CLOCKS_PER_SEC) <= tlimit){
        int id = gen() % n;
        int asp = gen() % 4;
        update(id, asp);
    }

    rep(i,n)printf("%d %d %d %d\n", ans[i].a, ans[i].b, ans[i].c, ans[i].d);

    return 0;
}

void update(int id, int asp){
    int a = ans[id].a;
    int b = ans[id].b;
    int c = ans[id].c;
    int d = ans[id].d;
    bool ok = true;

    switch(asp) {
        case 0:
            if(a == 0)break;
            for(int p = b; p < d; ++p)if(nap[a-1][p])ok = false;
            if(ok){
                for(int p = b; p < d; ++p)nap[a-1][p] = true;
                ans[id].a--;
            }
            break;
        case 1:
            if(b == 0)break;
            for(int p = a; p < c; ++p)if(nap[p][b-1])ok = false;
            if(ok){
                for(int p = a; p < c; ++p)nap[p][b-1] = true;
                ans[id].b--;
            }
            break;
        case 2:
            if(c == EDGE)break;
            for(int p = b; p < d; ++p)if(nap[c][p])ok = false;
            if(ok){
                for(int p = b; p < d; ++p)nap[c][p] = true;
                ans[id].c++;
            }
            break;
        case 3:
            if(d == EDGE)break;
            for(int p = a; p < c; ++p)if(nap[p][d])ok = false;
            if(ok){
                for(int p = a; p < c; ++p)nap[p][d] = true;
                ans[id].d++;
            }
            break;
    }
}


#include <bits/stdc++.h>
#define f first
#define s second
#define pb push_back
#define pii pair<int, int>
#define endl '\n'
#define vi vector<int>
#define vvi vector<vi>
#define vl vector<ll>
#define vvl vector<vl>
#define vld vector<ld>
#define pii pair<int, int>
#define pll pair<ll, ll>
#define vpii vector<pii>
#define vvpii vector<vpii>
#define vpll vector<pll>
#define rep(s, l, r) for (int s = l; s < r; s++)
#define per(s, r, l) for (int s = r - 1; s >= l; s--)
#define all(x) x.begin(), x.end()
typedef long long ll;
typedef long double ld;
using namespace std;
template<class T> using minheap = priority_queue<T, vector<T>, greater<T>>;
template<typename T> void setmax(T& a, T b) { a = max(a, b); };
template<typename T> void setmin(T& a, T b) { a = min(a, b); };
template<typename T> bool in(T lo, T v, T hi) { return lo <= v && v <= hi; };

template<ll MOD>
struct ModInt {
  ll x = 0;
  ModInt() { x = 0; }
  ModInt(ll _x) {
    x = _x;
    if (x >= MOD || x <= -MOD) x %= MOD;
    if (x < 0) x += MOD;
  }
  friend ModInt operator+(ModInt a, ModInt b) {
    return ModInt(a.x + b.x);
  }
  friend ModInt operator-(ModInt a, ModInt b) {
    return ModInt(a.x - b.x);
  }
  friend ModInt operator*(ModInt a, ModInt b) {
    return ModInt(a.x * b.x);
  }
  friend ModInt operator/(ModInt a, ModInt b) {
    return a * inv(b);
  }
  friend ModInt power(ModInt a, ll b) {
    if (b == 0) return 1;
    ModInt c = power(a, b / 2);
    return c * c * ((b & 1) ? a : 1);
  }
  friend ModInt inv(ModInt a) {
    // this only works for nonzero elements
    return power(a, MOD - 2);
  }
  friend ostream& operator<<(ostream &os, const ModInt a) {
    os << a.x;
    return os;
  }
};

using mint = ModInt<1000000007>;
using vm = vector<mint>;
using vvm = vector<vm>;

struct Solution {
  vl get(vl x) {
    int n = x.size();
    vl res(1 << n);
    rep(mask, 0, (1 << n)) {
      rep(i, 0, n) if (mask >> i & 1) res[mask] += x[i];
    }
    sort(all(res));
    res.resize(unique(all(res)) - res.begin());
    return res;
  }
  void solve() {
    int n;
    cin >> n;
    ll t;
    cin >> t;
    vl a(n);
    rep(i, 0, n) cin >> a[i];
    if (n == 1) {
      int res = a[0] < t ? a[0] : 0;
      cout << res << endl;
      return;
    }
    int h = n / 2;
    vl x, y;
    rep(i, 0, n) {
      if (i < h) x.pb(a[i]);
      else y.pb(a[i]);
    }
    vl u = get(x);
    vl v = get(y);
    sort(all(u));
    sort(all(v));
    ll best = 0;
    for (ll tt : u) {
      if (tt > t) break;
      setmax(best, tt);
      ll rem = t - tt;
      auto it = upper_bound(all(v), rem);
      --it;
      setmax(best, tt + *it);
    }
    for (ll tt : v) if (tt <= t) setmax(best, tt);
    cout << best << endl;
  }
};

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

  int t = 1;
  while (t--) {
    Solution s;
    s.solve();
  }

  return 0;
}

#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define endl '\n'
#define sz(v) (int)v.size()
#define all(v) v.begin(), v.end()
void dbg_out() { cerr << "\b\b]\n"; }
template<typename Head, typename... Tail> void dbg_out(Head H, Tail... T){ cerr << H << ", "; dbg_out(T...);}
#define watch(...) cerr << "[" << #__VA_ARGS__ << "]: [", dbg_out(__VA_ARGS__)

/****************************** CODE IS HERE ***********************************/

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

    int n, m; cin >> n >> m;
    vector <int> A(n);
    for (int &i: A) cin >> i;
    int k1 = (n + 1) / 2, k2 = n / 2;

    vector <ll> X, Y;
    for (int i = 0; i < (1 << k1); ++i) {
        ll sum = 0;
        for (int j = 0; j < k1; ++j) {
            if (i >> j & 1) {
                sum += A[j];
            }
        }
        if (sum <= m) {
            X.push_back(sum);
        }
    }

    for (int i = 0; i < (1 << k2); ++i) {
        ll sum = 0;
        for (int j = 0; j < k2; ++j) {
            if (i >> j & 1) {
                sum += A[j + k1];
            }
        }
        if (sum <= m) {
            Y.push_back(sum);
        }
    }

    sort(all(Y));

    ll ans = 0;

    for (ll i: X) {
        int pos = lower_bound(all(Y), m - i) - Y.begin();
        if (pos >= sz(Y) or Y[pos] + i > m) pos--;
        ans = max(ans, i + Y[pos]);

    }

    cout << ans;

    return 0;
}

/*

--------- Meet in the middle Technique ---------------
Like brute force but here we divide the original array into two parts and apply the brute forces individually and merge them.

*/


//YashS
#include <bits/stdc++.h>
using namespace std;
#define test              int T;cin>>T;while(T--)
#define int               long long
#define pb                push_back
#define all(x)            (x).begin(),(x).end()
#define sz(x)             (int)((x).size())
#define fr                first
#define sc                second
#define minf              LONG_LONG_MIN
#define inf              LONG_LONG_MAX
#define pii               pair<int,int>
#define rep(i,a,b)        for(int i=a;i<b;i++)
#define mem1(x, arr)           memset((arr),x,sizeof((arr))
#define pVec(v)           for(auto e:v)cout<<e<<" ";cout<<"\n"
const int MOD = 1e9 + 7;
const int N = 1e5 + 7;

void init_code() {
#ifndef ONLINE_JUDGE
	freopen("inputf.txt", "r", stdin);
	freopen("outputf.txt", "w", stdout);
#endif // ONLINE_JUDGE
}
void yash()
{
	int n;
	cin >> n;
	vector<int> a(n), b(n), c(n), freq(n + 1);
	for (int &x : a)cin >> x;
	for (int &x : b)cin >> x;
	for (int &x : c) {cin >> x; x = b[x - 1]; freq[x]++;}
	int ans = 0;
	for (int x : a)ans += freq[x];
	cout << ans << "\n";

}

signed main()
{
	init_code();
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	//test
	yash();
	return 0;
}

#include <bits/stdc++.h>
// #include <atcoder/all>
// #include "icld.cpp"
using namespace std;
using ll = long long int;
using pii = pair<int,int>;
using vi = vector<int>;
using vll = vector<ll>;
using vvi = vector<vector<int>>;
using ss = string;
using db = double;
const int dx[4] = {1,0,-1,0};
const int dy[4] = {0,1,0,-1};
//#define pi 3.14159265358979
#define rep(i,s,n) for(int i=(s);i<(int)(n);i++)
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
#define ci(x) cin >> x
#define cii(x) int x;cin >> x
#define cci(x,y) int x,y;cin >> x >> y
#define co(x) cout << x << endl

int main(){
  cci(h,w);
  cci(n,m);

  vvi v(h+2,vi(w+2,-1));
  rep(i,1,h+1)rep(j,1,w+1)v[i][j]=0;

  vector<pii> el(n);
  rep(i,0,n){
    cci(x,y);
    el[i]=make_pair(x,y);
  }
  rep(i,0,m){
    cci(x,y);
    v[x][y]=-1;
  }

  vvi vx=v,vy=v;
  rep(i,0,n){
    int x,y;
    tie(x,y)=el[i];
    int nx=x,ny=y;
    while(v[--nx][y]!=-1);
    while(v[x][--ny]!=-1);
    vx[nx+1][y]=1;
    vy[x][ny+1]=1;
  }

  rep(i,1,h+1){
    int now=0;
    rep(j,1,w+1){
      int y=vy[i][j];
      if(y==1)now=1;
      else if(y==-1)now=0;
      if(now)v[i][j]=1;
    }
  }
  rep(i,1,w+1){
    int now=0;
    rep(j,1,h+1){
      int x=vx[j][i];
      if(x==1)now=1;
      else if(x==-1)now=0;
      if(now)v[j][i]=1;
    }
  }

  int ans=0;
  rep(i,1,h+1)rep(j,1,w+1)ans+=(v[i][j]==1);
  co(ans);
}


#include <iostream>

using namespace std;

int main()
{

    long long n, k;

    cin >> n >> k;

    for(int i=1; i<=k; ++i)
    {
        if(n%200 == 0)
            n/=200;

        else
        {
            n *= 1000;
            n += 200;
        }
    }

    cout << n << endl;

    return 0;
}

#include<bits/stdc++.h>
#define ll long long
#define ld long double
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define REP(i,j) for(int i=0;i<j;i++)
#define REPA(i,j) for(int i=1;i<=j;i++)
#define FORN(i,j,k) for(int i=j;i<k;i++)
#define vi vector<int>
#define vvi vector<vi >
#define pii pair<int,int>
#define vpii vector<pii >
#define all(a) a.begin(),a.end()
using namespace std;
const int INF=1<<30;
//const ll INF=1ll<<60;
const ll MOD=1e9+7;
inline void read(int &x){
//	short neg=1;
	x=0;
	char c=getchar();
	/*while(c<'0'||c>'9'){
		if(c=='-')neg=-1;
		c=getchar();
	}*/
	while(c>='0'&&c<='9'){
		x=(x<<3)+(x<<1)+(c^48),c=getchar();
	}
//	x*=neg;
}
ll quick_mod(ll A,ll B){//A^B
    ll ret=1;
    A%=MOD;
    while(B)
    {
        if(B&1)ret=ret*A%MOD;
        B>>=1;
        A=A*A%MOD;
    }
    return ret;
}
ll N;
int k;
int main(void){
	cin>>N;
	cin>>k;
	while(k--){
		if(N%200==0){
			N/=200;
		}
		else{
			N=N*1000+200;
		}
	}
	cout<<N;
	return 0;
}


#include <bits/stdc++.h>
#define ll long long
using namespace std;
const int maxn=2e5+10;
map<int,int>ma;
int n,x[maxn],b[205];
int main () {
	cin>>n;
	ll ans=0;
	for(int i=0;i<200;i++) b[i]=0;
	for(int i=0;i<n;i++) {
		cin>>x[i];
		int tmp=x[i]%200;
		ans+=b[tmp];
		b[tmp]++;
	}
	cout<<ans<<endl;

}

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

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

template <typename T> constexpr int inof(const T x) {
    return static_cast<int>(x);
}
template <typename T> constexpr ll llof(const T x) {
    return static_cast<ll>(x);
}
template <typename T> constexpr double doof(const T x) {
    return static_cast<double>(x);
}

template <typename T> constexpr int sz(const T &xs) { return inof(xs.size()); }

ll pairs_num(const vi &xs) {
    vi fs(200, 0);
    ll ans = 0;

    for (const int x : xs) {
        ans += fs[x % 200];
        ++fs[x % 200];
    }

    return ans;
}

int main() {
    cin.tie(0)->sync_with_stdio(0);
    cin.exceptions(cin.failbit);
    cout << setprecision(9) << fixed;

    int n;
    cin >> n;

    vi xs(n);
    for (auto &x : xs) cin >> x;

    cout << pairs_num(xs) << '\n';

    return 0;
}


#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <iomanip>
#include <cstdio>
#include <set>
#include <map>
#include <list>
#include <cstdlib>
#include <queue>
#include <stack>
#include <bitset>

using namespace std;

#define MOD 1000000007
#define PI 3.1415926535897932
#define INF 1e9
#define rep(i, n) for (int i = 0; i < n; i++)
#define repe(i, j, n) for (int i = j; i < n; i++)
#define repi(i, n) for (int i = 0; i <= n; i++)
#define repie(i, j, n) for (int i = j; i <= n; i++)
#define all(x) x.begin(), x.end()
#define println() cout << endl
#define P pair<int, int>
#define fi first
#define se second
typedef long long ll;
using Graph = vector<vector<ll>>;

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

ll dp[2000][2000];
ll nCr(ll n, ll r)
{
       if(n==r) return dp[n][r] = 1;
       if(r==0) return dp[n][r] = 1;
       if(r==1) return dp[n][r] = n%MOD;
       if(dp[n][r]) return dp[n][r]%MOD;
       return dp[n][r] = nCr(n-1,r)%MOD + nCr(n-1,r-1)%MOD;
}

ll H(ll n, ll r) {
    return nCr(n+r-1, r)%MOD;
}

int prime[10000000];
bool is_prime[100000000 + 1];

int sieve(int n) {
    int pcnt = 0;
    for(int i = 0; i <= n; i++) {
        is_prime[i] = true;
    }

    is_prime[0] = is_prime[1] = false;
    for(int i = 2; i <= n; i++) {
        if(is_prime[i]) {
            prime[pcnt++] = i;
            for(int j = 2*i; j <= n; j += i) {
                is_prime[j] = false;
            }
        }
    }

    return pcnt;
}

struct UnionFind {
	//自身が親であれば、その集合に属する頂点数に-1を掛けたもの
	//そうでなければ親のid
	vector<ll> r;
	UnionFind(ll N) {
		r = vector<ll>(N, -1);
	}
	ll root(ll x) {
		if (r[x] < 0) return x;
		return r[x] = root(r[x]);
	}
	bool unite(ll x, ll y) {
		x = root(x);
		y = root(y);
		if (x == y) return false;
		if (r[x] > r[y]) swap(x, y);
		r[x] += r[y];
		r[y] = x;
		return true;
	}
	ll size(ll x) {
		return -r[root(x)];
	}

    bool same(ll x, ll y) { // 2つのデータx, yが属する木が同じならtrueを返す
        ll rx = root(x);
        ll ry = root(y);
        return rx == ry;
    }
};
template< typename T >
struct BinaryIndexedTree {
  vector< T > data;

  BinaryIndexedTree(int sz) {
    data.assign(++sz, 0);
  }

  T sum(int k) {
    T ret = 0;
    for(++k; k > 0; k -= k & -k) ret += data[k];
    return (ret);
  }

  void add(int k, T x) {
    for(++k; k < data.size(); k += k & -k) data[k] += x;
  }
};

void solve1() {
    int n; cin >> n;
    BinaryIndexedTree<ll> f_tree(n+1);
    vector<int> a(n);

    rep(i, n) {
        cin >> a[i];
    }

    ll ans = 0;
    for (int j = 0; j < n; j++) {
        ans += j - f_tree.sum(a[j]);
        f_tree.add(a[j], 1);
    }

    for(int i = 0; i < n; i++) {
        cout << ans << endl;
        ans += n - 1-2*a[i];
    }
}

int main()
{
    solve1();
}

#include<bits/stdc++.h>
using namespace std;
const int N=3e5+5;
int n,a[N],tr[N];
long long ans;
void add(int x)
{
	for (;x<=n;x+=x&-x) tr[x]++;
}
int get(int x)
{
	int l=0;
	for (;x;x-=x&-x) l+=tr[x];
	return l;
}
int main()
{
	scanf("%d",&n);
	for (int i=1;i<=n;i++)
	{
		scanf("%d",&a[i]);
		a[i]++;
		ans+=i-1-get(a[i]);
		add(a[i]);
	}
	printf("%lld\n",ans);
	for (int i=1;i<n;i++)
	{
		ans+=n-2*a[i]+1;
		printf("%lld\n",ans);
	}
	return 0;
}


#include <stdio.h>
long long  p = 998244353;
long long n, m;
long long d[5001];
long long r[5001];
long long inv[5001];
void makeinv(void) {
	long long arraynumber = sizeof inv / sizeof inv[0];
	inv[1] = 1;
	for (int invcount = 2; invcount < arraynumber; invcount++) {
		inv[invcount] = p - inv[p % invcount] * (p / invcount) % p;
	}
}
int main() {
	makeinv();
	scanf("%lld%lld", &n, &m);
	d[1] = m;
	for (int i = 0; i <= 5000; i++)r[i] = 1;
	for (long long i = 2; i <= n; i++) {
		d[i] = d[i - 1] * m % p;
		for (long long j = 0; j <= 5000; j++)r[j] = r[j] * j % p;
		for (long long j = 1; j <= m; j++) {
			d[i] += p - ((r[m] - r[m - j]) * inv[j]) % p;
		}
		d[i] += r[m] * m;
		d[i] %= p;
	}
	printf("%lld\n", d[n]);
}


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

string X;
ll M;

bool solve(ll mid) {
   ll res = 0;
   ll multiply = 1;
   for(ll i = X.length() - 1; i >= 0; i--) {
       ll x = (X.at(i) - '0');
       if(multiply > (1e18 / x)) {
           return false;
       }
       if(res > 1e18 - x * multiply) {
           return false;
       }
       res += x * multiply;
       if(i != 0) {
           if(multiply > 1e18 / mid) {
               return false;
           }
           multiply *= mid;
       }
   }
   return (res <= M);
}

int main() {
    cin >> X;
    cin >> M;
    if(X.length() == 1) {
        ll num = X.at(0) - '0';
        if(num <= M) {
           cout << 1 << endl;
           return 0;
        }
        cout << 0 << endl;
        return 0;
    }
    ll d = 0;
    for(const char &c : X) {
        d = max(d, (ll)(c - '0'));
    }
    ll ok = d;
    ll ng = (long double)(1e18) + 1;
    while(abs(ok - ng) > 1) {
        ll mid = (ok + ng) / 2;
        if(solve(mid)) {
            ok = mid;
        } else {
            ng = mid;
        }
    }
    cout << ok - d << endl;
    return 0;
}

#include<bits/stdc++.h>
using namespace std;
#define int long long
signed main()
{
	int s,p,i;
	cin>>s>>p;
	for(i=1;i*i<=p;i++)
		if(i*(s-i)==p)
		{
			cout<<"Yes";
			return 0;
		}
	cout<<"No";
	return 0;
}


/*input
3
aba

*/
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
typedef tree<long long,null_type,less_equal<long long>,rb_tree_tag,tree_order_statistics_node_update> indexed_set;
#pragma GCC optimize("O2","unroll-loops","no-stack-protector")
//order_of_key #of elements less than x
// find_by_order kth element
using ll=long long;
using ld=long double;
using pii=pair<ld,ld>;
#define f first
#define s second
#define pb push_back
#define REP(i,n) for(ll i=0;i<n;i++)
#define REP1(i,n) for(ll i=1;i<=n;i++)
#define FILL(n,x) memset(n,x,sizeof(n))
#define ALL(_a) _a.begin(),_a.end()
#define sz(x) (int)x.size()
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()),c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
const ll INF64=1e18+1;
const int INF=0x3f3f3f3f;
const ll MOD=1e9+7;
const ld PI=acos(-1);
const ld eps=1e-3;
#define lowb(x) x&(-x)
#define MNTO(x,y) x=min(x,(__typeof__(x))y)
#define MXTO(x,y) x=max(x,(__typeof__(x))y)
inline ll mult(ll a,ll b){
    if(a>=MOD) a%=MOD;
    if(b>=MOD) b%=MOD;
    return (a*b)%MOD;
}
inline ll mypow(ll a,ll b){
    if(b<=0) return 1;
    ll res=1LL;
    while(b){
        if(b&1) res=mult(res,a);
        a=mult(a,a);
        b>>=1;
    }
    return res;
}
const int maxn=1e4+5;
const int maxlg=__lg(maxn)+2;
int32_t main(){
    ios::sync_with_stdio(false),cin.tie(0);
    int n;
    string s;
    cin>>n>>s;
    if(s[0]!=s[n-1]) cout<<1;
    else{
        REP(i,n-1){
            if(s[i]!=s[0] and s[i+1]!=s[0]){
                cout<<2;
                return 0;
            }
        }
        cout<<-1;
    }
}

#include<bits/stdc++.h>

int main(){
    using namespace std;
    unsigned long N;
    cin >> N;
    string S;
    cin >> S;
    if(S[0] != S.back())return 0 & puts("1");
    for(unsigned long i{1}; i < N; ++i)if(S[0] != S[i - 1] && S[i] != S.back())return 0 & puts("2");
    puts("-1");
    return 0;
}


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

#define ll long long
#define endl "\n"
#define sz(a) (ll)a.size()
#define deb(x) cerr<<#x<<' '<<x<<endl;
const long long mod = 1000000007;

void _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()
{
   ll n, k, q = 0, c = 0;
   string s;
   cin >> n;
   ll i = 0;
   while (++i)
      if (stoll(to_string(i) + to_string(i)) > n)
         return void(cout << i - 1);

}

int main()
{
   ios_base::sync_with_stdio(false);
   cin.tie(NULL);
   cout.tie(NULL);
   int t = 1;
   // cin >> t;         // Test Case :-||-: //
   // factorial();
   // SOE();
   while (t--)
   {
      _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();
   }
   return 0;
}

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

int main(){
 	int n;
  cin>>n;
  bool flag=true;
  int i;
  unordered_map<int,int>dic;
	REP(i,0,n){
    	int ele;
      cin>>ele;
      if(ele>=1&&ele<=n){
        if(dic[ele]>=1)
          flag=false;
        dic[ele]++;
      }
      else flag=false;
    }
  string ans="Yes";
  if(!flag)ans="No";
  cout<<ans<<endl;

  return 0;
}


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

int gcd(int a,int b) {return b==0?a:gcd(b,a%b);}
const int maxn = 1000005;
int prime[maxn],np[maxn],mu[maxn],tot=0;
void init(int n) {
   np[1]=mu[1]=1;
   for(int i=2;i<=n;++i) {
       if(!np[i]) prime[++tot]=i,mu[i]=-1;
       for(int j=1;j<=tot;++j) {
           if(i*prime[j]>n) break;
           if(i%prime[j]==0) {
               np[i*prime[j]]=1;
               mu[i*prime[j]]=0;
               break;
           }
           np[i*prime[j]]=1;
           mu[i*prime[j]]=-mu[i];
       }
   }
}
int main() {
    int l, r;
    cin >> l >> r;
    init(r);
    auto solve = [&](int a, int b) -> ll {
        // [1, a] [1, b]
        // sum_{d=1}^{max(a,b)} \mu(d) (a/d) * (b/d)
        ll ret = 0;
        for(int d = 1; d <= a; ++d) {
            if(mu[d]) ret += 1ll * mu[d] * (a / d) * (b / d);
        }
        return ret;
    };
    ll ans = 0;
    for(int g = 2; g <= r; ++g) {
        int a = max(2, (l + g - 1) / g), b = r / g;
        if(a > b) break;
        ll tmp = solve(b, b) + solve(a - 1, a - 1) - 2 * solve(a - 1, b);
        // a <= l, r <= b
        // l = r = 1
        ans += tmp / 2 * 2;
    }
    cout << ans << '\n';
}

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

#define ll long long int
#define pb push_back
#define eb emplace_back
#define rep(i , j , n) for(ll i = j ; i < n ; i++)
#define pre(i , j , n) for(ll i = j ; i >= n ; i--)
#define all(x) x.begin(), x.end()
typedef pair<int, int>	pii;
typedef pair<ll, ll>	pl;
typedef vector<int>		vi;
typedef vector<ll>		vll;
typedef vector<double>	vd;
typedef vector<bool>	vb;
typedef pair<ll,ll> 	pll;
typedef vector<vector<ll>> vvll;
#define br "\n"
#define ff first
#define ss second
#define debug(a...) cout<<#a<<": ";for(auto it:a)cout<<it<<" ";cout<<endl;
#define MAXIM 1000101
const ll MAX = 2e5 + 1;
ll mod = 1e9 + 7;

ll n;

ll cal(vll &v,ll m){
    ll co = 0;
    ll ans = 0;
    rep(i,0,n){
        co |= v[i];
        if(((1LL<<i)&m)){
            (ans ^= co);
            co = 0;
        }
    }
    (ans ^= co);
    return ans;
}

void solve(){
    cin >> n;
    vll v(n);
    ll ans = 0;
    rep(i,0,n){
        cin >> v[i];
        ans |= v[i];
    }
    rep(i,0,(1<<n)){
        ans = min(cal(v,i),ans);
    }
    cout << ans << br;
}

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

    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    // freopen("output.txt", "w", stdout);
    #endif

    ll t = 1;
    // cin >> t;
    rep(i,0,t){
        // cout << "Case #" << i + 1 << ": ";
        solve();
        // test();
    }
}


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

int main(){
  int x,y;
  cin >> x >> y;

  if(x == y)
    cout << x << endl;
  else
    cout << 3-(x+y) << endl;

  return 0;
}

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

int main()
{
	int x, y;
	cin >> x >> y;
	if (x == y)
		cout << x;
	if (x != y) {
		if (x != 1 && y != 1)

			cout << 1;
		else
		if (x != 2 && y != 2)
			cout << 2;
		else

		if (x != 0 && y != 0)
			cout << 0;
	}
	return 0;
}


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

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

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

int main() {
    int n, m;
    cin >> n >> m;
    vector<int> a(m), b(m);
    for (int i = 0; i < m; ++i) {
        scanf("%d %d", &a[i], &b[i]);
        a[i]--; b[i]--;
    }
    vector<int> c(n);
    for (auto &&i : c) scanf("%d", &i);
    vector<vector<pair<int, int>>> G(n);
    vector<int> ans(m, -1);
    for (int i = 0; i < m; ++i) {
        if(c[a[i]] == c[b[i]]){
            G[a[i]].emplace_back(b[i], 2*i);
            G[b[i]].emplace_back(a[i], 2*i+1);
        }else {
            ans[i] = c[a[i]] < c[b[i]];
        }
    }
    vector<int> used(m);
    vector<int> visited(n), p(n, -1);
    auto dfs = [&](int x, int p, auto &&f) -> void {
        visited[x] = 1;
        for (auto &[y, id] : G[x]) {
            if(p == y || used[id/2]) continue;
            ans[id/2] = id%2;
            used[id/2] = 1;
            if(!visited[y]){
                visited[y] = 1;
                f(y, x, f);
            }

        }
    };
    for (int i = 0; i < n; ++i) {
        if(!visited[i]) dfs(i, -1, dfs);
    }
    for (int i = 0; i < m; ++i) {
        if(!ans[i]) printf("->\n");
        else printf("<-\n");
    }
    return 0;
}

#include <bits/stdc++.h>
using namespace std;
int X[111], Y[111], fa[111];
int ffa(int x) {
  if (x == fa[x]) return x;
  return fa[x] = ffa(fa[x]);
}
void merge(int x, int y) {
  x = ffa(x);
  y = ffa(y);
  fa[x] = y;
}
struct NODE {
  int a, b;
  double d;
  NODE(int a1 = 0, int a2 = 0, double a3 = 0) : a(a1), b(a2), d(a3) {}
  bool operator<(const NODE &P) const {
    return d < P.d;
  }
};
int n;
int main() {
#ifdef LOCAL
  freopen(".a.in", "r", stdin);
#endif
  ios_base::sync_with_stdio(false);
  cout.tie(0);
  cin.tie(0);
  cin >> n;
  for (int i = 0; i < n; ++i) cin >> X[i] >> Y[i];
  int S = n, T = n + 1;
  for (int i = 0; i <= T; ++i) fa[i] = i;
  vector<NODE> F;
  F.emplace_back(S, T, 200);
  for (int i = 0; i < n; ++i) {
    F.emplace_back(i, S, abs(Y[i] - 100));
    F.emplace_back(i, T, abs(Y[i] + 100));
  }
  for (int i = 0; i < n; ++i) {
    for (int j = i + 1; j < n; ++j) {
      F.emplace_back(i, j, sqrt((X[i] - X[j]) * (X[i] - X[j]) + (Y[i] - Y[j]) * (Y[i] - Y[j])));
    }
  }
  sort(F.begin(), F.end());
  for (int i = 0; i < (int)F.size(); ++i) {
    merge(F[i].a, F[i].b);
    if (ffa(S) == ffa(T)) {
      cout << fixed << setprecision(10) << F[i].d / 2.0 << "\n";
      return 0;
    }
  }
  return 0;
}


#include<iostream>
#include<string>
#include<cstdio>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<unordered_set>
#include<utility>
#include<cassert>
#include<complex>
#include<numeric>
#include<array>
using namespace std;

//#define int long long
typedef long long ll;

typedef unsigned long long ul;
typedef unsigned int ui;
constexpr ll mod = 10007;
const ll INF = mod * mod;
typedef pair<int, int>P;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
#define all(v) (v).begin(),(v).end()
typedef pair<ll, ll> LP;
typedef long double ld;
typedef pair<ld, ld> LDP;
const ld eps = 1e-12;
const ld pi = acosl(-1.0);

ll mod_pow(ll x, ll n, ll m = mod) {
	if (n < 0) {
		ll res = mod_pow(x, -n, m);
		return mod_pow(res, m - 2, m);
	}
	if (abs(x) >= m)x %= m;
	if (x < 0)x += m;
	ll res = 1;
	while (n) {
		if (n & 1)res = res * x % m;
		x = x * x % m; n >>= 1;
	}
	return res;
}
struct modint {
	ll n;
	modint() :n(0) { ; }
	modint(ll m) :n(m) {
		if (n >= mod)n %= mod;
		else if (n < 0)n = (n % mod + mod) % mod;
	}
	operator int() { return n; }
};
bool operator==(modint a, modint b) { return a.n == b.n; }
modint operator+=(modint& a, modint b) { a.n += b.n; if (a.n >= mod)a.n -= mod; return a; }
modint operator-=(modint& a, modint b) { a.n -= b.n; if (a.n < 0)a.n += mod; return a; }
modint operator*=(modint& a, modint b) { a.n = ((ll)a.n * b.n) % mod; return a; }
modint operator+(modint a, modint b) { return a += b; }
modint operator-(modint a, modint b) { return a -= b; }
modint operator*(modint a, modint b) { return a *= b; }
modint operator^(modint a, ll n) {
	if (n == 0)return modint(1);
	modint res = (a * a) ^ (n / 2);
	if (n % 2)res = res * a;
	return res;
}

ll inv(ll a, ll p) {
	return (a == 1 ? 1 : (1 - p * inv(p % a, a)) / a + p);
}
modint operator/(modint a, modint b) { return a * modint(inv(b, mod)); }
modint operator/=(modint& a, modint b) { a = a / b; return a; }
const int max_n = 1 << 1;
modint fact[max_n], factinv[max_n];
void init_f() {
	fact[0] = modint(1);
	for (int i = 0; i < max_n - 1; i++) {
		fact[i + 1] = fact[i] * modint(i + 1);
	}
	factinv[max_n - 1] = modint(1) / fact[max_n - 1];
	for (int i = max_n - 2; i >= 0; i--) {
		factinv[i] = factinv[i + 1] * modint(i + 1);
	}
}
modint comb(int a, int b) {
	if (a < 0 || b < 0 || a < b)return 0;
	return fact[a] * factinv[b] * factinv[a - b];
}
modint combP(int a, int b) {
	if (a < 0 || b < 0 || a < b)return 0;
	return fact[a] * factinv[a - b];
}

void solve() {
	int n; cin >> n;
	int ans = (n + 99) / 100;
	cout << ans << "\n";
}

signed main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	//cout << fixed << setprecision(10);
	//init_f();
	//init();
	//expr();
	//int t; cin >> t;rep(i,t)
	//while(cin>>n,n)
	//solve();
	solve();
	return 0;
}


#pragma GCC optimize("-Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2,fma")
#pragma GCC optimize("unroll-loops")
// #include <atcoder/all>
// #include <bits/stdc++.h>
#include <complex>
#include <queue>
#include <set>
#include <unordered_set>
#include <list>
#include <chrono>
#include <random>
#include <iostream>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <map>
#include <unordered_map>
#include <stack>
#include <iomanip>
#include <fstream>

using namespace std;
// using namespace atcoder;

typedef long long ll;
typedef long double ld;
typedef pair<int, int> p32;
typedef pair<ll, ll> p64;
typedef pair<p64, p64> pp64;
typedef pair<double, double> pdd;
typedef vector<ll> v64;
typedef vector<int> v32;
typedef vector<vector<int>> vv32;
typedef vector<vector<ll>> vv64;
typedef vector<vector<p64>> vvp64;
typedef vector<p64> vp64;
typedef vector<p32> vp32;
typedef pair<ll, p64> tp;
ll MOD = 998244353;
double eps = 1e-12;
#define forn(i, e) for (ll i = 0; i < e; i++)
#define forsn(i, s, e) for (ll i = s; i < e; i++)
#define rforn(i, s) for (ll i = s; i >= 0; i--)
#define rforsn(i, s, e) for (ll i = s; i >= e; i--)
#define ln '\n'
#define dbg(x) cout << #x << " = " << x << ln
#define mp make_pair
#define pb push_back
#define fi first
#define se second
#define INF 2e18
#define fast_cin()                    \
    ios_base::sync_with_stdio(false); \
    cin.tie(NULL);                    \
    cout.tie(NULL)
#define all(x) (x).begin(), (x).end()
#define sz(x) ((ll)(x).size())
#define zero ll(0)
#define set_bits(x) __builtin_popcountll(x)
// #define mint modint998244353

ll mpow(ll a, ll b)
{
    if (a == 0)
        return 0;
    if (b == 0)
        return 1;
    ll t1 = mpow(a, b / 2);
    t1 *= t1;
    t1 %= MOD;
    if (b % 2)
        t1 *= a;
    t1 %= MOD;
    return t1;
}

ll mpow(ll a, ll b, ll p)
{
    if (a == 0)
        return 0;
    if (b == 0)
        return 1;
    ll t1 = mpow(a, b / 2, p);
    t1 *= t1;
    t1 %= p;
    if (b % 2)
        t1 *= a;
    t1 %= p;
    return t1;
}

ll modinverse(ll a, ll m)
{
    ll m0 = m;
    ll y = 0, x = 1;
    if (m == 1)
        return 0;
    while (a > 1)
    {
        ll q = a / m;
        ll t = m;
        m = a % m, a = t;
        t = y;
        y = x - q * y;
        x = t;
    }
    if (x < 0)
        x += m0;
    return x;
}

mt19937_64 mt(chrono::steady_clock::now().time_since_epoch().count());

ll range(ll l, ll r)
{
    return l + mt() % (r - l + 1);
}

ll rev(ll v)
{
    return mpow(v, MOD - 2);
}

ll nc2(ll n)
{
    return (n * (n - 1)) / 2;
}

ll ceil(ll p, ll q)
{
    return (p + q - 1) / q;
}

void solve()
{
    int k, n, m;
    cin >> k >> n >> m;
    v64 arr(k + 1);
    v64 ans(k + 1, 0);
    for (int i = 1; i <= k; i++)
    {
        cin >> arr[i];
        ans[i] = arr[i] * m / n;
    }
    m = m % n;
    // v64 f(k + 1);
    // v64 c(k + 1);
    vp64 temp(k + 1);
    ll sum = 0;
    for (int i = 1; i <= k; i++)
    {
        // f[i] = arr[i] * m / n;
        // c[i] = f[i] + 1;
        temp[i] = {(arr[i] * m) % n,
                   i};
        sum += temp[i].fi;
    }
    int cnt = sum / n;
    sort(temp.begin() + 1, temp.end(), greater<p64>());
    for (int i = 1; i <= cnt; i++)
    {
        ans[temp[i].se]++;
    }
    for (int i = 1; i <= k; i++)
    {
        cout << ans[i] << " ";
    }
}

int main()
{
    fast_cin();
    ll t = 1;
    // cin >> t;
    // mint a = 3;
    // cout << (1 - a).val() << endl;
    forn(i, t)
    {
        // cout << "Case #" << i+1 << ": ";
        solve();
    }
    return 0;
}

#include <iostream>
#include <queue>
#include <vector>
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;

int main(void) {
  ios::sync_with_stdio(false);
  int64_t K, N, M;
  cin >> K >> N >> M;
  vector<int64_t> A(K);
  rep(i, K) cin >> A[i];

  vector<int64_t> B(K);
  int64_t sumB = M;
  rep(i, K) {
    B[i] = (int64_t)A[i] * (int64_t)M / (int64_t)N;
    sumB -= B[i];
  }

  using qtype = pair<int64_t, int>;
  priority_queue<qtype, vector<qtype>, greater<qtype>> que;
  rep(i, K) {
    que.emplace(B[i] * N - A[i] * M, i);
  }
  while(sumB--) {
    auto idx = que.top().second;
    que.pop();
    B[idx]++;
    que.emplace(B[idx] * N - A[idx] * M, idx);
  }

  rep(i, K){
    if(i) cout << " ";
    cout << B[i];
  }
  cout << endl;
  return 0;
}


#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (int)(n); i++)
#define REP(i,n) for (int i = 1; i < (int)(n); i++)
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
#define debug(var) do{cout << #var << " : "; view(var);}while(0)
template<class T> bool chmin(T &a, T b) {if(a>b) {a=b;return 1;}return 0;}
template<class T> bool chmax(T &a, T b) {if(a<b) {a=b;return 1;}return 0;}
using namespace std;
template<class T> void view(T e) {cout << e << endl;}
template<class T> void view(const vector<T> &v) {for(const auto &e : v){cout << e << " ";} cout << endl;}
template<class T> void view(const vector<vector<T>> &vv) {for(const auto &v : vv){view(v);}}
using vint = vector<int>;
using vvint = vector<vector<int>>;
using ll = long long;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
using P = pair<int,int>;
const int inf = 1<<30;
const ll inf_l = 1LL<<61;
const int MAX = 1e5;

int main() {
    int n, m; cin >> n >> m;
    vint a(m), b(m);
    rep(i,m) cin >> a[i] >> b[i];
    int k; cin >> k;
    vint c(k), d(k);
    rep(i,k) cin >> c[i] >> d[i];
    int ans = -1;
    rep(i,1<<k) {
        set<int> st;
        rep(j,k) {
            if (i >> j & 1) {
                st.insert(c[j]);
            } else st.insert(d[j]);
        }
        int tmp = 0;
        rep(j,m) {
            if (st.count(a[j]) && st.count(b[j])) tmp++;
        }
        ans = max(ans, tmp);
    }
    cout << ans << endl;
}

#include <bits/stdc++.h>
// #include <atcoder/all>
// using namespace atcoder;
#define rep(i, n) for (ll i = 0; i < (ll)(n); ++i)
#define rep2(i, s, n) for (ll i = s; i < (ll)(n); i++)
#define repr(i, n) for (ll i = n; i >= 0; i--)
#define pb push_back
#define COUT(x) cout << (x) << "\n"
#define COUTF(x) cout << setprecision(15) << (x) << "\n"
#define ENDL cout << "\n"
#define DF(x) x.erase(x.begin())
#define ALL(x) x.begin(), x.end()
#define SORT(x) sort(ALL(x))
#define RSORT(x) sort(x.rbegin(), x.rend())
#define REVERSE(x) reverse(ALL(x))
#define MAX(x) *max_element(ALL(x))
#define MAXI(x) max_element(ALL(x)) - x.begin()
#define SUM(x) accumulate(ALL(x), 0ll)
#define COUNT(x, y) count(ALL(x), y);
#define ANS cout << ans << "\n"
#define YES cout << "YES\n";
#define NO cout << "NO\n";
#define Yes cout << "Yes\n";
#define No cout << "No\n";
#define init() \
  cin.tie(0);  \
  ios::sync_with_stdio(false)
#define debug(x) cerr << "[debug] " << #x << ": " << x << endl;
#define debugV(v)                       \
  cerr << "[debugV] " << #v << ":";     \
  rep(z, v.size()) cerr << " " << v[z]; \
  cerr << endl;
using namespace std;
using ll = long long;
using ld = long double;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
using mll = map<ll, ll>;
using qll = queue<ll>;
using P = pair<ll, ll>;
using vp = vector<P>;
using vs = vector<string>;

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

template <typename T1, typename T2>
inline istream& operator>>(istream& i, pair<T1, T2>& v) {
  return i >> v.first >> v.second;
}

constexpr ll INF = 0x3f3f3f3f3f3f3f3f;
constexpr ld PI = 3.141592653589793238462643383279;
ll get_digit(ll x) {
  return to_string(x).size();
}

ll gcd(ll x, ll y) {
  return y ? gcd(y, x % y) : x;
}

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

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

ll RAND(ll min, ll max) {
  random_device seed_gen;
  mt19937 engine(seed_gen());
  uniform_int_distribution<ll> distribution(min, max);
  return distribution(engine);
}

signed main() {
  init();
  ll N, M;
  cin >> N >> M;
  vs S(M);
  cin >> S;

  vs C = {"A", "B", "C", "D", "E", "F", "G", "H", "."};

  rep(i, N) {
    rep(j, N) {
      cout << C[RAND(0, 8)];
    }
    ENDL;
  }
  return 0;
}


#include <iostream>
#include <iostream>
#include <vector>
#include <algorithm>
#include <iomanip>
#include <tuple>
#include <math.h>
#include <set>
#include <cassert>
#include <stack>
#include <bitset>
#include <map>
#include <queue>
#include <random>
#include <unordered_set>
#include <unordered_map>

#define DEBUG
#define fi first
#define se second
#define pqueue priority_queue
#define pb(x) push_back(x)
//#define endl '\n'
#define all(x) x.begin(), x.end()
#define int long  long
#define mk(a, b) make_pair(a, b)

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef vector<int> vi;
typedef vector<vector<int> > vvi;
typedef vector<ull> vull;
typedef vector<ll> vll;
// typedef tuple<ll, ll, ll> tiii;
typedef pair<int, int> pii;
typedef vector<pair<int, int> > vpii;
typedef vector<bool> vb;
typedef vector<string> vs;
typedef vector<vector<ll> > vvll;
typedef vector<char> vc;

const int inf = 1e9 + 228;
const ll infll = 1e18;
const ll MOD = 1e9 + 7;
//static const int maxn = 1e6 + 228;
const ld eps = 1e-9;
const int K = 31;
const ld eps2 = 1e-9;
const ll MOD2 = 998244353;
const ll dosz = 5e5;
const ll SZ = (1 << 18);
const ld PI = 3.1415926535;

void fast_io() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
//     freopen("INPUT.TXT", "r", stdin);
//     freopen("OUTPUT.TXT", "w", stdout);
}

const int maxn = 2e5 + 3;

int kek[maxn];
int lol[maxn][301];
int lol2[maxn][301];

int fac[301];
int rfac[301];

int binpow(int n, int k) {
    if (!k)
        return 1;
    else if (k & 1)
        return binpow(n, k - 1) * n % MOD2;
    int b = binpow(n, k / 2);
    return b * b % MOD2;
}

void solve() {
    int n, k;
    cin >> n >> k;
    for (int i = 0; i < n; i++)
        cin >> kek[i];
    fac[0] = rfac[0] = 1;
    for (int i = 1; i <= k; i++) {
        fac[i] = fac[i - 1] * i;
        fac[i] %= MOD2;
        rfac[i] = binpow(fac[i], MOD2 - 2);
    }
    for (int i = 0; i < n; i++) {
        lol[i][0] = 1;
        for (int j = 1; j <= k; j++) {
            lol[i][j] = lol[i][j - 1] * kek[i] % MOD2;
        }
    }
    for (int i = 0; i < n; i++) {
        for (int j = 0; j <= k; j++) {
            lol[i][j] = lol[i][j] * rfac[j] % MOD2;
        }
    }
    for (int i = n - 1; i >= 0; i--) {
        for (int j = 0; j <= k; j++) {
            lol2[i][j] = lol2[i + 1][j] + lol[i][j];
            if (lol2[i][j] >= MOD2)
                lol2[i][j] -= MOD2;
        }
    }
    for (int i = 1; i <= k; i++) {
        int ans = 0;
        for (int j = 0; j <= i; j++) {
            ans += lol2[0][j] * lol2[0][i - j];
            ans %= MOD2;
        }
        ans *= fac[i];
        ans %= MOD2;
        ans *= binpow(2, MOD2 - 2);
        ans %= MOD2;
        int abc = binpow(2, i - 1);
        for (int j = 0; j < n; j++) {
            ans -= lol[j][i] * fac[i] % MOD2 * abc % MOD2;
            ans += MOD2;
            if(ans >= MOD2)
                ans -= MOD2;
        }
        cout << ans << endl;
    }
}

signed main() {
    fast_io();
    srand(time(NULL));
    cout << fixed << setprecision(10);
    int q = 1;
//    cin >> q;
    while (q--)
        solve();
}

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

#define rep(a, b)      for(int a = 0; a < (b); ++a)
#define rep1(a, b, c)  for(int a = (b); a < (c); ++a)
#define each(a, b)     for(auto& a : b)

#define sz(x)       (int)(x).size()
#define all(a)      (a).begin(),(a).end()
#define rall(a)     (a).rbegin(), (a).rend()

#define lb lower_bound
#define ub upper_bound
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define fi first
#define se second
#define dbg(x) cout << #x << " = " << x << endl;
#define vt vector
#define pii pair<int, int>
#define pll pair<ll, ll>
#define bitcnt(x) __builtin_popcount(x)

using ll = long long;

const int inf = (int)1e9 + 5;
const ll infl = (ll)1e18 + 5;
const int mod = 1e9 + 7;

int d[2000][2000][4];

ll go(int b){
	ll ans = 1;
	ll t = 2;
	while(b){
		if(b&1) ans = (ans*t)%mod;
		b >>= 1; t = (t*t)%mod;
	}
	return ans;
}

void solve(){
	int h, w; cin >> h >> w;
	vt<string> s(h);
	each(x, s) cin >> x;
	ll t1 = 0;
	rep(x, h){
		int t = 0;
		rep(y, w){
			d[x][y][0] = t;
			if(s[x][y] == '.') ++t, ++t1;
			else t = 0;
		}
	}
	rep(x, h){
		int t = 0;
		for(int y = w-1; ~y; --y){
			d[x][y][1] = t;
			if(s[x][y] == '.') ++t;
			else t = 0;
		}
	}
	rep(y, w){
		int t = 0;
		rep(x, h){
			d[x][y][2] = t;
			if(s[x][y] == '.') ++t;
			else t = 0;
		}
	}
	rep(y, w){
		int t = 0;
		for(int x = h-1; ~x; --x){
			d[x][y][3] = t;
			if(s[x][y] == '.') ++t;
			else t = 0;
		}
	}
	ll t2 = go(t1);
	ll ans = 0;
	rep(i, h) rep(j, w){
		if(s[i][j] == '#') continue;
		int t = 0;
		rep(k, 4) t += d[i][j][k];
		t += (s[i][j] == '.');
		ll t3 = go(t1-t);
		ans += t2 - t3;
	}
	ans %= mod; ans += mod; ans %= mod;
	cout << ans << '\n';
}

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


// Problem: E - Unique Color
// Contest: AtCoder - AtCoder Beginner Contest 198
// URL: https://atcoder.jp/contests/abc198/tasks/abc198_e
// Memory Limit: 1024 MB
// Time Limit: 2000 ms

#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>
using namespace std;
#define it insert
#define pob pop_back
#define pub push_back
#define emb emplace_back
#define all(v) (v).begin(), (v).end()
#define mkp(a, b) make_pair(a, b)
using LL = long long;
using VI = vector<int>;
using VVI = vector<vector<int>>;
using PII = pair<int, int>;
using PIL = pair<int, LL>;
using PLL = pair<LL, LL>;
const double EPS = 1e-6;
const int MOD = 1e9 + 7;
const int INF = 0x3f3f3f3f;
const int N = 1e5 + 7;

int h[N], e[2 * N], ne[2 * N], idx;
int color[N], vt[N], cnt[N];
int n;
int ans[N], m;

void add(int a, int b) { e[idx] = b, ne[idx] = h[a], h[a] = idx++; }

void dfs(int u) {
    cnt[color[u]] += 1;
    vt[u] = 1;
    if (cnt[color[u]] == 1) ans[m++] = u;
    for (int i = h[u]; i != -1; i = ne[i]) {
        int v = e[i];
        if (!vt[v]) dfs(v);
    }
    cnt[color[u]] -= 1;
}

int main() {
    memset(h, -1, sizeof h);
    cin >> n;
    for (int i = 1; i <= n; ++i) cin >> color[i];
    for (int i = 1; i < n; ++i) {
        int x, y;
        cin >> x >> y;
        add(x, y), add(y, x);
    }
    dfs(1);
    sort(ans, ans + m);
    for (int i = 0; i < m; ++i) cout << ans[i] << '\n';
    return 0;
}

#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define all(v) v.begin(), v.end()
#define allr(v) v.rbegin(), v.rend()
#define V vector
#define pb push_back
#define eb emplace_back
#define lb lower_bound
#define ub upper_bound
#define mp make_pair
#define sz(x) int(x.size())
#define pcnt __builtin_popcountll
template <typename T> bool chmin(T &a, const T &b) {if(a > b){a = b; return true;} return false;}
template <typename T> bool chmax(T &a, const T &b) {if(a < b){a = b; return true;} return false;}
template <typename T> void print(T a) {cout << a << ' ';}
template <typename T> void printe(T a) {cout << a << endl;}
template <typename T> void printv(T a) {rep(i, sz(a))print(a[i]); cout<<endl;}
template <typename T> void printp(pair<T, T> a) {print(a.first); cout<<a.second<<endl;}
template <typename A, size_t N, typename T> void Fill (A (&array)[N], const T & val) {fill ((T*)array, (T*)(array+N), val);}
template <typename T> using vc = vector<T>;
template <typename T> using vv = vc<vc<T>>;
template <typename T> using vvv = vc<vv<T>>;
using ll = long long;
using P = pair<int, int>;
using Pl = pair<ll, ll>;
using vi = vc<int>;
using vvi = vv<int>;
using vl = vc<ll>;
using vvl = vv<ll>;
vi di = {-1, 1,  0, 0, -1, -1,  1, 1};
vi dj = { 0, 0, -1, 1, -1,  1, -1, 1};

const int MAX_N = 1e5 + 10;
int n;
vi color(MAX_N);
vi cnt(MAX_N, 0);
vi ans(MAX_N, false);
vvi to(MAX_N);
void dfs (int now, int p) {
    for (int nxt : to[now]) {
        if (nxt == p) continue;
        if (cnt[color[nxt]] == 0) ans[nxt] = true;
        cnt[color[nxt]]++;
        dfs(nxt, now);
        cnt[color[nxt]]--;
    }
}

int main () {
    cin >> n;
    rep(i, n) cin >> color[i];
    rep(i, n-1) {
        int a, b; cin >> a >> b, a--, b--;
        to[a].eb(b);
        to[b].eb(a);
    }
    ans[0] = true;
    cnt[color[0]]++;
    dfs(0, -1);
    rep(i, n) if (ans[i]) cout << i+1 << endl;
    return 0;
}


#include <vector>
#include <array>
#include <stack>
#include <queue>
#include <list>
#include <bitset>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <algorithm>
#include <numeric>
#include <iostream>
#include <iomanip>
#include <string>
#include <chrono>
#include <random>
#include <cmath>
#include <cassert>
#include <climits>
#include <cstring>
#include <cstdlib>
#include <functional>
#include <sstream>

using namespace std;

class DisjointSet {
    public:
        DisjointSet(int n) : N(n), sz(n), pars(n, -1) {
        }
        void reset() { sz = N, fill(pars.begin(), pars.end(), -1); }
        int find(int x) { return pars[x] < 0 ? x : pars[x] = find(pars[x]); }
        int size() { return sz; }
        int count(int x) { return -pars[find(x)]; }
        bool unite(int x, int y) {
            x = find(x), y = find(y);
            if (x == y) { return false; }
            --sz;
            if (pars[x] < pars[y]) { swap(x, y); }
            pars[y] += pars[x];
            pars[x] = y;
            return true;
        }
        bool isSame(int x, int y) { return find(x) == find(y); }
    private:
        int N, sz;
        vector<int> pars;
};

int main(int argc, char** argv) {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << fixed << setprecision(12);

    int n, m;
    cin >> n >> m;
    vector<string> S(n);
    for (int i = 0; i < n; ++i) {
        cin >> S[i];
    }

    DisjointSet ds(n + m);
    ds.unite(0, n - 1);
    ds.unite(0, n);
    ds.unite(0, n + m - 1);

    vector<int> X{-1, 1, 0, 0};
    vector<int> Y{0, 0, -1, 1};
    for (int i = 0; i < n; ++i) {
        for (int j = 0; j < m; ++j) {
            if (S[i][j] == '#') {
                ds.unite(i, n + j);
            }
        }
    }

    set<int> R;
    set<int> C;
    int res = 0;
    for (int i = 0; i < n; ++i) {
        R.insert(ds.find(i));
    }
    for (int i = 0; i < m; ++i) {
        C.insert(ds.find(n + i));
    }

    res = min(R.size() - 1, C.size() - 1);
    cout << res << '\n';

    return 0;
}

#include<bits/stdc++.h>

using namespace std;

#define rep(x, L, R) for(int x = (L), _x = (R); x <= _x; x++)
#define per(x, R, L) for(int x = (R), _x = (L); x >= _x; x--)
#define broken fprintf(stderr, "running on %s %d\n", __FUNCTION__, __LINE__)
#define debug(...) fprintf(stderr, __VA_ARGS__)
#define SZ(v) (int)(v).size()
#define ALL(x) (x).begin(), (x).end()
#define x first
#define y second
#define mp make_pair
#define pb push_back

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

typedef pair<int, int> par;
typedef long long LL;
typedef unsigned long long uLL;
typedef double db;
const int N = 2e5 + 10, inf = 0x3f3f3f3f;
int n, k;
int a[N], b[N];
vector<int> g[N];

void adde(int u, int v) { g[u].push_back(v); }

void dfs(int u, int fa, int k, int &cnt) {
	int mn = n * 2, smn = n * 2;
	a[u] = b[u] = 0;
	for(auto v : g[u]) {
		if(v == fa) continue;
		dfs(v, u, k, cnt);
		if(mn > b[v]) smn = mn, mn = b[v];
		else smn = min(smn, b[v]);
	}
	for(auto v : g[u]) {
		if(v == fa) continue;
		int now = mn;
		if(b[v] == now) now = smn;
		if(now + 2 + a[v] <= k) a[v] = - n * 2;
		else a[u] = max(a[u], a[v] + 1);
	}
	if(mn + 1 <= k && a[u] <= 0) a[u] = - n * 2;
	if(a[u] >= k) cnt++, a[u] = - n * 2, b[u] = 0;
	else b[u] = mn + 1;
	return;
}

int check(int k) {
	int cnt = 0;
	dfs(1, 0, k, cnt);
	if(a[1] >= 0) cnt++;
	return cnt;
}

int main() {
	scanf("%d%d", &n, &k);
	rep(i, 1, n - 1) {
		int u, v;
		scanf("%d%d", &u, &v);
		adde(u, v), adde(v, u);
	}
	int l = 0, r = n, best = -1;
	while(l <= r) {
		int mid = (l + r) / 2;
		if(check(mid) <= k) best = mid, r = mid - 1;
		else l = mid + 1;
	}
	printf("%d\n", best);
	return 0;
}


#include <bits/stdc++.h>

using namespace std;

#define x first
#define y second
#define mp make_pair
#define pb push_back

typedef long long ll;

const ll MOD = 1e9+7;
const ll INF = 1e18+5;

pair <ll, char> p[200005];
multiset <ll> r;
multiset <ll> g;
multiset <ll> b;

ll solve1(multiset <ll> a, multiset<ll> b) {
	ll sol = INF;
	for (ll x:a) {
		multiset <ll> :: iterator it = b.lower_bound(x);
		if (it != b.end()) {
			sol = min(sol, *it-x);
		}
		if (it != b.begin()) {
			it--;
			sol = min(sol, x-*it);
		}
	}
	return sol;
}

ll solve2(multiset <ll> a, multiset<ll> b, multiset <ll> s) {
	ll ba = INF;
	ll bb = INF;
	ll sol = INF;
	for (ll x:s) {
		ll A = INF;
		ll B = INF;
		multiset <ll> :: iterator it = a.lower_bound(x);
		if (it != a.end()) {
			A = min(A, *it-x);
		}
		if (it != a.begin()) {
			it--;
			A = min(A, x-*it);
		}
		it = b.lower_bound(x);
		if (it != b.end()) {
			B = min(B, *it-x);
		}
		if (it != b.begin()) {
			it--;
			B = min(B, x-*it);
		}
		sol = min(sol, A+bb);
		sol = min(sol, B+ba);
		ba = min(ba, A);
		bb = min(bb, B);
	}
	return sol;
}

int main() {
	int n;
	scanf("%d", &n);
	n *= 2;
	for (int i=0 ; i<n ; i++) {
		scanf("%lld %c", &p[i].x, &p[i].y);
		if (p[i].y == 'R') r.insert(p[i].x);
		if (p[i].y == 'G') g.insert(p[i].x);
		if (p[i].y == 'B') b.insert(p[i].x);
	}
	if (r.size()%2 == 0 and g.size()%2 == 0 and b.size()%2 == 0) {
		printf("0\n");
		return 0;
	}
	if (r.size()%2 == 0) printf("%lld\n", min(solve1(g, b), solve2(g, b, r)));
	if (g.size()%2 == 0) printf("%lld\n", min(solve1(r, b), solve2(r, b, g)));
	if (b.size()%2 == 0) printf("%lld\n", min(solve1(r, g), solve2(r, g, b)));
	return 0;
}

#include<bits/stdc++.h>
using namespace std;
#define  pb push_back
#define inf 1e18
// 1000000007 , 998244353
// cout<<"? "<<endl for interactive

#define mod 998244353
#define  mp make_pair
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define clr(x,y,z) (x).clear(),(x).resize((y),(z))

typedef long long int lli;
typedef vector<lli> vli;
typedef vector<int> vi;
typedef tuple<int, int, long long int>tup;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<lli, lli> pll;
typedef pair<int, int> pii;

#define csb(x) __builtin_popcount(x)
#define clz(x) __builtin_clz(x)
#define ctz(x) __builtin_ctz(x)
#define PI 3.1415926535897932384626
#define deb(x) cout << #x << " = " << x << endl;
#define show(x) {for( auto i : x) cout << i << '\t'; cout << endl;}
#define show2(x,l1,l2) {for( int i=0;i<l1;i++){for(int j=0;j<l2;j++) cout << x[i][j] << '\t'; cout << endl;}}
#define rep(i,st,ed) for(int i=(st);i<(ed);i++)
#define rrep(i,ed,st) for(int i=ed;i>=st;i--)
#define ff first
#define ss second
#define minheap(type) priority_queue<type,vector<type>,greater<type>>

template <typename T> void ckmin(T &a, const T &b) { a = min(a, b); }
template <typename T> void ckmax(T &a, const T &b) { a = max(a, b); }

long long gcd(ull a, ull b) { return b == 0 ? a : gcd(b, a % b); }
long long lcm(long long a, long long b) { return a / gcd(a, b) * b; }
void sieve(vector<int>&spf) {int n = spf.size(); rep(i, 2, n) {if (!spf[i]) {/*prime.pb(i)*/; for (int j = i; j < n; j += i) spf[j] = i; }}}
lli power(lli x, lli y, long long int m = mod) { lli ans = 1; x %= m; while (y) {if (y & 1)ans = (x * ans) % m; x = (x * x) % m; y >>= 1;} return ans;}
lli ncr(vli&fact, int n, int r) {return (n >= r) ? ((fact[n] * ((power(fact[r], mod - 2) * power(fact[n - r], mod - 2) ) % mod)) % mod) : 0;}

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

void solve() {
    int n;
    cin >> n;
    n*=2;
    vector<pll> arr(n);
    vi odd(3,0);
    rep(i,0,n){
        cin>>arr[i].ff;
        char c;
        cin>>c;
        if(c=='R')arr[i].ss = 1,odd[0]++;
        else if(c=='G')arr[i].ss = 2,odd[1]++;
        else arr[i].ss = 4,odd[2]++;
    }
    rep(i,0,3)odd[i]%=2;
    int state = (odd[0])^(odd[1]<<1)^(odd[2]<<2);
    sort(all(arr));
    vli scene(7,1e16);
    rep(i,0,n-1){
        if(arr[i].ss != arr[i+1].ss){
            scene[arr[i].ss ^ arr[i+1].ss] =min(scene[arr[i].ss ^ arr[i+1].ss],abs(arr[i].ff - arr[i+1].ff ));
        }
    }
    // deb(state)
    // show(scene)
    if(state == 0){
        cout<<0;
    }
    else if (state == 6){
        cout<< min ({scene[3]+scene[5],scene[6]});
    }
    else if(state == 3){
        cout<< min ({scene[6]+scene[5],scene[3]});

    }
    else{
        cout<< min ({scene[3]+scene[6],scene[5]});

    }

}

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

}


#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <cmath>
#include <map>
#include <queue>
#include <iomanip>
#include <set>
#include <tuple>
#define mkp make_pair
#define mkt make_tuple
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define all(v) v.begin(),v.end()
using namespace std;
typedef long long ll;
const ll MOD=1e9+7;
template<class T> void chmin(T &a,const T &b){if(a>b) a=b;}
template<class T> void chmax(T &a,const T &b){if(a<b) a=b;}

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

  int N;
  cin>>N;
  vector<vector<ll>> C(N,vector<ll> (N,0));
  rep(i,N) rep(j,N) cin>>C[i][j];

  vector<ll> A(N,0),B(N,0);
  int mir=0,mic=0;
  rep(i,N) rep(j,N) if(C[i][j]<C[mir][mic]) mir=i,mic=j;

  for(int i=0;i<N;i++) A[i]=C[i][mic]-C[mir][mic];
  for(int j=0;j<N;j++) B[j]=C[mir][j]-C[mir][mic];

  int diff=C[0][0]-(A[0]+B[0]);
  for(int i=0;i<N;i++) for(int j=0;j<N;j++){
      if(C[i][j]-(A[i]+B[j])!=diff){
          cout<<"No"<<endl;
          return 0;
      }
  }

  rep(i,N) A[i]+=diff;

  cout<<"Yes"<<endl;
  rep(i,N) cout<<A[i]<<" ";
  cout<<endl;
  rep(i,N) cout<<B[i]<<" ";
  cout<<endl;

  return 0;
}

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

#include <iostream>
#include <array>
#include <algorithm>
#include <vector>
#include <bitset>
#include <set>
#include <unordered_set>
#include <cmath>
#include <complex>
#include <deque>
#include <iterator>
#include <numeric>
#include <map>
#include <unordered_map>
#include <queue>
#include <stack>
#include <string>
#include <tuple>
#include <utility>
#include <limits>
#include <iomanip>
#include <functional>
#include <cassert>
// #include <atcoder/all>
using namespace std;

using ll=long long;
template<class T> using V = vector<T>;
template<class T, class U> using P = pair<T, U>;
using vll = V<ll>;
using vii = V<int>;
using vvll = V<vll>;
using vvii = V< V<int> >;
using PII = P<int, int>;
using PLL = P<ll, ll>;
#define RevREP(i,n,a) for(ll i=n;i>a;i--)  // (a,n]
#define REP(i,a,n) for(ll i=a;i<n;i++)  // [a,n)
#define rep(i, n) REP(i,0,n)
#define ALL(v) v.begin(),v.end()
#define eb emplace_back
#define pb push_back
#define sz(v) int(v.size())

template < class T > inline bool chmax(T& a, T b) {if (a < b) { a=b; return true; } return false; }
template < class T > inline bool chmin(T& a, T b) {if (a > b) { a=b; return true; } return false; }
template< class A, class B > ostream& operator <<(ostream& out, const P<A, B> &p) {
    return out << '(' << p.first << ", " << p.second << ')';
}
template< class A > ostream& operator <<(ostream& out, const V<A> &v) {
    out << '[';
    for (int i=0;i<int(v.size());i++) {
        if (i) out << ", ";
        out << v[i];
    }
    return out << ']';
}

template<class A, class B> istream& operator >>(istream& in, P<A, B> &p) {
    return in >> p.first >> p.second;
}
template<class A> istream& operator >>(istream& in, V<A> &v) {
    for (int i = 0; i < int(v.size()); i++) in = in >> v[i];
    return in;
}

const long long MOD = 1000000007;
const long long HIGHINF = (long long)1e18;
const int INF = (int)1e9;

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int a, b; cin >> a >> b;
    if (a < b) {
        rep(i, b) cout << -(i + 1) << ' ';
        rep(i, a - 1) cout << i + 1 << ' ';
        int aaa = 0;
        REP(i, a, b + 1) aaa += i;
        cout << aaa << '\n';
    } else {
        rep(i, a) cout << i + 1 << ' ';
        rep(i, b - 1) cout << -(i + 1) << ' ';
        int aaa = 0;
        REP(i, b, a + 1) aaa += i;
        cout << -aaa << '\n';
    }
    return 0;
}


#include<cstdio>
#include<iostream>
#define ll long long
using namespace std;
int main(){
	long long n,t;
	cin>>t>>n;
long long l=0,r=100000000000000,mid;
	while(l<r){
		mid=(l+r)/2;
		if(
		(((100+t)*mid)/100<n+mid)
		){
			l=mid+1;
		}
		else{
			r=mid;
		}
	}
	cout<<1+((100+t)*(l-1))/100;
//	cin>>n;
}

/*Bismillahir Rahmanir Rahim*/
#include<bits/stdc++.h>
#define ll long long int
#define pb push_back
#define mp make_pair
#define PI acos(-1.0)
using namespace std;
int main()
{
    ios_base :: sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    double r,x,y,a=0,b=0,s,cnt=0;
    cin>>r>>x>>y;
    s=sqrt(x*x+y*y);
    if(s<r) cnt++;
    cout<<ceil(s/r)+cnt<<endl;
}


/*
#pragma GCC optimize("Ofast")
#pragma GCC target("avx", "avx2", "fma")
#pragma GCC optimization("unroll-loops")
*/
#include <bits/stdc++.h>
using namespace std;
#define pi acos(-1)
#define IOS ios_base::sync_with_stdio(0); cin.tie(); cout.tie();
#define fi first
#define se second
#define pf push_front
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define debug(x) cerr<<#x<<": "<<(x)<<'\n'
#define lb lower_bound
#define ub upper_bound
typedef long double ld;
typedef long long ll;
typedef unsigned long long ull;
const ll mod = 998244353;
const ll inf = 0x3f3f3f3f;
const ll llinf = 1e18;
const ll nax = 0;

int main(){
	IOS
	ll a, b, c; cin >> a >> b >> c;
	ll satu=a*(a+1)/2%mod;
	ll dua=b*(b+1)/2%mod;
	ll tiga=c*(c+1)/2%mod;
	cout << ((satu*dua)%mod*tiga)%mod << '\n';
}

#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#include <bits/stdc++.h>
#define rc(x) return cout<<x<<endl,0
#define pb push_back
#define mkp make_pair
#define in insert
#define er erase
#define fd find
#define fr first
#define sc second
#define all(x) x.begin(),x.end()
#define lun(x) (int)x.size()
typedef long long ll;
typedef long double ld;
const ll INF=0x3f3f3f3f3f3f3f3f;
const ll llinf=(1LL<<60);
const int inf=(1<<30);
const int nmax=5e5+50;
const ll mod=1e9+7;
using namespace std;

ll x,y,a,b, ans;
int main()
{
    //freopen("sol.in","r",stdin);
    //freopen("sol.out","w",stdout);
    //mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
   	ios_base::sync_with_stdio(false);cin.tie(0);cerr.tie(0);cout.tie(0);
    cin >> x >> y >> a >> b;
    while((double)a*x<=2e18 && a*x < y && x*a <= x+b){
        x *= a;
        ans++;
    }
    cout << ans + (y - x - 1)/b << endl;
    return 0;
}


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

#define vt vector
#define all(c) (c).begin(), (c).end()
#define sz(x) (int)(x).size()
#define ll long long
#define ld long double
#define ar array
#define inf() ifstream cin("d.txt")
#define onf() ofstream cout("test.txt")
#define mod 1000000007
#define pb push_back
#define endl cout<<"\n";
#define prt1(a) cout<<a<<" "
#define prt2(a,b) cout<<a<<" "<<b<<" "
#define prt3(a,b,c) cout<<a<<" "<<b<<" "<<c<<" "
#define in(a) cin>>a
#define inn(a,b) cin>>a>>b
#define innn(a,b,c) cin>>a>>b>>c
#define rep(i,st,end) for(ll i=st;i<end;i++)
#define repv(i,st,end) for(ll i=st;i>=end;i--)
#define fio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define TEST ll tc;cin>>tc;while(tc--)
#define EACH(x, a) for (auto& x: a)

template<class A> void read(vt<A>& v);
template<class A, size_t S> void read(ar<A, S>& a);
template<class T> void read(T& x) {
    cin >> x;
}
void read(double& d) {
    string t;
    read(t);
    d=stod(t);
}
void read(long double& d) {
    string t;
    read(t);
    d=stold(t);
}
template<class H, class... T> void read(H& h, T&... t) {
    read(h);
    read(t...);
}
template<class A> void read(vt<A>& x) {
    EACH(a, x)
        read(a);
}
template<class A, size_t S> void read(array<A, S>& x) {
    EACH(a, x)
        read(a);
}
#define debug(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }

void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
    cerr << *it << " = " << a <<"\n";
    err(++it, args...);
}

void solve()
{
    ll n, m ,t ;
    read(n,m,t) ;
    ll mx = n ;
    vector<pair<ll,ll>>v ;
    rep(i,0,m)
    {
        ll x, y ;
        read(x,y) ;
        v.pb({x,y}) ;
    }
    ll f=0;
    ll dec = v[0].first ;
    n = n-dec ;
    if(n<=0)
    {
      cout<<"No";
        return ;
    }
    // cout<<"N is "<<n;endl;
    rep(i,0,m)
    {
        if(i!=0)
        {
            dec = v[i].first - v[i-1].second ;
            n=n-dec ;
            // cout<<n;endl;
            if(n<=0)
            {
                f=1;
                break ;
            }
        }
        ll inc = v[i].second - v[i].first ;
        n=n+inc ;
        if(n>mx)
            n=mx ;
        // cout<<n;endl;
    }
    if(v[m-1].second!=t)
    {
        dec = t-v[m-1].second ;
        n=n-dec ;
    }
    if(n<=0 || f==1)
        cout<<"No";
    else
        cout<<"Yes" ;

}

 int main()
 {
    clock_t start, end;
    start = clock();
    fio;
    ll k = 1;
    ll tc = 1;
   // cin>>tc;
    while(tc--){
       // cout<<"Case #"<<k<<": ";k++;
        solve();
        endl;
    }
    end = clock();
     double time_taken = double(end - start) / double(CLOCKS_PER_SEC);
    // debug(time_taken);

 }

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define BE(x) x.begin(), x.end()

int main() {
    ll n, m, t;
    cin >> n >> m >> t;
    vector<ll> a(m), b(m);
    for (int i = 0; i < m; i++) cin >> a[i] >> b[i];

    ll bat = n;
    for (int i = 0; i < m; i++) {
        bat -= (i > 0) ? (a[i] - b[i-1]) : a[i];
        if (bat <= 0) {
            cout << "No" << endl;
            return 0;
        }
        bat += (b[i] - a[i]);
        if (bat > n) bat = n;
    }
    if (bat <= (t - b.back())) cout << "No" << endl;
    else cout << "Yes" << endl;
}


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

int main(){
  int a,b,c;
  cin>>a>>b>>c;
  if(a*a + b*b < c*c) cout<<"Yes";
    else cout<<"No";
}

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

int main() {
  int a,b,c=0;
  cin>>a>>b>>c;
  if(a*a+b*b<c*c){
    cout<<"Yes";
  }else{
    cout<<"No";
  }
}

vector<int> BFS(int N, int M) {
  // N, M は頂点数と辺数
  // グラフ入力受取 (無向グラフ想定)
  graph G(N);
  rep (i, 0, M) {
    int a, b;
    cin >> a >> b;
    G[a].push_back(b);
    G[b].push_back(a);
  }

  // BFS のためのデータ構造
  vector<int> dist(N, -1); // 全頂点を「未訪問」に初期化
  queue<int> que;

  // 初期条件 (頂点 0 を初期ノードとする)
  dist[0] = 0;
  que.push(0); // 0 を橙色頂点にする

  // BFS 開始 (キューが空になるまで探索を行う)
  while (!que.empty()) {
    int v = que.front(); // キューから先頭頂点を取り出す
    que.pop();

    // v から辿れる頂点をすべて調べる
    for (int nv : G[v]) {
      if (dist[nv] != -1) continue; // すでに発見済みの頂点は探索しない

      // 新たな白色頂点 nv について距離情報を更新してキューに追加する
      dist[nv] = dist[v] + 1;
      que.push(nv);
    }
  }

  // 結果出力 (各頂点の頂点 0 からの距離を見る)
  return dist;
}

//ABC177
struct UnionFind {
  vector<int> par; // par[i]:iの親の番号　(例) par[3] = 2 : 3の親が2

  UnionFind(int N) : par(N) { //最初は全てが根であるとして初期化
    for(int i = 0; i < N; i++) par[i] = i;
  }

  int root(int x) { // データxが属する木の根を再帰で得る：root(x) = {xの木の根}
    if (par[x] == x) return x;
    return par[x] = root(par[x]);
  }

  void unite(int x, int y) { // xとyの木を併合
    int rx = root(x); //xの根をrx
    int ry = root(y); //yの根をry
    if (rx == ry) return; //xとyの根が同じ(=同じ木にある)時はそのまま
    par[rx] = ry; //xとyの根が同じでない(=同じ木にない)時：xの根rxをyの根ryにつける
  }

  bool same(int x, int y) { // 2つのデータx, yが属する木が同じならtrueを返す
    int rx = root(x);
    int ry = root(y);
    return rx == ry;
  }
};

bool IsPrime(int num)
{
  if (num < 2) return false;
  else if (num == 2) return true;
  else if (num % 2 == 0) return false; // 偶数はあらかじめ除く

  double sqrtNum = sqrt(num);
  for (int i = 3; i <= sqrtNum; i += 2){
    if (num % i == 0)return false;
  }
  return true;
}

vector<int> Vecin(vector<int> vec,int n){
  rep(i,0,n){
    cin>>vec.at(i);
  }
  return vec;
}


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

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

#define FastIO()            ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define read()              freopen("in.txt","r",stdin)
#define write()             freopen("out.txt","w",stdout)

typedef long long           ll;
typedef unsigned long long  ull;
typedef double              dbl;
typedef float               flt;

typedef pair<int, int>      pii;
typedef pair<ll, ll>        pl;

typedef vector<int>         vi;
typedef vector<ll>          vl;
typedef vector<pii>         vpii;
typedef vector<pl>          vpl;

#define pie                 acos(-1)

#define mp                  make_pair
#define pb                  push_back
#define eb                  emplace_back
#define ff                  first
#define ss                  second

#define MAX                 300005
#define MOD                 1000000007
#define INF                 1000000100

#define for0(i, n)          for(ll i=0; i<n; i++)
#define for1(i, n)          for(ll i=1; i<=n; i++)
#define forab(i, a, b)      for(ll i=a; i<=b; i++)
#define forabx(i, a, b, x)  for(ll i=a; i<=b; i+=x)
#define forinv(i, a, b)     for(ll i=a; i>=b; i--)

#define clr0(a)             memset(a, 0, sizeof(a))
#define ceil(x, y)          (x+y-1) / (y)
#define max3(a, b, c)       max(a, max(b, c))
#define min3(a, b, c)       min(a, min(b, c))
#define gcd(a, b)           __gcd(a, b)
#define lcm(a, b)           ((a * b) / __gcd(a, b))
#define sort1(a, x, y)      sort(a+x, a+y+1)
#define debug(x)            cout << "DEBUG " << x << endl;

#define Y()                 cout << "YES" << endl;
#define N()                 cout << "NO" << endl;
#define inArr(a, x, y)      forab(i, x, y) { cin >> a[i]; }
#define outArr(a, x, y)     forab(i, x, y) { cout << a[i] << " "; } cout << endl;

void solve() {
    ll n;
    cin >> n;
    if (n==191) {
        cout << "so-so" << endl;
    }
    else if (n>191) {
        cout << ":(" << endl;
    }
    else {
        cout << "Yay!" << endl;
    }
}

void testcase() {
    ll t;
    cin >> t;
    while (t--) {
        solve();
    }
}

int main () {
    FastIO()

    //testcase();
    solve();

    return 0;
}

#include <bits/stdc++.h>
#include <bits/extc++.h>
#define double long double
#define rbtree __gnu_pbds::tree<int,__gnu_pbds::null_type,less<int>,__gnu_pbds::rb_tree_tag,__gnu_pbds::tree_order_statistics_node_update>
#define int ll
#define IOS ios_base::sync_with_stdio(false);cin.tie(0);
#define pb push_back
#define ALL(X) X.begin(),X.end()
#define F(i,n)  FF(i,0,n)
#define F1(i,n)  FF(i,1,n+1)
#define FF(i,n,m) for(int i=(int)n;i<(int)m;++i)
#ifndef LOCAL
//#pragma GCC optimize("Ofast,unroll-loops,no-stack-protector")
#else
#endif // LOCOL
//#define mp make_pair
using namespace std;
//using namespace __gnu_pbds;
template<typename T> bool remax(T& a, const T& b) {return b>a?a=b,1:0;}
template<typename T> bool remin(T& a, const T& b) {return b<a?a=b,1:0;}
inline ostream& operator << (ostream& os,__int128_t a){if(a==0) {return (os<<'0');}bool flag=0;if(a<0) {a=-a,flag=1;}string s;while(a){s+=a%10+'0';a/=10;}s+=flag?"-":"";reverse(ALL(s));return os<<s;}
inline istream& operator >>(istream& is,__int128_t& a){string s;cin>>s;a=0;for(auto c:s) a=a*__int128_t(10)+__int128_t(c-'0');return is;}
template<typename T,typename P> inline ostream& operator << (ostream& os,pair<T,P> a){os<<a.first<<" "<<a.second; return os;}
template<typename T,typename P> inline istream& operator >> (istream& is,pair<T,P> &a){is>>a.first>>a.second; return is;}
using ll=long long;
using ull=unsigned long long;
using int128= __int128_t;
using uint128= __uint128_t;
using pii =pair<int,int>;
const double pi=acos(-1);
const int N=2E6+5;
const ll M=1000000000;
const ll INF_64=0x3f3f3f3f3f3f3f3f;
const int INF_32=0x3f3f3f3f;
const int16_t INF_16=0x3f3f;
const int klog=20;
const int mod=1E9+7;//998244353
const double eps=1E-8;
void gen(){

}
template <class T>
T qpow(T base,ll power){
    T re=base,tmp=base;
    power--;
    while(power){
        if(power&(1LL)){
            re=re*tmp;re%=mod;
        }
        power>>=1;
        tmp=tmp*tmp;tmp%=mod;
    }
    return re;
}
int pw[N]{};
int invp[N]{};
int val(int n,int m){
    if(n<0||m<0) return 0;
    return pw[n+m]*invp[n]%mod*invp[m]%mod;
}
void sol(){
    pw[0]=1;
    F1(i,N-1) pw[i]=pw[i-1]*i%mod;
    F(i,N) invp[i]=qpow(pw[i],mod-2);
    int n,m,k;cin>>n>>m>>k;
    if(n>m+k){
        cout<<"0\n";
        return;
    }
    int an=val(n,m);
    int sub=val(n-k-1,m+k+1);
    cout<<((an-sub)%mod+mod)%mod<<"\n";
}
int32_t main(){
    #ifdef LOCAL
    //freopen(".in","r",stdin);
    //freopen(".out","w",stdout);
    #endif // LOCAL
    IOS;
    int t=1;
    gen();
    //cin>>t;
    FF(i,1,t+1){
        //cout<<"Case #"<<i<<": ";
        sol();
    }
}


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

// #include <atcoder/all>
// using namespace atcoder;

#define rep(i,n) for (int i = 0; i < (n); ++i)
using ll = long long;

// Generated by 1.1.7.1 https://github.com/kyuridenamida/atcoder-tools
int main(){
    // Failed to predict input format
    int H, W;
    cin >> H >> W;
    vector<string> S(H);
    rep(i, H) cin >> S[i];

    int si, sj;
    bool last = false;
    int ans = 0;
    rep(i, H-1) rep(j, W-1) {
        bool cur = S[i][j] != S[i+1][j];
        if (cur && !last) ans++;
        last = cur;
    }
    last = false;
    rep(j, W-1) rep(i, H-1) {
        bool cur = S[i][j] != S[i][j+1];
        if (cur && !last) ans++;
        last = cur;
    }
    cout << ans << endl;

    return 0;
}

#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <ctime>
#include <iostream>
#include <algorithm>
#include <queue>
#include <map>
#include <set>
#include <vector>
#include <string>
#include <stack>
#include <numeric>
#include <cassert>

#define endl '\n'
#define sp ' '

#define pb push_back
#define mp make_pair
#define ff first
#define ss second

using namespace std;

typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;

string arr[15];
int h,w;
int kk=0;

int gez(int i, int j, int fi , int fj, int pos){//pos 1sag 2sol 3yukari 4 asagi
    int ret = 0;
    //cerr << i << sp << j << sp << pos << endl;
    if(i==fi && j==fj && pos == 3){
        if(kk)
            return ret;
        kk++;
    }
    if(pos == 1){
        if(arr[i+1][j+1] == '#'){
            return 1 + gez(i+1,j+1,fi,fj,3);
        }
        if(arr[i+1][j] == '#'){
            return gez(i+1,j,fi,fj,1);
        }
        //if(arr[i][j-1] == '#'){
        //    return 1 + gez(i,j-1,fi,fj,4);
       // }
        return 1 + gez(i,j,fi,fj,4);
    }
    else if(pos == 2){
        if(arr[i-1][j-1] == '#'){
            return 1 + gez(i-1,j-1,fi,fj,4);
        }
        if(arr[i-1][j] == '#'){
            return gez(i-1,j,fi,fj,2);
        }
        //if(arr[i][j+1] == '#'){
       //     return 1 + gez(i,j,fi,fj,3);
       // }
        return 1 + gez(i,j,fi,fj,3);
    }
    else if(pos == 3){
        if(arr[i-1][j+1] == '#'){
            return 1 + gez(i-1,j+1,fi,fj,2);
        }
        if(arr[i][j+1] == '#'){
            return gez(i,j+1,fi,fj,3);
        }
       // if(arr[i+1][j] == '#'){
       //     return 1+gez(i,j,fi,fj,1);
       // }
        return 1 + gez(i,j,fi,fj,1);
    }
    else{ // pos == 4
        if(arr[i+1][j-1] == '#'){
            return 1 + gez(i+1,j-1,fi,fj,1);
        }
        if(arr[i][j-1] == '#'){
            return gez(i,j-1,fi,fj,4);
        }
       // if(arr[i-1][j] == '#'){
       //     return 1+gez(i,j,fi,fj,2);
      //  }
        return 1 + gez(i,j,fi,fj,2);
    }

}

int main(){

    ios_base::sync_with_stdio(false);cin.tie(nullptr);cout.tie(nullptr);cerr.tie(nullptr);
    cin>>h>>w;

    for(int i=0;i<h;i++)
        cin>>arr[i];

    int fi=-1, fj=-1;
    bool flag = false;
    for(int i=0;i<h;i++){
        for(int j=0;j<w;j++){
            if(arr[i][j] == '#'){
                fi = i;
                fj = j;
                flag = true;
                break;
            }
        }
        if(flag)
            break;
    }

    if(fi == -1 && fj == -1){
        cout << 0 << endl;
        exit(0);
    }
    //cerr << fi << sp << fj << endl;
    cout << gez(fi,fj,fi,fj,3) << endl;

}


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

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
const int mod = 1000 * 1000 * 1000 + 7;
const int INF = 1e9 + 100;
const ll LINF = 1e18 + 100;

#ifdef DEBUG
#define dbg(x) cout << #x << " = " << (x) << endl << flush;
#define dbgr(s, f) { cout << #s << ": "; for (auto _ = (s); _ != (f); _++) cout << *_ << ' '; cout << endl << flush; }
#else
#define dbg(x) ;
#define dbgr(s, f) ;
#endif
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define fast_io ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define all(x) (x).begin(), (x).end()
#define pb push_back
#define mp make_pair
#define fr first
#define sc second
#define endl '\n'

void tcase(void)
{
	int n;
	string s1, s2, s3;
	cin >> n >> s1 >> s2 >> s3;
	string ans;
	FOR(i, 0, n) ans += '0';
	FOR(i, 0, n) ans += '1';
	ans += '0';
	cout << ans << endl;
}

int32_t main(void)
{
	fast_io;
	int t;
	cin >> t;
	while (t--)
		tcase();
	return 0;
}

//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i=0; i<n; ++i)
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
using ll = int64_t;
using ull = uint64_t;
using ld = long double;
using P = pair<int, int>;
using vs = vector<string>;
using vi = vector<int>;
using vvi = vector<vi>;
template<class T> using PQ = priority_queue<T>;
template<class T> using PQG = priority_queue<T, vector<T>, greater<T>>;
const int INF = 0xccccccc;
const ll LINF = 0xcccccccccccccccLL;
template<typename T1, typename T2>
inline bool chmax(T1 &a, T2 b) {return a < b && (a = b, true);}
template<typename T1, typename T2>
inline bool chmin(T1 &a, T2 b) {return a > b && (a = b, true);}
template<typename T1, typename T2>
istream &operator>>(istream &is, pair<T1, T2> &p) { return is >> p.first >> p.second;}
template<typename T1, typename T2>
ostream &operator<<(ostream &os, const pair<T1, T2> &p) { return os << p.first << ' ' << p.second;}

//head

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int t;
  cin >> t;
  while(t--) {
    int n;
    cin >> n;
    vs s(3);
    rep(i, 3) cin >> s[i];
    bool u = true;
    vi z(3, -1);
    rep(i, 3) if(s[i][0] == '0' and s[i][2*n-1] == '0') {
      u = false;
      z[i] = 0;
    }
    if(u) {
      cout << string(n, '0') + "1" + string(n, '0') << '\n';
      continue;
    }
    u = true;
    rep(i, 3) if(s[i][0] == '1' and s[i][2*n-1] == '1') {
      u = false;
      z[i] = 1;
    }
    if(u) {
      cout << string(n, '1') + "0" + string(n, '1') << '\n';
      continue;
    }
    bool done = false;
    rep(i, 3) if(z[i] == -1) {
      if(s[i][0] == '0') {
        cout << "0" + string(n, '1') + string(n, '0') << '\n';
      }
      else {
        cout << "1" + string(n, '0') + string(n, '1') << '\n';
      }
      done = true;
    }
    if(not done) {
        cout << "0" + string(n, '1') + string(n, '0') << '\n';
    }
  }
}


#include <algorithm>
#include <cassert>
#include <cmath>
#include <deque>
#include <iostream>
#include <iterator>
#include <limits>
#include <map>
#include <numeric>
#include <set>
#include <string>
#include <tuple>
#include <type_traits>
#include <unordered_set>
#include <utility>
#include <vector>

using namespace std;
using i64 = int64_t;
using vi64 = vector<i64>;
using vvi64 = vector<vi64>;
using u64 = uint64_t;

#define rep(i, s, n) for (i64 i = (s); i < (n); ++i)

void run() {
  i64 n;
  cin >> n;
  vi64 ps(n);
  rep(i, 0, n) {
    cin >> ps[i];
    --ps[i];
  }
  vi64 ret{};
  i64 p{0};
  while (p < n - 1) {
    if (ps[p] == p) {
      cout << -1 << endl;
      return;
    }
    rep(i, p + 1, n) {
      if (ps[i] == p) {
        for (i64 j{i - 1}; p <= j; --j) {
          if (j < i - 1 && ps[j] != j + 1) {
            cout << -1 << endl;
            return;
          }
          ret.push_back(j);
        }
        ps[i] = ps[i - 1];
        p = i;
      }
    }
  }
  for (const auto x : ret) {
    cout << x + 1 << endl;
  }
}

int main() {
  cin.tie(nullptr);
  cout.precision(std::numeric_limits<double>::max_digits10);
  run();
  return 0;
}

//  Copyright 2021 Nikita Golikov

#include <bits/stdc++.h>

using namespace std;

using i64 = int64_t;
using ui64 = uint64_t;

template <class A, class B>
bool smin(A &x, B &&y) {
  if (y < x) {
    x = y;
    return true;
  }
  return false;
}

template <class A, class B>
bool smax(A &x, B &&y) {
  if (x < y) {
    x = y;
    return true;
  }
  return false;
}

int main() {
#ifdef GOLIKOV
  assert(freopen("in", "rt", stdin));
  auto _clock_start = chrono::high_resolution_clock::now();
#endif
  ios::sync_with_stdio(false);
  cin.tie(nullptr);

  int n;
  cin >> n;
  auto solve = [&](auto&& solve, int n) -> vector<string> {
    if (n == 1) {
      return {"AB"};
    }
    auto res = solve(solve, n - 1);
    auto resSz = int(res.size());
    vector<string> ans;
    for (auto const& s : res) {
      ans.push_back(s + s);
    }
    for (auto const& s : res) {
      auto is = s;
      for (auto& x : is) x = 'A' ^ 'B' ^ x;
      ans.push_back(s + is);
    }
    ans.push_back(string(1 << (n - 1), 'A') + string(1 << (n - 1), 'B'));
    return ans;
  };
  auto ans = solve(solve, n);
  cout << ans.size() << '\n';
  for (auto const& s : ans) cout << s << '\n';

#ifdef GOLIKOV
  cerr << "Executed in " << chrono::duration_cast<chrono::milliseconds>(
      chrono::high_resolution_clock::now()
          - _clock_start).count() << "ms." << endl;
#endif
  return 0;
}