#include<bits/stdc++.h>
#define FAST ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0)
#define dofloat cout<<fixed<<setprecision(8)
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define bitcount __builtin_popcount
#define all(vec) vec.begin(),vec.end()
#define rall(vec) vec.rbegin(),vec.rend()
using namespace std;
typedef long long ll;
typedef long double ld;
typedef vector<long long> vl;
typedef pair<long long,long long> pll;
typedef vector<pair<long long,long long> > vll;
typedef vector<pair<int,int> > vii;
typedef vector<int> vi;
typedef pair<int,int> ii;
const long long MOD=1000000007;
const long long MAX=100005;
const long double PI=3.14159265359;
const long double G=9.807;
const long long INF=1e18;
const long double EPS=1e-6;
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
bool isprime(ll a){
  if(a==2)return 1;
  if(!(a&1))return 0;
  for(ll i=3;i*i<=a;i+=2)
    if(a%i==0)return 0;
  return 1;
}
ll mpow(ll base,ll exponent,ll modulus){
  if(modulus==1)return 0;
  long long result = 1;
  base=base%modulus;
  while(exponent){
    if(exponent%2 == 1)
    result=(result*base)%modulus;
    exponent=exponent>>1;
    base=(base*base)%modulus;
  }
  return result;
}
ll minv(ll a,ll mod){
  ll _gcd=gcd(a,mod);
  assert(_gcd==1);
  return mpow(a,mod-2,mod);
}

/*
ll ncr(ll N,ll K){
  if(N<K)return 0;
  if(K==0)return 1;
  if(N==0)return 0;

  ll den=1;
  for(ll i=1;i<=K;i++)den*=i;
  ll num=1;
  while(K--){
    num*=N;
    if(num%den==0){
      num/=den;
      den=1;
    }
    N--;
  }

  return num;
}
*/
ll n;
int main(){FAST;
cin>>n;
cout<<6987268688401;
return 0;
}

/*
 WA? check edge cases, N=1,M=1 etc. Read code fully once and check all variables.
 Read the question again and see what you might have missed.
 Consider changing your solution or find more cases.
 */

#include <stdio.h>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <list>
#include <queue>
#include <stack>
#include <cmath>
#include <ctime>
#include <cstdio>
#include <vector>
#include <string>
#include <bitset>
#include <cctype>
#include <cstdlib>
#include <cstring>
#include <utility>
#include <numeric>
#include <complex>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <cassert>
#include <iostream>
#include <iterator>
#include <algorithm>
#include <functional>
//#include <atcoder/all>
//using namespace atcoder;
using namespace std;
typedef long long ll;
const double EPS = 1e-9;
typedef vector<int> vint;
typedef vector<vector<int>> v2int;
typedef vector<vector<vector<int>>> v3int;
typedef vector<ll> vll;
typedef vector<vector<ll>> v2ll;
typedef vector<vector<vector<ll>>> v3ll;
typedef list<int> liint;
typedef pair<int, int> pint;
typedef vector<pair<int, int>> vpint;
typedef vector<pair<ll, ll>> vpll;
typedef vector<pair<ll, int>> vpll_int;
typedef vector<pair<int, ll>> vpint_ll;
typedef set<pair<int, int>> spint;
typedef set<pair<ll, int>> spll;
typedef unordered_map<int, unordered_set<int>> Graph;
const int INF = int(2e9);
const ll LINF = ll(2e9) * ll(2e9);
#define rep(i, n) REP(i, 0, n)
#define ALL(v) v.begin(), v.end()
#define MSG(a) cout << #a << " " << a << endl;
#define REP(i, x, n) for(int i = x; i < n; i++)
template<class T, class C> void chmax(T& a, C b) { a > b ? : a = b; }
template<class T, class C> void chmin(T& a, C b) { a < b ? : a = b; }

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

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

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll N;
    cin >> N;
    ll lc = 1;
    REP(i, 2, N + 1) {
        lc = lcm(lc, i);
   }
    ll ans = lc + 1;
 /*   REP(i, 2, N + 1) {
        cout << ans % i << endl;
    }*/
    cout << ans << endl;
    return 0;
}


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

long long int MOD = 1000000007;

void mult(vector<vector<long long int>> &a, vector<vector<long long int>> &b, int n) {
    vector<vector<long long int>> c(n, vector<long long int>(n, 0));
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < n; j++) {
            for (int k = 0; k < n; k++) {
                c[i][j] += a[i][k] * b[k][j];
                c[i][j] %= MOD;
            }
        }
    }
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < n; j++) {
            a[i][j] = c[i][j];
        }
    }
}

void bin_mat(vector<vector<long long int>> &m, long long int e, int n, vector<vector<long long int>> &temp) {
    if (e == 0)
        return;
    if (e == 1)
        return;

    bin_mat(m, e / 2, n, temp);
    mult(m, m, n);
    if (e % 2)
        mult(m, temp, n);
}

long long int bin_pow(long long int b, long long int e) {
    if (e == 0) return 1;

    long long int temp = bin_pow(b, e / 2);
    temp = temp * temp % MOD;
    if (e % 2)
        return temp * b % MOD;
    return temp;
}

void solve() {
    int n,m,k; cin >> n >> m >> k;
    vector<long long int> num(n);
    for (int i = 0; i < n; i++) {
        cin >> num[i];
    }
    vector<vector<int>> graph(n);
    for (int i = 0; i < m; i++) {
        int a,b; cin >> a >> b;
        a--; b--;
        graph[a].push_back(b);
        graph[b].push_back(a);
    }

    vector<vector<long long int>> mat(n, vector<long long int>(n, 0));

    for (int i = 0; i < n; i++) {
        int cnt = m - graph[i].size();
        mat[i][i] += 2 * cnt % MOD;
        for (auto j: graph[i]) {
            mat[i][i]++;
            mat[i][j]++;
        }
    }
    vector<vector<long long int>> temp = mat;
    bin_mat(mat, k, n, temp);

    if (k > 0) {
        vector<long long int> ans(n, 0);
        for (int i = 0; i < n; i++) {
            for (int j = 0; j < n; j++) {
                ans[i] += mat[i][j] * num[j] % MOD;
                ans[i] %= MOD;
            }
        }

        long long int val = bin_pow(2 * m, k);
        val = bin_pow(val, MOD - 2);
        for (int i = 0; i < n; i++) {
            cout << ans[i] * val % MOD << '\n';
        }
    } else {
        for (int i = 0; i < n; i++)
            cout << num[i] % MOD << '\n';
    }

}

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

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

    return 0;
}

#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<utility>
#include<set>
#include<stack>
#include<list>
#include<deque>
#include<bitset>
#include<iomanip>
#include<cstring>
#include<sstream>
#include<cstdio>
#include<cstdlib>
#include<climits>
#include<cmath>
#include<cctype>

#define pb push_back
#define mp make_pair
#define rep(i,a,b) for(int i=a;i<=b;i++)
#define ren(i,a,b) for(int i=a;i>=b;i--)
#define ff first
#define ss second
#define pll pair<long long int,long long int>
#define pii pair<int,int>
#define vll vector<long long int>
#define vii vector<int>
#define gi(n) scanf("%d",&n)
#define gll(n) scanf("%lld",&n)
#define gstr(n) scanf("%s",n)
#define gl(n) cin >> n
#define oi(n) printf("%d",n)
#define oll(n) printf("%lld",n)
#define ostr(n) printf("%s",n)
#define ol(n) cout << n
#define os cout<<" "
#define on cout<<"\n"
#define o2(a,b) cout<<a<<" "<<b
#define all(n) n.begin(),n.end()
#define present(s,x) (s.find(x) != s.end())
#define cpresent(s,x) (find(all(s),x) != s.end())
#define tr(container, it) for(__typeof(container.begin()) it = container.begin(); it != container.end(); it++)
using namespace std;

typedef unsigned long long int ull;
typedef long long int ll;
typedef long double ld;
typedef vector<vector<ll> > mat;

ll mod=1e9+7;
mat I;

mat mul(mat a,mat b)
{
	int n=a.size();
	mat c(n,vll(n));
	rep(i,0,n-1)rep(j,0,n-1)rep(k,0,n-1)
	{
		c[i][j]=(c[i][j]+a[i][k]*b[k][j])%mod;
	}
	return c;
}

ll p(ll a,ll b)
{
	ll r=1;
	while(b)
	{
		if(b%2)r=(r*a)%mod;
		a=(a*a)%mod;
		b/=2;
	}
	return r;
}

mat p(mat a,ll b)
{
	mat r=I;
	while(b)
	{
		if(b%2)
		r=mul(r,a);
		a=mul(a,a);
		b/=2;
	}
	return r;
}
ll n,m,k,e[105][105],a[105];

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

I.resize(n);
rep(i,0,n-1)
{
	I[i].resize(n);
	I[i][i]=1;
}

rep(i,0,n-1)cin>>a[i];

rep(i,0,m-1)
{
	int x,y;
	cin>>x>>y;
	x--;y--;
	e[x][y]=1;
	e[y][x]=1;
}
mat prod(n,vll(n));

rep(i,0,n-1)
{
	ll ed=0;
	rep(j,0,n-1)ed+=e[i][j];
	prod[i][i]=(2*m-ed)%mod;
	rep(j,0,n-1)if(e[i][j])prod[i][j]=1;
}
prod=p(prod,k);

ll den=p(2*m,k);
den=p(den,mod-2);

rep(i,0,n-1)
{
	ll ans=0;
	rep(j,0,n-1)
	{
		ans=(ans+prod[i][j]*a[j])%mod;
	}
	ans=(ans*den)%mod;
	ol(ans);on;
}
return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define all(c) c.begin(),c.end()
#define sz(x) int(x.size())
#define ar array
typedef long long ll ;
typedef vector<int> vi;
#define mod 1000000007
mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());
ll exp(ll x,ll y){
  x%=mod;
  ll res=1;
  while(y){
    if(y&1)
    res=res*x%mod;
    x=x*x%mod;
    y>>=1;
  }
  return res;
}
ll fact(ll n){
  ll res=1;
  for(ll i=2;i<=n;i=i+1)
  (res*=i)%=mod;
  return res;
}
bool isprime(ll n){
  if(n<=1) return 0;
  for(ll i=2;i*i<=n;++i)
  if(n%i==0) return 0;
  return 1;
}

int main() {
//freopen("input.txt","r",stdin);
//freopen("output.txt","w",stdout);
ios_base::sync_with_stdio(false);
cin.tie(0); cout.tie(0);
int n,k;
cin>>n>>k;
int sum=0;
for(int i=1;i<=n;++i){
  for(int j=1;j<=k;++j) sum+=i*100+j;
}
cout<<sum;
return 0;
}

#include <cmath>
#include <deque>
#include <algorithm>
#include <iterator>
#include <list>
#include <tuple>
#include <map>
#include <unordered_map>
#include <queue>
#include <set>
#include <unordered_set>
#include <stack>
#include <string>
#include <vector>
#include <fstream>
#include <iostream>
#include <functional>
#include <numeric>
#include <iomanip>
#include <stdio.h>
//end of libraries
#define lnf 3999999999999999999
#define inf 999999999
#define PI 3.14159265359
#define endl "\n"
#define fi first
#define se second
#define pb push_back
#define ll long long
#define all(c) (c).begin(),(c).end()
#define sz(c) (int)(c).size()
#define mkp(a,b) make_pair(a,b)
#define make_unique(a) sort(all(a)),a.erase(unique(all(a)),a.end())
#define rsz(a,n) a.resize(n)
#define pii pair <int,int>
#define rep(i,n) for(int i = 0 ; i < n ; i++)
#define drep(i,n) for(int i = n-1 ; i >= 0 ; i--)
#define crep(i,x,n) for(int i = x ; i < n ; i++)
#define fcin ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0);

const int max_n = 5500;

using namespace std;
ll mod = 998244353 , fact[max_n];
ll binpow(ll a, ll b) {
  a %= mod; ll res = 1;
  while (b) { if (b%2) res = res * a % mod; a = a * a % mod; b /= 2; }
  return res % mod;
}
void dofact() {
  fact[0]=fact[1]=1;
  rep(i,max_n-3){
    if(i>1)fact[i] = fact[i-1]*i; fact[i] %= mod;
  }
}

ll cnk(ll k , ll n){
  if(k>n) return 0;
  return (fact[n] * binpow(fact[k]*fact[n-k]%mod,mod-2)) % mod;
}
ll sub(ll a , ll b){
  a%=mod; b%=mod;
  return (((a-b)%mod)+mod)%mod;
}
ll prod(ll a , ll b){
  a%=mod; b%=mod;
  return ((a*b)%mod);
}

ll add(ll a , ll b){
  a%=mod; b%=mod;
  return (a+b)%mod;
}

ll dp[max_n] , nedp[max_n];

vector <ll> a;

int n,m;

void read() {
	cin >> n >> m;
	int x = 1;
	while(x<=m) {
		a.pb(x);
		x*=2;
	}
}

int main(){
fcin;
dofact();

	read();

	dp[0] = 1;

	rep(idx,sz(a)){
		int i = a[idx];
		rep(j,m+1) nedp[j]=dp[j];
		for(int j = 0 ; j <= m ; j++) {
			if(dp[j]==0) continue;
			int x = 2;
			while(j+x*i <= m) {
				int nxt = j+x*i;
				nedp[nxt] = add(nedp[nxt],prod(dp[j],cnk(x,n)));
				x+=2;
			}
		}
		rep(j,m+1) dp[j] = nedp[j];
		// rep(j,m+1) {
		// 	cout << dp[j] << " ";
		// }cout << "\n";
	}

	cout << dp[m] << "\n";
/*
*/

    return 0;
}


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

#ifdef LOCAL
#define DEBUG(...) debug(#__VA_ARGS__, __VA_ARGS__)
#else
#define DEBUG(...) 6
#endif

template<typename T, typename S> ostream& operator << (ostream &os, const pair<T, S> &p) {return os << "(" << p.first << ", " << p.second << ")";}
template<typename C, typename T = decay<decltype(*begin(declval<C>()))>, typename enable_if<!is_same<C, string>::value>::type* = nullptr>
ostream& operator << (ostream &os, const C &c) {bool f = true; os << "["; for (const auto &x : c) {if (!f) os << ", "; f = false; os << x;} return os << "]";}
template<typename T> void debug(string s, T x) {cerr << s << " = " << x << "\n";}
template<typename T, typename... Args> void debug(string s, T x, Args... args) {for (int i=0, b=0; i<(int)s.size(); i++) if (s[i] == '(' || s[i] == '{') b++; else
if (s[i] == ')' || s[i] == '}') b--; else if (s[i] == ',' && b == 0) {cerr << s.substr(0, i) << " = " << x << " | "; debug(s.substr(s.find_first_not_of(' ', i + 1)), args...); break;}}

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

    long long n;
    cin >> n;

    vector<long long> f{1, 2};
    while (f.back() < n)
        f.push_back(f[f.size()-2] + f[f.size()-1]);

    vector<int> ret;
    for (int i=0; i<(int)f.size(); i++) {
        while (n >= f[f.size()-i-1]) {
            ret.push_back(1 + (i % 2 != f.size() % 2));
            n -= f[f.size()-i-1];
        }
        ret.push_back(3 + (i % 2 == f.size() % 2));
    }

    cout << ret.size() << "\n";
    for (int x : ret)
        cout << x << "\n";

    return 0;
}

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

template<typename T>
ostream& operator<<(ostream &os, vector<T> &v){
    string sep = " ";
    if(v.size()) os << v[0];
    for(int i=1; i<v.size(); i++) os << sep << v[i];
    return os;
}

template<typename T>
istream& operator>>(istream &is, vector<T> &v){
    for(int i=0; i<v.size(); i++) is >> v[i];
    return is;
}

#ifdef DBG
void debug_(){ cout << endl; }
template<typename T, typename... Args>
void debug_(T&& x, Args&&... xs){
    cout << x << " "; debug_(forward<Args>(xs)...);
}
#define dbg(...) debug_(__VA_ARGS__)
#else
#define dbg(...)
#endif

int main() {
    ios_base::sync_with_stdio(false);
    cout << setprecision(20) << fixed;
    ll n; cin >> n;

    ll x = 3;
    for(int a=1; x<n; a++,x*=3){
        ll m = n-x;
        int b = 0;
        while(m%5==0){
            m /= 5;
            b++;
        }
        if(m==1&&b>0){
            cout << a << " " << b << endl;
            return 0;
        }
    }
    cout << -1 << endl;
    return 0;
}


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

int n;
long long a[200010],b[200010];
long long c[200010];
int main(void)
{
    scanf("%d",&n);
    for (int i=1;i<=n;i++)
    scanf("%lld",&a[i]);
    for (int i=1;i<=n;i++)
    scanf("%lld",&b[i]);
    long long ans = 0;
    long long maxa=0,maxb=0;
    for (int i=1;i<=n;i++)
    {
        ans = max(ans,a[i]*b[i]);
        ans = max(ans,maxa*b[i]);
        // ans = max(ans,maxb*a[i]);
        c[i] = ans;
        maxa = max(maxa,a[i]);
        // maxb = max(maxb,b[i]);
    }
    for (int i=1;i<=n;i++)
    printf("%lld\n",c[i]);
    return 0;
}

#include <bits/stdc++.h>
using namespace std;
#define M 1000000007
#define U 998244353
#define N 1000005
#define int long long
#define sz(c) (int)c.size()
#define fr first
#define ll long long
#define sc second
#define pb push_back
#define ppb pop_back
#define mp make_pair
#define all(a) (a).begin(),(a).end()
#define rep(i,a,n) for(int i=a ; i<n ; i++)
#define r0 return 0;
#define endl '\n'
#define INF (int)1e15

/* Debug Begins */
# define trace(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); \
  stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }
string to_string(char c) { return "'" + string(1, c) + "'";}
string to_string(string s) { return '"' + s + '"';}
string to_string(bool f) { if(f) return "True"; else return "False";}
string to_string(const char* s) { return to_string((string) s);}
template<typename A> string to_string(A);
template<typename A, typename B> string to_string(pair<A, B> p){
  return "(" + to_string(p.first) + ": " + to_string(p.second) + ")";}
template<typename A> string to_string(A v) {bool f = false; string r = "{";
  for (auto x: v) {if (f) r += ", "; r += to_string(x); f = true;} return r += "}";}
template<typename A> string to_string(vector<vector<A>> v) {string r;
  for (auto x: v) r += "\n" + to_string(x); return r;}
int Nerr;
template<typename A> string to_string(A *p) {return to_string(vector<A>(p, p + Nerr));}
void err(istream_iterator<string>) { cerr << endl; }
template<typename T,typename... Args> void err(istream_iterator<string> it, T a, Args... args) {
  cerr << *it << " = " << to_string(a) << "; "; err(++it, args...); }
template<typename T> void kek(T ans) {cout << ans << endl; exit(0);}
#define Lu(...) [&] (auto &&u) { return __VA_ARGS__; }
#define Luv(...) [&] (auto &&u, auto &&v) { return __VA_ARGS__; }
/***************************************************************/

bool sortbysec(const pair<int,int> &a,
              const pair<int,int> &b)
{
    return (a.second < b.second);
}

signed main()
{
    ios_base::sync_with_stdio(0);
    int TESTS=1;
    // cin>>TESTS;
    while(TESTS--)
    {
        double ans = 0;
        int n;
        cin >> n;
        rep(i,1,n) ans += n*1.0/i;
        cout << fixed << setprecision(10) << ans << endl;
    }
}


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

	void fast() {
	    ios_base::sync_with_stdio(false);
	    cin.tie(NULL);
	}

	vector<string> vec_splitter(string s) {
		s += ',';
		vector<string> res;
		while(!s.empty()) {
			res.push_back(s.substr(0, s.find(',')));
			s = s.substr(s.find(',') + 1);
		}
		return res;
	}

	void debug_out(
	vector<string> __attribute__ ((unused)) args,
	__attribute__ ((unused)) int idx,
	__attribute__ ((unused)) int LINE_NUM) { cerr << endl; }
	template <typename Head, typename... Tail>
	void debug_out(vector<string> args, int idx, int LINE_NUM, Head H, Tail... T) {
		if(idx > 0) cerr << ", "; else cerr << "Line(" << LINE_NUM << ") ";
		stringstream ss; ss << H;
		cerr << args[idx] << " = " << ss.str();
		debug_out(args, idx + 1, LINE_NUM, T...);
	}

	#ifdef LOCAL
	#define debug(...) debug_out(vec_splitter(#__VA_ARGS__), 0, __LINE__, __VA_ARGS__)
	#else
	#define debug(...) 42
	#endif

	double get_time() {
		return 1.0 * clock() / CLOCKS_PER_SEC;
	}

	const int MAX = 2E5 + 100, INF = 1E9 + 5;

	int n, k;
	vector<vector<int>> adj(MAX), at_h(MAX);
	int h[MAX], dp1[MAX], dp2[MAX];

	int DFS(int u, int p, int d) {
		int ret = 0;
		for(int v : adj[u]) {
			if(v == p)
				continue;
			ret += DFS(v, u, d);
			if(dp1[v] > -1 && dp1[v] < d) {
				if(dp1[u] == -1 || dp1[u] > dp1[v] + 1)
					dp1[u] = dp1[v] + 1;
			}
			if(dp2[v] > -1) {
				dp2[u] = max(dp2[u], dp2[v] + 1);
			}
			// h[u] = max(h[u], h[v] + 1);
		}

		if(dp2[u] > -1 && dp1[u] > -1 && d - dp1[u] >= dp2[u]) {
			dp2[u] = -1;
		}

		if(dp2[u] == d || (u == 0 && (dp1[u] == -1 || dp2[u] > -1))) {
			ret++;
			dp2[u] = -1;
			dp1[u] = 0;
		}

		if(dp1[u] == -1 && dp2[u] == -1) {
			dp2[u] = 0;
		}

		// if(dp2[u] == d || (u == 0 && (dp2[u] > -1 || dp1[u] == -1))) {
		// 	ret++;
		// 	dp2[u] = -1;
		// 	dp1[u] = 0;
		// }

		return ret;
	}

	int min_need(int d) {
		// int ret = 0;
		// int cur = -(d + 1);
		// while(h[0] >= cur + d + 1) {
		// 	cur += 2*d + 1;
		// 	ret += at_h[cur].size();
		// }
		// if(cur != h[0])
		// 	ret += 1;
		// return ret;
		fill(begin(dp1), end(dp1), -1);
		fill(begin(dp2), end(dp2), -1);
		return max(1, DFS(0, -1, d));
	}

	int main() {
		cin >> n >> k;
		for(int i = 0; i < n - 1; i++) {
			int u, v;
			cin >> u >> v;
			--u, --v;
			adj[u].push_back(v);
			adj[v].push_back(u);
		}
		// DFS(0, -1);

		// for(int i = 0; i < n; i++)
		// 	at_h[h[i]].push_back(i);
		int lo = 1, hi = n - 1;
		while(lo < hi) {
			int mid = (lo + hi) / 2;
			if(min_need(mid) > k)
				lo = mid + 1;
			else
				hi = mid;
		}

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

#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <cmath>
#include <cstring>
#include <deque>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <optional>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>

#ifdef ENVIRONMENT_LINKED_BOOST
#include <boost/multiprecision/cpp_dec_float.hpp>
#include <boost/multiprecision/cpp_int.hpp>
#endif

using namespace std;
using uint  = unsigned int;
using ll    = long long;
using ull   = unsigned long long;
using lpair = std::pair<ll, ll>;
#define REP(i, a, b)    for (ll i = a; i < b; ++i)
#define REPREV(i, a, b) for (ll i = a; i > b; --i)

const int _ = []() {
    std::cin.tie(nullptr);
    std::ios::sync_with_stdio(false);
    std::cout << std::fixed << std::setprecision(10);
    return 0;
}();

template <typename value_t>
void resize(value_t& v, const value_t& val) { v = val; }
template <typename vec_t, typename value_t, typename... arg_t>
void resize(std::vector<vec_t>& v, const value_t& val, int size, arg_t... arg) {
    v.resize(size);
    for (auto& c : v) resize(c, val, arg...);
}
template <typename A, typename B>
void chmin(A& a, const B& b) { a = min(a, static_cast<A>(b)); };
template <typename A, typename B>
void chmax(A& a, const B& b) { a = max(a, static_cast<A>(b)); };

vector<vector<int>> link;

/*
(x,y)

x
まだ被覆されてない最遠の頂点とparの距離
存在しなければ0

y
parから距離y以下の頂点は無条件で被覆される
存在しなければ負の値
*/
pair<int, int> dfs(int ind, int par, int& ans, int range) {
    int x = 0;
    int y = -1;
    for (int c : link[ind]) {
        if (c == par) continue;
        auto ret = dfs(c, ind, ans, range);
        chmax(x, ret.first);
        chmax(y, ret.second);
    }
    if (x == range) {
        ++ans;
        return {0, range - 1};
    }
    if (x <= y) {
        return {0, y - 1};
    }
    return {x + 1, y - 1};
}

int score(int range) {
    int ans  = 0;
    auto ret = dfs(0, -1, ans, range);
    if (ret.first) ++ans;
    return ans;
}

int main() {
    int N, K;
    cin >> N >> K;
    link.resize(N);
    REP(i, 0, N - 1) {
        int a, b;
        cin >> a >> b;
        --a;
        --b;
        link[a].push_back(b);
        link[b].push_back(a);
    }
    int l = -1;
    int r = N;
    while (r - l > 1) {
        int mid                   = l + (r - l) / 2;
        (score(mid) <= K ? r : l) = mid;
    }
    cout << r << endl;

    return 0;
}


#include "bits/stdc++.h"
#define int long long
#define endl '\n'
using namespace std;

typedef long long ll;
typedef long double ld;
#define db(x) cerr << #x << ": " << x << '\n';
#define read(a) int a; cin >> a;
#define reads(s) string s; cin >> s;
#define readb(a, b) int a, b; cin >> a >> b;
#define readc(a, b, c) int a, b, c; cin >> a >> b >> c;
#define readarr(a, n) int a[(n) + 1] = {}; FOR(i, 1, (n)) {cin >> a[i];}
#define readmat(a, n, m) int a[n + 1][m + 1] = {}; FOR(i, 1, n) {FOR(j, 1, m) cin >> a[i][j];}

#define print(a) cout << a << endl;
#define printarr(a, n) FOR (i, 1, n) cout << a[i] << " "; cout << endl;
#define printv(v) for (int i: v) cout << i << " "; cout << endl;
#define printmat(a, n, m) FOR (i, 1, n) {FOR (j, 1, m) cout << a[i][j] << " "; cout << endl;}
#define all(v) v.begin(), v.end()
#define sz(v) (int)(v.size())
#define rz(v, n) v.resize((n) + 1);
#define pb push_back
#define fi first
#define se second
#define vi vector <int>
#define pi pair <int, int>
#define vpi vector <pi>
#define vvi vector <vi>
#define setprec cout << fixed << showpoint << setprecision(20);
#define FOR(i, a, b) for (int i = (a); i <= (b); i++)
#define FORD(i, a, b) for (int i = (a); i >= (b); i--)
const ll inf = 1e18;
const ll mod = 1e9 + 7;
const ll N = 2e5 + 1;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

int power (int a, int b = mod - 2)
{
    int res = 1;
    while (b > 0) {
        if (b & 1)
            res = res * a % mod;
        a = a * a % mod;
        b >>= 1;
    }
    return res;
}

vi adj[101], vis;
int cnt = 0;

void dfs (int cur)
{
    cnt++;
    vis[cur] = 1;
    for (int i: adj[cur])
        if (!vis[i]) dfs(i);
}

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

	read(n);
	FOR (i, 1, n)
	{
	    reads(s);
	    FOR (j, 1, n)
	        if (s[j - 1] == '1') adj[j].pb(i);
	}

	ld ans = 0;
	FOR (i, 1, n)
	{
	    vis.assign(n + 1, 0);
	    cnt = 0;
	    dfs(i);
	    ans += 1/(ld)(cnt);
	}

	setprec;
	print(ans);
}

#include<bits/stdc++.h>
using namespace std;
#pragma region atcoder
//#include <atcoder/all>
//using namespace atcoder;
//using mint = modint998244353;
//using mint = modint1000000007;
#pragma endregion
#pragma region macros
using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using vi = vector<int>;
using vs = vector<string>;
using vl = vector<ll>;
using vb = vector<bool>;
using vvi = vector<vector<int>>;
using vvl = vector<vector<ll>>;
#define rep(i, n) for(int i = 0; i < n; i++)
#define rrep(i, n) for(int i = n - 1; i >= 0; i--)
#define all(x) (x).begin(), (x).end()
#define sz(x) ((int)(x).size())
#define dame { puts("No"); return 0;}
#define y_n {puts("Yes");}else{puts("No");}
#pragma endregion
#pragma region debug for var, v, vv
#define debug(var)  do{std::cout << #var << " : ";view(var);}while(0)
template<typename T> void view(T e){std::cout << e << std::endl;}
template<typename T> void view(const std::vector<T>& v){for(const auto& e : v){ std::cout << e << " "; } std::cout << std::endl;}
template<typename T> void view(const std::vector<std::vector<T> >& vv){cout << endl;int cnt = 0;for(const auto& v : vv){cout << cnt << "th : "; view(v); cnt++;} cout << endl;}
#pragma endregion

const ll mod = 1000000007;
const int inf = 1001001001;
const ll INF = 1001001001001001001;
const int MAX = 2000005;

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

template<class T>bool chmax(T &a, const T b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T b) { if (b<a) { a=b; return 1; } return 0; }
ll modpow(ll a, ll p){ll ret = 1; while(p){if(p & 1){ret = ret * a % mod;} a = a * a % mod; p >>= 1;} return ret;}

/*--------------------------------------------------------------------------------------------------------------------------------*/
ll dist[20][20];
ll dp[(1<<20) + 1][21];
int n;
ll rec(int bit, int v)
{
    // すでに探索済みだったらリターン
    if (dp[bit][v] != -1) return dp[bit][v];

    // 初期値
    if (bit == (1<<v)) {
        return dp[bit][v] = 0;
    }

    // 答えを格納する変数
    ll res = INF;

    // bit の v を除いたもの
    int prev_bit = bit & ~(1<<v);

    // v の手前のノードとして u を全探索
    for (int u = 0; u < n; ++u) {
        if (!(prev_bit & (1<<u))) continue; // u が prev_bit になかったらダメ

        // 再帰的に探索
        if (res > rec(prev_bit, u) + dist[u][v]) {
            res = rec(prev_bit, u) + dist[u][v];
        }
    }
    return dp[bit][v] = res; // メモしながらリターン
}

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	cin >> n;
	vl x(n), y(n), z(n);
	rep(i,n) cin >> x[i] >> y[i] >> z[i];
	rep(i,n) rep(j,n) dist[i][j] = abs(x[i] - x[j]) + abs(y[i] - y[j]) + max(0ll, z[j] - z[i]);
	for (int bit = 0; bit < (1<<n); ++bit){
		for (int v = 0; v < n; ++v){
			dp[bit][v] = -1;
			if(__builtin_popcount(bit) == 1 && (bit & (1 << v))){
				dp[bit][v] = dist[0][v];
			}
		}
	}
	ll res = rec((1<<n)-1, 0);
	cout << res << endl;
}


#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using pll = pair<ll,ll>;
using pld = pair<ld,ld>;
using vll = vector<ll>;
using vld = vector<ld>;
#define _GLIBCXX_DEBUG
#define rep(j, m) for (ll j = 0; j < (ll)(m); j++)
#define rep2(i, l, n) for (ll i = l; i < (ll)(n); i++)
#define all(v) v.begin(), v.end()
const ld PI = 3.1415926535897932;
const ll MOD = 1000000007;
const ll MOD2 = 998244353;

int main() {
    ll H,W;
    cin >> H >> W;
    vector<string> V(H);
    rep(i,H) {cin >> V[i];}
    vll B(H,0);
    vll b(W,0);
    ll ans = 0;
    rep(i,H) {
        if (B[i] == 0) {
            ll flag = 0;
            queue<ll> Q;
            Q.push(i);
            B[i]++;
            while(Q.size()) {
                rep(j,W) {
                    if (V[Q.front()][j] == '#' && b[j] == 0) {
                        b[j]++;
                        if (j == 0 || j == W - 1) {flag++;}
                        rep(k,H) {
                            if (V[k][j] == '#') {
                                if (B[k] == 0) {
                                    Q.push(k);
                                    B[k]++;
                                }
                            }
                        }
                    }
                }
                if (Q.front() == 0 || Q.front() == H - 1) {flag++;}
                Q.pop();
            }
            if (flag == 0) {
                ans++;
            }
        }
    }
    vll C(W,0);
    vll c(H,0);
    ll ans2 = 0;
    rep(i,W) {
        if (C[i] == 0) {
            ll flag = 0;
            queue<ll> Q;
            Q.push(i);
            C[i]++;
            while(Q.size()) {
                rep(j,H) {
                    if (V[j][Q.front()] == '#' && c[j] == 0) {
                        c[j]++;
                        if (j == 0 || j == H - 1) {flag++;}
                        rep(k,W) {
                            if (V[j][k] == '#') {
                                if (C[k] == 0) {
                                    Q.push(k);
                                    C[k]++;
                                }
                            }
                        }
                    }
                }
                if (Q.front() == 0 || Q.front() == W - 1) {flag++;}
                Q.pop();
            }
            if (flag == 0) {
                ans2++;
            }
        }
    }
    cout << min(ans,ans2) << endl;
}

#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <list>
#include <map>
#include <set>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <stack>
#include <functional>
#include <algorithm>
#include <cmath>
#include <tuple>
#if defined _DEBUG
#include "TestCase.h"
#include "Util.h"
#endif

using namespace std;

typedef int64_t ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ll, int> plli;
typedef tuple<int, int, int> tiii;

#define PI 3.14159265358979

static const int Mod = 1000000007;

bool Next(vector<int> &border, int maxNum)
{
	int size = border.size();
	int i = 1;
	bool ret = true;
	if (border[size - i] < maxNum - i + 1)
	{
		border[size - i]++;
	}
	else if (size == i)
	{
		ret = false;
	}
	else
	{
		bool flag = true;
		while (flag)
		{
			i++;
			if (border[size - i] < maxNum - i + 1)
			{
				border[size - i]++;
				for (int j = i - 1; j >= 1; j--)
				{
					border[size - j] = border[size - j - 1] + 1;
				}
				flag = false;
			}
			else if (i == size)
			{
				flag = false;
				ret = false;
			}
		}
	}

	return ret;
}

int main(void)
{
#if 0
	vector<pair<ll, ll>> format(2);
	//format[0] = make_pair(1, 1000000000);
	format[0] = make_pair(1, 100);
	format[1] = make_pair(1, 100);
	TestCase::MakeRandom(30, format);
	return 0;
#endif
	int N;
	cin >> N;
	vector<int> A(N);
	for (int i = 0; i < N; i++)
		cin >> A[i];

	// 分割ナシ
	int minval = A[0];
	for (int i = 1; i < N; i++)
	{
		minval |= A[i];
	}

	// 分割アリ
	for (int S = 2; S <= N; S++)	// 分割数
	{
		vector<int> border(S-1);	// 境界
		// 境界の初期化
		for (int i = 1; i < S; i++)
		{
			border[i - 1] = i;
		}
		//do
		//{
		//	for (int b : border)
		//		cout << b << " ";
		//	cout << endl;
		//} while (Next(border, N));
		do
		{
			//cout << "border : ";
			//	for (int b : border)
			//		cout << b << " ";
			//	cout << endl;
			vector<int> vals(S);
			int begin = 0;
			for (int s = 0; s < S && begin < N; s++)
			{
				int end;
				if (s < border.size())
					end = border[s];
				else
					end = N;
				vals[s] = A[begin];
				for (int i = begin; i < end; i++)
				{
					vals[s] |= A[i];
				}
				begin = end;
				//cout << "vals[" << s << "] = " <<  vals[s] << " ";
			}
			//cout << endl;
			int val = vals[0];
			for (int s = 1; s < S; s++)
			{
				val = val ^ vals[s];
			}
			minval = min(minval, val);
		}
		while (Next(border, N));
	}

	cout << minval << endl;

	return 0;
}


#include<iostream>
using namespace std;

int main()
{
int a,n,b,c;
cin>>a>>n>>b;
c=a-n+b;
cout<<c;
    return 0;
}

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

#define rep(x,k,n)      for(int x=(k); x<(n); ++x)
#define repr(x,k,n)     for(int x=(k); x>(n); --x)
#define tr(it,a)        for(auto it = (a).begin(); it != (a).end(); ++it)
#define ll              long long
#define siz(x)          ((int)(x).size())
#define print(x)        cout << x << '\n'
#define prints(x)       cout << x << " "
#define eb              emplace_back
#define mp              make_pair
#define F               first
#define S               second
#define o2(x)           ((x)*(x))
#define all(x)          (x).begin(), (x).end()
#define allr(x)         (x).rbegin(), (x).rend()
#define clr(x,k)        memset((x), (k), sizeof((x)))
#define sortall(x)      sort(all(x))
#define sortalld(x)     sort(all(x), greater<int>())
#define printv(v)       rep(x, 0, siz(v)){prints(v[x]);}cout<<'\n'
#define print2dv(V)     rep(y, 0, siz(V)){printv(V[y]);}
#define out(x)          cout << ((x) ? "YES" : "NO") << '\n';
#define PI              3.1415926535897932384626
#define inf             INT_MAX
#define ninf            INT_MIN
#define int             long long

typedef pair<int,int>   pii;
typedef pair<ll,ll>     pll;
typedef vector<int>     vi;
typedef vector<ll>      vl;
typedef vector<char>    vc;
typedef vector<bool>    vb;
typedef vector<pii>     vpii;
typedef vector<pll>     vpll;
typedef vector<vi>      vvi;
typedef vector<vl>      vvl;
typedef vector<vc>      vvc;
typedef vector<vb>      vvb;
typedef vector<vpii>    vvpii;

template <typename Arg1>
void debug_out(const char* name, Arg1&& arg1){
    cout << name << " = " << arg1  << " ]" << '\n';
}
template <typename Arg1, typename... Args>
void debug_out(const char* names, Arg1&& arg1, Args&&... args){
    const char* comma = strchr(names + 1, ',');
    cout.write(names, comma - names) << " = " << arg1 <<",";
    debug_out(comma+1, args...);
}

#ifndef ONLINE_JUDGE
#define deb(...) cout << "[ ", debug_out(#__VA_ARGS__, __VA_ARGS__)
#else
#define deb(...)
#endif

mt19937_64 rang(chrono::high_resolution_clock::now().time_since_epoch().count());

const int mod = 1e9+7;
const int N = 3e5, M = N;

/*
->Do not forget to check the edge cases.
->Make sure you are submitting the right file.
->Do not make "easy->complicated".
*/

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

void Solve_main() {
    int n, m, k;

    cin >> n >> m >> k;
    cout << n - m + k << '\n';
}

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

int32_t main() {
    ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
    srand(chrono::high_resolution_clock::now().time_since_epoch().count());

    // cout << setprecision(12) << fixed;
    int tc = 1;
    // cin >> tc;
    while(tc--) {
        Solve_main();
    }

    cerr<<"[time:"<<1.0*clock()/CLOCKS_PER_SEC<<"s] ";
    return 0;
}


/*

  Author: klmcoder
  Date  : 20210213 1834 hrs.
  Info  : atcoder [arc112-A]

*/
#include <iostream>

int main(void)
{
  int t, a, b;
  long v1;
  unsigned long v2;

  std::cin >> t;
  while(t--)
  {
    std::cin >> a >> b;
    v1 = b - 2*(long)a + 1;
    if(v1<0)
      std::cout << "0\n";
    else
    {
      v2=(v1%2==0)?v1/2:(v1+1)/2;
      v2*=(v1%2==0)?(unsigned long)v1+1:v1;
      std::cout << v2 << "\n";
    }
  }

  return 0;
}

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

const ll mod = 1e9 + 7;

void solve() {
  ll l, r;
  cin >> l >> r;
  if (r < 2 * l) {
    cout << 0 << endl;
    return;
  }
  cout << (1 + r - 2*l + 1) * (r - 2*l + 1) / 2 << endl;
}

int main(void) {
  int t;
  cin >> t;
  for(int i = 0;i < t;++i) {
    solve();
  }
  return 0;
}


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

int main(){
    string S;
    cin>>S;
    list<char> l;
    int mode=0;
    for(int i=0;i<S.size();i++){
        if(S[i]=='R') mode=1-mode;
        else{
            if(S.size()==0) l.emplace_back(S[i]);
            else{
                if(mode==0){
                    char a=*(l.rbegin());
                    if(a==S[i]) l.pop_back();
                    else l.emplace_back(S[i]);
                }
                else{
                    char a=*(l.begin());
                    if(a==S[i]) l.pop_front();
                    else l.emplace_front(S[i]);
                }
            }
        }
    }

    if(mode==0){
        auto it=l.begin();
        while(it!=l.end()){
            cout<<*it;
            it++;
        }
        cout<<endl;
    }
    else{
        auto it=l.rbegin();
        while(it!=l.rend()){
            cout<<*it;
            it++;
        }
        cout<<endl;
    }
}

constexpr bool isDebugMode = false;
int testcase = 1;
#include <bits/stdc++.h>
#if __has_include(<atcoder/all>)
    #include <atcoder/all>
    using namespace atcoder;
#endif
using namespace std;
typedef long long ll;
typedef pair<long long, long long> P;
struct edge{long long to,cost;};
const int inf = 1 << 27;
const long long INF = 1LL << 60;
const int COMBMAX = 1001001;
const long long MOD = 1000000007; //998244353;
const long long dy[] = {-1, 0, 0, 1};
const long long dx[] = {0, -1, 1, 0};
const string abc = "abcdefghijklmnopqrstuvwxyz";
#define rep(i, n) for(int i = 0; i < (n); ++i)
#define eachdo(v, e) for (const auto &e : (v))
#define all(v) (v).begin(), (v).end()
#define lower_index(v, e) (long long)distance((v).begin(), lower_bound((v).begin(), (v).end(), e))
#define upper_index(v, e) (long long)distance((v).begin(), upper_bound((v).begin(), (v).end(), e))
long long mpow(long long a, long long n, long long mod = MOD){long long res = 1; while(n > 0){if(n & 1)res = res * a % mod; a = a * a % mod; n >>= 1;} return res;}
void pt(){cout << endl; return;}
template<class Head> void pt(Head&& head){cout << head; pt(); return;}
template<class Head, class... Tail> void pt(Head&& head, Tail&&... tail){cout << head << " "; pt(forward<Tail>(tail)...);}
void dpt(){if(!isDebugMode) return; cout << endl; return;}
template<class Head> void dpt(Head&& head){if(!isDebugMode) return; cout << head; pt(); return;}
template<class Head, class... Tail> void dpt(Head&& head, Tail&&... tail){if(!isDebugMode) return; cout << head << " "; pt(forward<Tail>(tail)...);}
template<class T> void enu(T v){rep(i, v.size()) cout << v[i] << " " ; cout << endl;}
template<class T> void enu2(T v){rep(i, v.size()){rep(j, v[i].size()) cout << v[i][j] << " " ; cout << endl;}}
template<class T> void debug(T v){if(!isDebugMode) return; rep(i, v.size()) cout << v[i] << " " ; cout << endl;}
template<class T> void debug2(T v){if(!isDebugMode) return; rep(i, v.size()){rep(j, v[i].size()) cout << v[i][j] << " " ; cout << endl;}}
template<class T1, class T2> inline bool chmin(T1 &a, T2 b){if(a > b){a = b; return true;} return false;}
template<class T1, class T2> inline bool chmax(T1 &a, T2 b){if(a < b){a = b; return true;} return false;}
template<class T1, class T2> long long recgcd(T1 a, T2 b){return a % b ? recgcd(b, a % b) : b;}
bool valid(long long H, long long W, long long h, long long w) { return 0 <= h && h < H && 0 <= w && w < W; }

void solve();

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

void solve(){
    ll N; cin >> N;
    pt(N % 2 ? "Black" : "White");
}


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

using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<int  ,int > pii;

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

const ll maxn  = 3e6;
const ll mod =1e9+7;
const ld PI = acos((ld)-1);

#define pb push_back
#define endl '\n'
#define dokme(x) cout << x , exit(0)
#define migmig ios::sync_with_stdio(false),cin.tie(0),cout.tie(0)
#define ms(x , y) memset(x , y , sizeof x)
ll pw(ll a, ll b, ll md = mod){ll res = 1;while(b){if(b&1){res=(a*res)%md;}a=(a*a)%md;b>>=1;}return(res);}

int n;
char aa , ab , ba , bb;

ll F[maxn];

ll f(int x){
	if(x <= 1)return(F[x] = 1);
	if(F[x])return(F[x]);
	return( F[x] = (f(x - 1) + f(x - 2))%mod );
}

int32_t main(){
    migmig;
	cin >> n >> aa >> ab >> ba >> bb;
	if(n <= 3)dokme(1);
	if(aa == ab && ab == ba && ba == bb)dokme(1);
	if(ab == 'B'){
		if(bb == 'B')dokme(1);
		if(ba == 'A')dokme(pw(2 , n - 3));
		dokme(f(n - 2));
	}
	if(aa == 'A')dokme(1);
	if(ba == 'B')dokme(pw(2 , n - 3));
	dokme((f(n - 2)));

    return(0);
}

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

const int MOD = 998244353;

long long modpow(ll a, ll n) {
    ll res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % MOD;
        a = a * a % MOD;
        n >>= 1;
    }
    return res;
}

ll modinv(ll a, ll m) {
    ll b = m, u = 1, v = 0;
    while (b) {
        ll t = a / b;
        a -= t * b;
        swap(a, b);
        u -= t * v;
        swap(u, v);
    }
    u %= m;
    if (u < 0) u += m;
    return u;
}

ll dp[5005][5005];

int main() {
    ll H, W, K;
    cin >> H >> W >> K;
    vector<vector<char>> G(H, vector<char>(W, '?'));
    rep(i, K) {
        int h, w;
        cin >> h >> w;
        h--, w--;
        char c;
        cin >> c;
        G[h][w] = c;
    }
    rep(i, H) rep(j, W) dp[i][j] = 0;

    dp[0][0] = modpow(3LL, H * W - K);
    rep(i, H) rep(j, W) {
        if (i == H - 1 && j == W - 1) break;
        if (i + 1 < H) {
            if (G[i][j] == 'D' || G[i][j] == 'X') {
                dp[i + 1][j] += dp[i][j];
                dp[i + 1][j] %= MOD;
            }
            if (G[i][j] == '?') {
                dp[i + 1][j] += dp[i][j] * modinv(3LL, MOD) % MOD * 2 % MOD;
                dp[i + 1][j] %= MOD;
            }
        }
        if (j + 1 < W) {
            if (G[i][j] == 'R' || G[i][j] == 'X') {
                dp[i][j + 1] += dp[i][j];
                dp[i][j + 1] %= MOD;
            }
            if (G[i][j] == '?') {
                dp[i][j + 1] += dp[i][j] * modinv(3LL, MOD) % MOD * 2 % MOD;
                dp[i][j + 1] %= MOD;
            }
        }
    }
    cout << dp[H - 1][W - 1] << endl;
}


#include <cstdio>
#include <algorithm>
using namespace std;
int p[505];
int ans[250005];
int main()
{
    int T,n,m;
    bool f,ff;
    scanf("%d",&T);
    while(T--)
    {
        scanf("%d",&n);
        for(int i=1;i<=n;i++)
            scanf("%d",&p[i]);
        m=0;
        f=true;
        for(int i=1;i<=n;i++)
            if(p[i]!=i)
                f=false;
        while(!f)
        {
            ff=false;
            for(int i=1;i<=n-1;i++)
                if(i%2!=m%2&&p[i]>p[i+1])
                {
                    ans[++m]=i;
                    swap(p[i],p[i+1]);
                    ff=true;
                    break;
                }
            if(!ff)
            {
                if(m%2!=(n-1)%2)
                {
                    ans[++m]=n-1;
                    swap(p[n-1],p[n]);
                }
                else
                {
                    ans[++m]=n-2;
                    swap(p[n-2],p[n-1]);
                }
            }
            f=true;
            for(int i=1;i<=n;i++)
                if(p[i]!=i)
                    f=false;
        }
        printf("%d\n",m);
        for(int i=1;i<=m;i++)
            if(i!=m)
                printf("%d ",ans[i]);
            else printf("%d\n",ans[i]);
    }
    return 0;
}


#include <iostream>
#include <iomanip>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string>
#include <set>
#include <algorithm>
#include <map>
#include <vector>
using namespace std;
#define rep(i, n) for(int i = 0; i < (int)n; i++)
#define repp(i, s, n) for(int i = (int)s; i < (int)n; i++)
#define Yes() cout << "Yes" << endl;
#define No() cout << "No" << endl;
using ll = long long;

int main(void){
    double x, y, z;
    cin >> x >> y >> z;
    int ans = (y / x)*z;
    if (((double)ans/z) == (y/x))ans--;
    cout << ans << endl;
}

/**
 *    author:  doublevgp
 *	  Which can not destroy me will make me strong
**/
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define pii pair<int,int>

const double PI = acos(-1.0);
const double eps = 1e-6;
const ll mod = 1e9 + 7;
const int inf = 0x3f3f3f3f;
const int maxn = 1e5 + 10;
const int maxm = 100 + 10;
#define ios ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);

ll extgcd(ll a, ll b, ll &x, ll &y) {
	if (b == 0) {
		x = 1, y = 0;
		return a;
	}
	ll g = extgcd(b, a % b, x, y);
	ll t = x;
	x = y;
	y = t - a / b * y;
	return g;
}
ll n, s, k;
void sol() {
	cin >> n >> s >> k;
	ll x, y;
	ll g = extgcd(k, n, x, y);
	if (s % g != 0) {
		cout << -1 << endl;
		return ;
	}
	else if (g == 1) {
		cout << (x * (-s) % n + n) % n << endl;
	}
	else {
		n /= g;
		s /= g;
		k /= g;
		cout << (x * (-s) % n + n) % n << endl;
	}
	return ;
}

int main()
{
	ios;
	int t;
	cin >> t;
	while (t--) {
		sol();
	}
	return 0;
}


/*Lucky_Glass*/
#include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>
using namespace std;

const int N=2e5+10;

inline int Rint(int &r){
	int b=1,c=getchar();r=0;
	while(c<'0' || '9'<c) b=c=='-'? -1:b,c=getchar();
	while('0'<=c && c<='9') r=(r<<1)+(r<<3)+(c^'0'),c=getchar();
	return r*=b;
}

int n,m,nstk,cnt;
int wei[N],now[N],uni[N],ans[N<<1][2],stk[N],fstk[N];
pair<int,int> lmt[N];
bool vis[N];

void Answer(int a,int b){
	a=lmt[a].second,b=lmt[b].second;
	ans[++m][0]=a,ans[m][1]=b;
	swap(now[a],now[b]);
}
int main(){
	Rint(n);
	for(int i=1;i<=n;i++) Rint(lmt[i].first),lmt[i].second=i;
	for(int i=1;i<=n;i++) Rint(wei[i]);
	for(int i=1;i<=n;i++) Rint(now[i]);
	for(int i=1;i<=n;i++)
		if(now[i]!=i && wei[now[i]]>=lmt[i].first){
			printf("-1\n");
			return 0;
		}
	sort(lmt+1,lmt+1+n);
	for(int i=1;i<=n;i++){
		uni[lmt[i].second]=i;
		if(lmt[i].second==now[lmt[i].second])
			vis[i]=true;
	}
	for(int i=1;i<=n;i++)
		if(!vis[i]){
			nstk=0;
			int tmp=i;
			while(true){
				stk[++nstk]=tmp;
				tmp=uni[now[lmt[tmp].second]];
				if(tmp==i) break;
			}
			fstk[cnt=1]=stk[1];
			for(int j=2;j<=nstk;j++)
				if(fstk[cnt]>stk[j]) Answer(fstk[cnt],stk[j]);
				else fstk[++cnt]=stk[j];
			for(int j=1;j<cnt;j++)
				Answer(fstk[j],fstk[cnt]);
		}
	//for(int i=1;i<=n;i++)
	//	printf("%d %d\n",i,now[i]);
	printf("%d\n",m);
	for(int i=1;i<=m;i++)
		printf("%d %d\n",ans[i][0],ans[i][1]);
	return 0;
}

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

using namespace std;

#define rep(i,a,b) for(int i = a; i < b; i++)
#define S(x) scanf("%d",&x)
#define S2(x,y) scanf("%d%d",&x,&y)
#define P(x) printf("%d\n",x)
#define all(v) v.begin(),v.end()
#define FF first
#define SS second
#define pb push_back
#define mp make_pair

typedef long long int LL;
typedef pair<int, int > pii;
typedef vector<int > vi;

const int N = 200001;

int A[N], B[N], P[N], IP[N];
vector<pii > v, ans;

int main() {
  int n;
  S(n);
  rep(i,1,n+1) {
    S(A[i]);
    v.pb(mp(A[i], i));
  }
  rep(i,1,n+1) {
    S(B[i]);
  }
  rep(i,1,n+1) {
    S(P[i]);
    IP[P[i]] = i;
  }

  sort(all(v));
  rep(i,0,v.size()) {
    int x = v[i].SS;
    if(IP[x] == x) continue;
    if(B[P[x]] >= A[x]) {
      P(-1);
      return 0;
    }
    ans.pb(mp(x, IP[x]));
    int y = P[x];
    IP[y] = IP[x];
    P[IP[x]] = y;
    IP[x] = x;
    P[x] = x;
  }
  P((int)ans.size());
  rep(i,0,ans.size()) {
    printf("%d %d\n",ans[i].FF, ans[i].SS);
  }
  return 0;
}


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

#define rep(i, j, n) for(int i = (j); i < (int)(n); i++)
#define print(t) cout << t << endl

using ll = long long;
using Graph = vector<vector<int>>;

#define SIZE(s) ll(s.size())

int main(){
  int N, X; cin >> N >> X;
  string S; cin >> S;
  rep(i, 0, N){
    if(S.at(i) == 'o'){X++; continue;}
    if(S.at(i) == 'x'){
      if(X == 0) continue;
      else X--;
    }
  }
  print(X);
}

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

#define int long long

signed main() {
    vector<int> arr(3);
    cin >> arr[0] >> arr[1] >> arr[2];
    sort(arr.begin(), arr.end());
    if (arr[0] == arr[1]) {
        cout << arr[2];
    } else if (arr[1] == arr[2]) {
        cout << arr[0];
    } else {
        cout << 0;
    }
    return 0;
}


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

#define mod 998244353
typedef long long ll;
int n,m;
ll memo[5005][5005],pwr[5005];

ll exp(int pos,int val){
	if(pos==0)return 1;
	if(memo[pos][val]!=-1)return memo[pos][val];
	return memo[pos][val]=((val-1)*pwr[pos-1]+(m-val)*exp(pos-1,val))%mod;
}

int main(){
	scanf("%d%d",&n,&m);
	pwr[0]=1;
	for(int i=1;i<=n;++i){
		pwr[i]=(pwr[i-1]*m)%mod;
		//printf("%lld ",pwr[i]);
	}
	//printf("\n");
	ll ans=0;
	memset(memo,-1,sizeof memo);
	for(int i=0;i<n;++i){
		for(int j=1;j<=m;++j){
			ans+=exp(i,j)*pwr[n-i-1];
			ans%=mod;
			//printf("%d %d: %lld\n",i,j,exp(i,j));
		}
	}
	printf("%lld\n",ans);
}

// #define _GLIBCXX_DEBUG // for STL debug (optional)
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <cfloat>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <fstream>
#include <functional>
#include <bitset>
using namespace std;
using ll = long long int;
using int64 = long long int;

template<typename T> void chmax(T &a, T b) {a = max(a, b);}
template<typename T> void chmin(T &a, T b) {a = min(a, b);}
template<typename T> void chadd(T &a, T b) {a = a + b;}

int dx[] = {0, 0, 1, -1};
int dy[] = {1, -1, 0, 0};
const int INF = 1LL << 29;
const ll LONGINF = 1LL << 60;
const ll MOD = 1000000007LL;

// ModInt begin

using ll = long long;
template<ll mod>
struct ModInt {
    ll v;
    ll mod_pow(ll x, ll n) const {
        return (!n) ? 1 : (mod_pow((x*x)%mod,n/2) * ((n&1)?x:1)) % mod;
    }
    ModInt(ll a = 0) : v((a %= mod) < 0 ? a + mod : a) {}
    ModInt operator+ ( const ModInt& b ) const {
        return (v + b.v >= mod ? ModInt(v + b.v - mod) : ModInt(v + b.v));
    }
    ModInt operator- () const {
        return ModInt(-v);
    }
    ModInt operator- ( const ModInt& b ) const {
        return (v - b.v < 0 ? ModInt(v - b.v + mod) : ModInt(v - b.v));
    }
    ModInt operator* ( const ModInt& b ) const {return (v * b.v) % mod;}
    ModInt operator/ ( const ModInt& b ) const {return (v * mod_pow(b.v, mod-2)) % mod;}

    bool operator== ( const ModInt &b ) const {return v == b.v;}
    bool operator!= ( const ModInt &b ) const {return !(*this == b); }
    ModInt& operator+= ( const ModInt &b ) {
        v += b.v;
        if(v >= mod) v -= mod;
        return *this;
    }
    ModInt& operator-= ( const ModInt &b ) {
        v -= b.v;
        if(v < 0) v += mod;
        return *this;
    }
    ModInt& operator*= ( const ModInt &b ) {
        (v *= b.v) %= mod;
        return *this;
    }
    ModInt& operator/= ( const ModInt &b ) {
        (v *= mod_pow(b.v, mod-2)) %= mod;
        return *this;
    }
    ModInt pow(ll x) { return ModInt(mod_pow(v, x)); }
    // operator int() const { return int(v); }
    // operator long long int() const { return v; }
};

template<ll mod>
ModInt<mod> pow(ModInt<mod> n, ll k) {
    return ModInt<mod>(n.mod_pow(n.v, k));
}

template<ll mod>
ostream& operator<< (ostream& out, ModInt<mod> a) {return out << a.v;}
template<ll mod>
istream& operator>> (istream& in, ModInt<mod>& a) {
    in >> a.v;
    return in;
}

// ModInt end

using mint = ModInt<998244353>;

mint tab[5010][5010];
int main() {
    int N, M; cin >> N >> M;

    for(int i=1; i<=M; i++) {
        tab[i][0] = mint(1);
        for(int j=1; j<=N; j++) {
            tab[i][j] = tab[i][j-1] * mint(i);
        }
    }
    mint ans(0);
    for(int len=1; len<=N; len++) {
        // len の両端はそれより低い (len == N なら関係ない)
        // len 内の要素は全て val 以上
        // len 内の要素に少なくとも 1 つ val の要素が存在
        for(int val=1; val<=M; val++) {
            mint tmp(0);
            mint v = tab[M-val+1][len] - tab[M-val][len];
            if(len < N - 1) {
                // 端の場合 (2 通り)
                tmp += tab[M][N-len-1] * mint(2) * v * mint(val - 1);

                // そうでない場合
                tmp += tab[M][N-len-2] * mint(N-len-1) * v * mint(val-1) * mint(val-1);
            }
            else if(len == N - 1) {
                // 端の場合しかない
                tmp += tab[M][N-len-1] * mint(2) * v * mint(val-1);
            }
            else {
                // それ以上バリエーションなし
                tmp += v;
            }
            ans += tmp;
        }
    }
    cout << ans << endl;
    return 0;
}


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

int main() {
    int k,a,b,c;
    cin>>k;
    ll ans = 0;
    for(int a=1;a<=k;a++){
        for(int b=1;a*b<=k;b++){
            ans += k/(a*b);
        }
    }
    cout<<ans;
    return 0;
}

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

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

int main() {
	int n;
	cin >> n;
	vector<P> ans(1024);
	int q = 1;
	while (q < n) q *= 2;
	rep(i, q) {
		ans[i].first = i / 2;
		ans[i].second = i / 2 + q / 2;
	}
	set<int> st;
	rep(i, q) st.insert(i);
	int now = q - 1;
	while (st.size() > n) {
		st.erase(now);
		now -= 2;
	}
	rep(i, q) {
		if (!st.count(ans[i].first)) ans[i].first--;
		if (!st.count(ans[i].second)) ans[i].second--;
	}
	map<int, int> idx;
	int d = 0;
	for (auto i : st) {
		idx[i] = d;
		d++;
	}
	rep(i, q) {
		if (!st.count(i)) continue;
		int pf = idx[ans[i].first];
		int ps = idx[ans[i].second];
		cout << pf + 1 << ' ' << ps + 1 << '\n';
	}
}


#include <cmath>
#include <vector>
#include <iostream>
#include <iomanip>
#include <fstream>
#include <algorithm>
#include <set>
#include <queue>
#include <string>
#include <map>
#include <stack>
#include <climits>
#include <array>
#include <unordered_set>
#include <unordered_map>
#include <memory>
#include <functional>
#include <cfloat>
#include <numeric>
#include <random>
#include <sstream>
#include <bitset>
#include <complex>
#include <chrono>
#include <cfloat>

using namespace std;

long long int gcd(long long int a, long long int b) {
	return b == 0 ? a : gcd(b, a % b);
}
long long int gx(long long int a, long long int b) {
	long long int ax{ 1 }, bx{ 0 }, ay{ 0 }, by{ 1 };
	const auto g = gcd(a, b);
	a /= g;
	b /= g;
	long long int r = b;
	while (r != 1) {
		const auto x = ax * a + bx * b;
		const auto y = ay * a + by * b;
		const auto q = x / y;
		r = x % y;
		const auto az = ax - q * ay;
		const auto bz = bx - q * by;
		ax = ay;
		bx = by;
		ay = az % b;
		by = bz % a;
	}
	return ay >= 0 ? ay : b + ay;;
}
int main() {
	int test_case; cin >> test_case;
	for (auto t = 0; t < test_case; ++t) {
		int n, s, k; cin >> n >> s >> k;
		const auto target = n - s;
		const auto g = gcd(n, k);
		if (target % g != 0) {
			cout << -1 << '\n';
		}
		else {
			const auto x = gx(k / g, n / g);
			cout << x * (target / g) % (n / g) << '\n';
		}
	}
}

#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 LINE cerr << "[debug] line: " << __LINE__ << endl;
#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>
bool chmax(T& a, const T& b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}

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

ll mod_pow(ll x, ll n, ll mod) {
  if (n == 0) return 1;
  ll res = mod_pow(x * x % mod, n / 2, mod);
  if (n & 1) res *= x;
  res %= mod;
  return res;
}

struct MAT {
  vvll v = vvll(3, vll(3, 0));

  // MAT(vvll a) : v(a);

  MAT operator*(MAT a) {
    MAT res;
    rep(i, 3) rep(j, 3) rep(k, 3) res.v[i][j] += v[i][k] * a.v[k][j];
    return res;
  }

  vll operator*(vll a) {
    vll res = vll(3, 0);
    rep(i, 3) rep(k, 3) res[i] += v[i][k] * a[k];
    return res;
  }

  void print() {
    rep(i, 3) {
      rep(j, 3) cout << ' ' << v[i][j];
      ENDL;
    }
  }
  // http://satoh.cs.uec.ac.jp/ja/lecture/ComputerGraphics/2.pdf
};

signed main() {
  init();
  ll N;
  cin >> N;
  vvll X(N, vll(3, 1));
  rep(i, N) cin >> X[i][0] >> X[i][1];

  ll M;
  cin >> M;
  vector<MAT> mat;
  MAT m = {vvll({{1, 0, 0}, {0, 1, 0}, {0, 0, 1}})};
  mat.pb(m);
  rep(i, M) {
    ll t;
    cin >> t;
    MAT a;
    if (t <= 2) {
      if (t == 1) a = {vvll({{0, 1, 0}, {-1, 0, 0}, {0, 0, 1}})};
      if (t == 2) a = {vvll({{0, -1, 0}, {1, 0, 0}, {0, 0, 1}})};
    } else {
      ll p;
      cin >> p;
      if (t == 3) a = {vvll({{-1, 0, 2 * p}, {0, 1, 0}, {0, 0, 1}})};
      if (t == 4) a = {vvll({{1, 0, 0}, {0, -1, 2 * p}, {0, 0, 1}})};
    }
    m = a * m;
    mat.pb(m);
  }

  ll Q;
  cin >> Q;
  rep(i, Q) {
    ll a, b;
    cin >> a >> b;
    b--;
    vll ans = mat[a] * X[b];
    cout << ans[0] << ' ' << ans[1] << endl;
  }

  return 0;
}


#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define P pair<ll,ll>
#define FOR(I,A,B) for(ll I = ll(A); I < ll(B); ++I)
#define FORR(I,A,B) for(ll I = ll((B)-1); I >= ll(A); --I)
#define TO(x,t,f) ((x)?(t):(f))
#define SORT(x) (sort(x.begin(),x.end())) // 0 2 2 3 4 5 8 9
#define POSL(x,v) (lower_bound(x.begin(),x.end(),v)-x.begin()) //xi>=v  x is sorted
#define POSU(x,v) (upper_bound(x.begin(),x.end(),v)-x.begin()) //xi>v  x is sorted
#define NUM(x,v) (POSU(x,v)-POSL(x,v))  //x is sorted
#define REV(x) (reverse(x.begin(),x.end())) //reverse
ll gcd_(ll a,ll b){if(a%b==0)return b;return gcd_(b,a%b);}
ll lcm_(ll a,ll b){ll c=gcd_(a,b);return ((a/c)*b);}
#define NEXTP(x) next_permutation(x.begin(),x.end())
const ll INF=ll(1e16)+ll(7);
const ll MOD=1000000007LL;
#define out(a) cout<<fixed<<setprecision((a))
//tie(a,b,c) = make_tuple(10,9,87);
#define pop_(a) __builtin_popcount((a))
ll keta(ll a){ll r=0;while(a){a/=10;r++;}return r;}
#define num_l(a,v) POSL(a,v) //v未満の要素数
#define num_eql(a,v) POSU(a,v) //v以下の要素数
#define num_h(a,v) (a.size() - POSU(a,v)) //vより大きい要素数
#define num_eqh(a,v) (a.size() - POSL(a,v)) //v以上の要素数

int main(){
	ll N;
	cin >> N;
	ll sumA = 0;
	vector<ll> A(N);
	FOR(i,0,N){
		ll a,b;
		cin >> a >> b;
		sumA += a;
		A[i] = a*2+b;
	}
	SORT(A);
	REV(A);

	FOR(i,0,N){
		sumA -= A[i];
		if(sumA<0){
			cout << i+1 << endl;
			return 0;
		}
	}

}

#include<iostream>
#include<vector>
#include<algorithm>
long long N,A,B,p=0LL;
using namespace std;
int main(){
    cin>>N;
    vector<long long>town(N);
    for(int i=0;i<N;i++){cin>>A>>B;p-=A;town[i]=A*2+B;}
    sort(town.rbegin(),town.rend());
    for(int i=0;i<N;p+=town[i],i++)if(p>0LL){cout<<i<<endl;return 0;}
    cout<<N<<endl;
    return 0;
}


#include <iostream>
#include <string>
#include <vector>
#include <unordered_set>
#include <cmath>

long long CalcPoints(std::string str)
{
    int strlen = str.size();
    int pointArray[10] = {0};
    long long ret = 0;
    for(int i = 0; i < strlen; i++){
        if(str[i] == '#') continue;
        int tmp = str[i] - '0';
        pointArray[tmp]++;
    }

    for(int i = 0; i < 10; i++){
        ret += i * std::pow(10, pointArray[i]);
    }

    return ret;
}
void SetCardArray(std::vector<long long>& carray, std::string str)
{
    int strlen = str.size();

    for(int i = 0; i < strlen; i++){
        if(str[i] == '#') continue;
        carray[str[i] - '0']--;
    }
}

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

    std::cout << 21 - (a + b + c) << std::endl;
    return 0;
}

 #include <bits/stdc++.h>

 #define FIXED_FLOAT(x)  std::fixed <<std::setprecision(20) << (x)
 #define all(v) (v).begin(), (v).end()
 using namespace  std;
 #define forn(i,n) for (int i = 0; i < (n); ++i)
 using ll = long long;
 int mod = (ll)1e9 + 7;
 #define PI acos(-1)
 typedef pair<int, int> pairs;

 const int INF = 1e9 + 1;
 const int N = 2e5 + 100;
 const double eps = 1e-3;

 template <typename XPAX>
 void ckma(XPAX &x, XPAX y) {
     x = (x < y ? y : x);
 }
 template <typename XPAX>
 void ckmi(XPAX &x, XPAX y) {
     x = (x > y ? y : x);
 }

 void solve() {

 	int h, w;
 	cin >> h >> w;
 	vector<vector<int>> a(h, vector<int>(w - 1));
 	forn(i, h) forn(j, w - 1) cin >> a[i][j];

 	vector<vector<int>> b(h - 1, vector<int>(w));
 	forn(i, h - 1) forn(j, w) cin >> b[i][j];

 	using P = tuple<int, int, int>;

 	auto myid = [&](P p) {
 		int r, c , f;
 		tie(r, c, f) = p;
 		return f * (h * w) + r * w + c;
 	};
 	using Q = pair<int, P>;

 	vector<int> dist(2 * h * w + 1, INF);
 	priority_queue<Q, vector<Q>, greater<Q>>q;
 	auto push = [&](P p, int D){
 		if(dist[myid(p)] <= D)return;
 		dist[myid(p)] = D;
 		q.push({D, p});
 	};
 	push(P{0, 0, 0}, 0);
 	auto get = [&](P p, int &r, int &c, int &f ) {
 		tie(r, c, f) = p;
 	};

 	while(q.size()) {
 		Q s = q.top();
 		q.pop();
 		int D = s.first;
 		int r, c, f;
 		get(s.second, r, c, f);
 		if(r == h - 1 && c == w - 1) {
 			cout << D << endl;
 			return;
 		}
 		if(f == 0) {
 			push(P{r, c, 1}, D + 1);
 			if(c)
 				push(P{r, c - 1, f},D + a[r][c - 1]);
 			if(c + 1 < w) {
				push(P{r, c + 1, f},D + a[r][c]);
			}
			if(r + 1 < h)
				push(P{r + 1, c, f}, D + b[r][c]);

		}
		else {
			if(r) push(P{r - 1, c, f}, D + 1);

			push(P{r, c, 0}, D);
		}
	}

 }
 void test_case() {
     int t;
     cin >> t;
     forn(p, t) {

         //cout << "Case #" << p + 1 << ": ";
         solve();
     }
 }
 int main() {

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

     solve();

 }


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

int main(){
    ios_base::sync_with_stdio(false);cin.tie(0);
    int n;
    cin>>n;
    string s;
    cin>>s;
    vector<int> min_rem(n+1, n);
    min_rem[n]=0;
    vector<int> ending_with_char(26, -1);
    for(int i=n-1;i>=0;i--){
        if(i==n-1){
            min_rem[i]=-1;
            ending_with_char[(int)(s.at(i)-'a')]=1;
        }
        else{
            min_rem[i]=n;
            for(int ch=0;ch<26;ch++){
                if(ch!=(int)(s.at(i)-'a')){
                    if(ending_with_char[ch]!=-1){
                        min_rem[i]=min(min_rem[i], ending_with_char[ch]);
                    }
                }
            }
            min_rem[i]=(min_rem[i]==n?-1:min_rem[i]);
            if(min_rem[i+1]!=-1){
                ending_with_char[(int)(s.at(i)-'a')]=min(ending_with_char[(int)(s.at(i)-'a')]==-1?n:ending_with_char[(int)(s.at(i)-'a')], min_rem[i+1]+1);
            }
        }
    }
    cout<<min_rem[0]<<"\n";
}

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

#define FOR_LT(i, beg, end) for (std::remove_const<decltype(end)>::type i = beg; i < end; i++)
#define FOR_LE(i, beg, end) for (std::remove_const<decltype(end)>::type i = beg; i <= end; i++)
#define FOR_DW(i, beg, end) for (std::remove_const<decltype(beg)>::type i = beg; end <= i; i--)
#define REP(n)              for (std::remove_const<decltype(n)>::type repeat_index = 0; repeat_index < n; repeat_index++)

using namespace std;

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

	int n; cin >> n;
	string s; cin >> s;
	if (s.front() != s.back()) {
		cout << 1 << endl;
		return 0;
	}

	FOR_LT(i, 1, n - 2) {
		if (s[i] != s.front() && s[i + 1] != s.back()) {
			cout << 2 << endl;
			return 0;
		}
	}

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


#include<bits/stdc++.h>
using namespace std;
const int maxn=2e5+1000;
int n,q,c[maxn],fa[maxn];
map<int,int> a[maxn];
void read(int &x)
{
	char ch;bool ok;
	for(ok=0,ch=getchar();!isdigit(ch);ch=getchar()) if(ch=='-') ok=1;
	for(x=0;isdigit(ch);x=x*10+ch-'0',ch=getchar()); if(ok) x=-x;
}
int getfa(int x)
{
	if(fa[x]==x) return x;
	else return fa[x]=getfa(fa[x]);
}
void join(int x,int y)
{
	if(getfa(x)==getfa(y)) return;
	if(a[getfa(x)].size()<a[getfa(y)].size()) swap(x,y);
	for(pair<int,int>lll:a[getfa(y)]) a[getfa(x)][lll.first]+=lll.second;
	fa[getfa(y)]=getfa(x);
}
int main()
{
	read(n),read(q);
	for(int i=1;i<=n;i++) read(c[i]);
	for(int i=1;i<=n;i++) fa[i]=i;
	for(int i=1;i<=n;i++) a[i][c[i]]++;
	while(q--)
	{
		int x,y,z;
		read(x),read(y),read(z);
		if(x==1) join(y,z);
		else printf("%d\n",a[getfa(y)][z]);
	}
	return 0;
}

#include <iostream>
#include <algorithm>
#include <unordered_set>
#include <set>
#include <vector>
#include <queue>
#include <map>
#include <numeric>
#include <math.h>

using namespace std;

#define rep(i, n) for (long long int i = 0; i < (long long int)(n); i++)
#define irep(i, n) for (long long int i = 1; i <= (long long int)(n); i++)
#define drep(i, n, diff) for (long long int i = 0; i < (long long int)(n); i += diff)
#define mod 1000000007
#define cdeb(val) cout << #val << ":" << val << endl;
#define pdeb(val) printf("%s : %lld\n", #val, val);

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

struct BIT {
  ll n;
  vector<ll> b;
  BIT(ll idx) : n(idx+1), b(n, 0) {}

  void init(vector<ll> a) {
    for(ll i = 0; i < a.size(); i++) {
      add(i+1, a[i]);
    }
  }

  // sum: b[1] ~ b[i];
  ll sum(ll i) {
    ll ret = 0;
    while(i > 0) {
      ret += b[i];
      i -= i & -i;
    }
    return ret;
  }

  // sum: b[x] ~ b[y];
  ll range_sum(ll x, ll y) {
    return sum(y) - sum(x-1);
  }

  void add(ll i, ll x) {
    while(i <= n) {
      b[i] += x;
      i += i & -i;
    }
  }
};

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

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

  BIT b(n);

  ll total = 0;

  rep(i, n) {
    total += a[i] - b.sum(a[i]+1);
    b.add(a[i]+1, 1);
  }

  rep(i, n) {
    cout << total << endl;
    total = (total - a[i]) + (n - 1 - a[i]);
  }
  return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define mod 998244353
#define maxn 1000007

int main()
{
    ios::sync_with_stdio(0);
    ll a,b,c;
    cin>>a>>b>>c;
    cout<<a*(a+1)/2%mod*(b*(b+1)/2%mod)%mod*(c*(c+1)/2%mod)%mod<<endl;
    return 0;
}

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

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

#define N 200005
#define NN 1005000
#define PB push_back
#define M ll(1e9 + 7)
#define all(x) x.begin(), x.end()
#define sz(x) int(x.size())
#define pri(x) cout << x << endl
#define endl '\n'
#define _ << " " <<
#define F first
#define S second

using namespace std;
//using namespace __gnu_pbds;

//typedef tree <int, null_type, less <int>, rb_tree_tag, tree_order_statistics_node_update> oredered_set;

typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
typedef short int si;

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

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

    int a, b, c;

    cin >> a >> b >> c;

    if (a * a + b * b < c * c)
    {
        pri("Yes");

    }else pri("No");
}


#include <stdio.h>
#include <stdlib.h>
#include <string>
#include <iostream>
#include <utility>
#include <algorithm>
#include <vector>
#include <list>
#include <stack>
#include <queue>
#include <unordered_map>
#include <map>
#include <unordered_set>
#include <set>
#include <tuple>
#include <cassert>
#include <cmath>
using namespace std;
using ll = long long;
const int mod = 1e9 + 7;

#define read_int(X) \
    ll X;           \
    scanf("%lld\n", &X);

#define read_two_int(X, Y) \
    ll X, Y;               \
    scanf("%lld %lld\n", &X, &Y);

#define read_three_int(X, Y, Z) \
    ll X, Y, Z;                 \
    scanf("%lld %lld %lld\n", &X, &Y, &Z);

#define read_four_int(X, Y, Z, W) \
    ll X, Y, Z, W;                \
    scanf("%lld %lld %lld %lld\n", &X, &Y, &Z, &W);

int main()
{
    ll N;
    scanf("%lld", &N);

    vector<string> S = vector<string>(N);
    for (ll i = 0; i < N; i++)
    {
        cin >> S[i];
    }

    vector<ll> ans = vector<ll>(N + 1);
    ans[0] = 1;
    ll pow2 = 2;
    for (ll i = 0; i < N; i++)
    {
        ans[i + 1] = ans[i];
        if (S[i] == "OR")
            ans[i + 1] += pow2;
        pow2 *= 2;
    }

    printf("%lld\n", ans[N]);
}

#include<iostream>
#include<vector>
#include<bits/stdc++.h>
// #define mod 1000000007
#define pi 3.14159265358979
#define  PRE(x,p) cout<<setprecision(x)<<p;
#define pb push_back
#define mp make_pair
#define f first
#define s second
#define endl "\n"
#define high INT_MAX
#define low INT_MIN
#define ll long long int

using namespace std;

void showa(ll a[],ll n){ for(ll i=1;i<=n;i++) cout<<a[i]<<' ';  cout<<endl;  }
void showv(vector<ll>v){ for(ll i=0;i<v.size();i++) cout<<v[i]<<' '; cout<<endl;}

long long int xpoweryMOD(int x, int y, int mod)
{
  long long int res = 1;
  /*
  it depends sometimes on questions too,
  whether pow(0,0) is 1 or 0
  So change accordingly
  */
  if (x == 0)return 0;
  while (y)
  {
    if (y & 1)(res *= x) %= mod;
    y >>= 1;
    (x *= x) % mod;
  }
  return res;
}
int n;
ll po[65];
ll rec(vector<string>st,int index)
{
    if(!index)return 1;
    if(st[index]=="AND")
        return rec(st,index-1);
    else
        return po[index] + rec(st,index-1);
}
void solve()
{
   ll i;
   cin>>n;
   vector<string>st(n+1);
   for(i=1;i<=n;i++)
   cin>>st[i];
   cout<<rec(st,n);

}
int main()
{
 #ifndef ONLINE_JUDGE
 freopen("input.txt", "r", stdin);
 freopen("output.txt", "w", stdout);
 #endif
 ll x=2;
 for(ll i=1;i<=61;i++)
   { po[i]=x;x=x*2;}
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);

ll t=1;
// cin>>t;
for(ll test=1;test<=t;test++)
{
    // cout<<"CASE #"<<test<<": ";
    solve();
}

return 0;
}


#include <bits/stdc++.h>
#define int long long
#define mod 1000000007
#define i_max INT_MAX
#define i_min INT_MIN
#define s_i set<int>
#define v_i vector<int>
#define v_s vector<string>
#define v_c vector<char>
#define stk_i stack<int>
#define q_i queue<int>
#define qp_ii queue<pair<int, int>>
#define pqp_ii priority_queue<pair<int, int>>
#define vp_ii vector<pair<int, int>>
#define um_ii unordered_map<int, int>
#define m_ii map<int, int>
#define m_iv_i map<int, vector<int>>
#define mp make_pair
#define pb push_back
#define nline "\n"
#define yes cout << "YES" \
                 << "\n"
#define no cout << "NO" \
                << "\n"
#define for_0(n) for (int i = 0; i < n; i++)
#define for_1(n) for (int i = 1; i <= n; i++)
#define fast ios_base::sync_with_stdio(false), cin.tie(nullptr), cout.tie(nullptr)

using namespace std;

float solve()
{

    float a, b;
    cin >> a >> b;

    float d = a - b;

    float per_d = ((d * 1.0) / a) * 100;
    return per_d;
}
int32_t main()
{

    fast;

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

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

    while (t--)
    {

        cout << solve() << nline;
    }

    return 0;
}

#include <iostream>
using namespace std;

int main (){
  double a,b;
  cin >> a>>b;
  cout << 100-b*100/a << endl;
  return 0;
}


/*
これを入れて実行
g++ code.cpp
./a.out
 */

#include <iostream>
#include <cstdio>
#include <stdio.h>
#include <vector>
#include <string>
#include <cstring>
#include <queue>
#include <deque>
#include <stack>
#include <algorithm>
#include <utility>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <cmath>
#include <math.h>
#include <tuple>
#include <iomanip>
#include <bitset>
#include <functional>
#include <cassert>
#include <random>

#define all(x) (x).begin(),(x).end()
#define rep(i, n) for (int i = 0; i < (int)(n); i++)

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

int dy4[4] = {-1, 0, +1, 0};
int dx4[4] = {0, +1, 0, -1};
int dy8[8] = {-1, -1, 0, 1, 1, 1, 0, -1};
int dx8[8] = {0, 1, 1, 1, 0, -1, -1, -1};

const long long INF = 1LL << 61;
const ll MOD = 1e9 + 7;

bool greaterSecond(const pair<int, int>& f, const pair<int, int>& s){
    return f.second > s.second;
}

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

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

ll conbinationMemo[201][12];

void cmemoInit(){
    rep(i, 201){
        rep(j, 12){
            conbinationMemo[i][j] = -1;
        }
    }
}

ll nCr(ll n, ll r){
    if(conbinationMemo[n][r] != -1) return conbinationMemo[n][r];
    if(r == 0 || r == n){
        return 1;
    } else if(r == 1){
        return n;
    }
    return conbinationMemo[n][r] = (nCr(n - 1, r) + nCr(n - 1, r - 1));
}

ll nPr(ll n, ll r){
    r = n - r;
    ll ret = 1;
    for (ll i = n; i >= r + 1; i--) ret *= i;
    return ret;
}
//-----------------------ここから-----------
int main(void){
    ll a, b, c, d;
    cin >> a >> b >> c >> d;
    cout << b - c << endl;
}

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

#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define all(x) (x).begin(),(x).end()
using ll = long long;
using P = pair<ll, ll>;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, -1, 0, 1};
string char_to_string(char val) {
  return string(1, val);
}
int char_to_int(char val) {
  return val - '0';
}
char inverse_char(char c) {
  if(isupper(c)) return tolower(c);
  else return toupper(c);
}
template<class T> inline bool chmin(T& a, T b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}
template<class T> inline bool chmax(T& a, T b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}
struct edge {
  ll to, cost;
};

int main() {
  ll T; cin >> T;
  REP(i, T) {
    ll N; cin >> N;
    if(N % 4 == 0) cout << "Even" << endl;
    else if(N % 2 == 0) cout << "Same" << endl;
    else cout << "Odd" << endl;
  }
}


#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define fast_io ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);

void rec(int *idx, int s, int baki, function<void(int *)> fun)
{
    if (baki == 0) fun(idx);
    else
    {
        if (s < 0) return;
        rec(idx, s - 1, baki, fun);
        idx[baki - 1] = s;
        rec(idx, s - 1, baki - 1, fun);
    }
}

void cmb(int n, int k, function<void(int *)> fun)
{
    int idx[k];
    rec(idx, n - 1, k, fun);
}

ll ok;
vector<ll> a;
vector<vector<vector<ll>>> vec;

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

    ll n;
    cin >> n;
    a = vector<ll>(n);
    vec = vector<vector<vector<ll>>>(200);

    for (int i = 0; i < n; i++)
    {
        cin >> a[i];
        a[i] %= 200;
    }

    for (int i = 1; i <= n; i++)
    {
        ok = i;
        cmb(n, i, [](int *ind)
        {
            vector<ll> t;
            ll ts = 0;
            for (int j = 0; j < ok; j++)
            {
                t.push_back(ind[j] + 1);
                ts += a[ind[j]];
            }
            if (vec[ts % 200].size() <= 0) vec[ts % 200].push_back(t);
            else
            {
                cout << "YES" << endl;
                cout << vec[ts % 200][0].size();
                for (auto pl : vec[ts % 200][0]) cout << " " << pl;
                cout << endl;
                cout << t.size();
                for (auto pl : t) cout << " " << pl;
                cout << endl;
                exit(0);
            }
        });
    }

    cout << "NO" << endl;

    return 0;
}

/**
 *  In The Name Of God
 *  author : Behradm
 *  Idvwhu wkdq idvw, Txlfnhu wkdq txlfn, L dp Oljkwqlqj, Vshhg, L dp Vshhg :D :D
**/
#include "bits/stdc++.h"

using namespace std;

const int N = 300;
int a[N];
vector<int> cnt[N];

int n;

vector<int> Recover(int mask) {
  vector<int> res;
  for (int i = 0; i < n; i++)
    if (mask & (1 << i))
      res.push_back(i + 1);
  return res;
}

signed main() {
  ios::sync_with_stdio(false);
  cin.tie(0), cout.tie(0);
  cin >> n;
  for (int i = 0; i < n; i++)
    cin >> a[i], a[i] %= 200;

  int ans = -1;
  int end = 257;
  if (n <= 8)
    end = (1 << n);

  for (int mask = 1; mask < end; mask++) {
    int sum = 0;
    for (int i = 0; i < n; i++)
      if (mask & (1 << i)) { sum += a[i], sum %= 200; };

    cnt[sum].push_back(mask);
    int sz = (int) cnt[sum].size();
    if (sz == 2) {
      ans = sum;
      break;
    }
  }

  if (ans == -1) {
    cout << "No\n";
    return 0;
  }

  vector<int> x = Recover(cnt[ans][0]);
  vector<int> y = Recover(cnt[ans][1]);

  cout << "Yes\n";

  cout << (int) x.size() << " ";
  for (int u : x)
    cout << u << " ";
  cout << '\n';

  cout << (int) y.size() << " ";
  for (int u : y)
    cout << u << " ";
  cout << '\n';
  return 0;
}


#include<iostream>
#include<climits>
#include<bits/stdc++.h>
using namespace std;
#define LL long long int
#define mod 998244353

int main()
{
    // freopen("input.txt","r",stdin);
    // freopen("output.txt","w",stdout);
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    LL     N ,K;
    cin >> N >> K;
    vector< vector<LL> > arr(N+1,vector<LL>(N+1));
    for(LL i=0;i<N;i++){
        for(LL j=0;j<N;j++){
            cin >> arr[i][j];
        }
    }
    function<bool(LL) > checkMedianIsPossibleOrNot = [&](LL median){
        // SUBMATRIX SUM QUERIES BRO
        vector< vector<LL> > temp(N+1,vector<LL>(N+1,0));
        for(LL i=0;i<N;i++){
            for(LL j=0;j<N;j++){
                if(arr[i][j] <= median){
                    temp[i][j] = 1 ;
                }
            }
        }
        vector< vector<LL> > dp(N+1,vector<LL>(N+1,0));
        for(LL i=1;i<=N;i++){
            for(LL j=1;j<=N;j++){
                dp[i][j]= temp[i-1][j-1] + dp[i-1][j]+ dp[i][j-1] - dp[i-1][j-1];
            }
        }
        for(LL i=1;i<=N-K+1;i++){
            for(LL j=1;j<=N-K+1;j++){
                LL x1=i;LL y1=j;
                LL x2=i+K-1;
                LL y2=j+K-1;
                LL suminSubmatrix = dp[x2][y2] - dp[x1-1][y2] - dp[x2][y1-1] + dp[x1-1][y1-1];
                if(suminSubmatrix >= (K*K+1)/2){
                    return true;
                }
            }
        }
        return false;
    };
    LL start =      -1;
    LL end   = (LL)1e9;
    LL ans = -1;
    while(start <= end){
        LL mid = (start+end)/2;
        if(checkMedianIsPossibleOrNot(mid)){
            end=mid-1;
            ans=mid;
        }
        else{
            start=mid+1;
        }
    }
    cout<<ans;

}


#include<deque>
#include<queue>
#include<vector>
#include<algorithm>
#include<iostream>
#include<set>
#include<cmath>
#include<tuple>
#include<string>
#include<chrono>
#include<functional>
#include<iterator>
#include<random>
#include<unordered_set>
#include<array>
#include<map>
#include<iomanip>
#include<assert.h>
#include<list>
#include<bitset>
#include<stack>
#include<memory>
#include<numeric>
using namespace std;
using namespace std::chrono;
typedef long long int llint;
typedef long double lldo;
#define mp make_pair
#define mt make_tuple
#define pub push_back
#define puf push_front
#define pob pop_back
#define pof pop_front
#define fir first
#define sec second
#define res resize
#define ins insert
#define era erase
#define REP(i, n) for(int i = 0;i < (n);i++)
/*cout<<fixed<<setprecision(20);cin.tie(0);ios::sync_with_stdio(false);*/
const llint mod=1000000007;
const llint inf=2.19e15+1;
const long double pai=3.141592653589793238462643383279502884197;
const long double eps=1e-10;
template <class T,class U>bool chmin(T& a,U b){if(a>b){a=b;return true;}return false;}
template <class T,class U>bool chmax(T& a,U b){if(a<b){a=b;return true;}return false;}
llint gcd(llint a,llint b){if(a%b==0){return b;}else return gcd(b,a%b);}
llint lcm(llint a,llint b){if(a==0){return b;}return a/gcd(a,b)*b;}
template<class T> void SO(T& ve){sort(ve.begin(),ve.end());}
template<class T> void REV(T& ve){reverse(ve.begin(),ve.end());}
template<class T>llint LBI(const vector<T>&ar,T in){return lower_bound(ar.begin(),ar.end(),in)-ar.begin();}
template<class T>llint UBI(const vector<T>&ar,T in){return upper_bound(ar.begin(),ar.end(),in)-ar.begin();}
int main(void){
	cout<<fixed<<setprecision(20);
	cin.tie(0);ios::sync_with_stdio(false);
	/*
	1 1
	1 2
	3 2
	3 5

	*/
	llint N,i;cin>>N;
	llint x=1,y=0;//倍率
	vector<llint>bai;
	while(1){
		y+=x;bai.pub(y);if(y>N){break;}
		x+=y;bai.pub(x);if(x>N){break;}
	}
	REV(bai);
	vector<int>sou;
	for(i=0;i<bai.size();i++){
		if((i+bai.size())%2==0){
			//xを増やして、 y+=x
			while(N>=bai[i]){N-=bai[i];sou.pub(1);}
			sou.pub(4);
		}else{
			while(N>=bai[i]){N-=bai[i];sou.pub(2);}
			sou.pub(3);
		}
	}
	while(3<=sou[0]){sou.erase(sou.begin());}
	cout<<sou.size()<<endl;
	for(auto it:sou){cout<<it<<endl;}
	return 0;
}

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

using namespace std;
using namespace chrono;

typedef long long int ll;
typedef vector<int> vii;
typedef vector<ll> vll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;

#define pb push_back
#define odd(x) ((x)&1)
#define even(x) (!odd(x))
#define all(v) (v).begin(),(v).end()
#define rep(i,n) for(auto i=0;i<n;++i)
#define FASTIO ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define TEST_CASE int tc;cin>>tc;while(tc--)
#define Clock high_resolution_clock::now()

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

#ifdef LOCAL
#define cerr cout
#else
#endif

#define TRACE

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

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

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

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

const ll inf = 2e18;
const ll mod = 998244353;
const ll N = 1e5+3;

int main()
{
    auto start_time = Clock;
    FASTIO

    ll n,mxx=0;
    cin >> n;
    vll v(n), mx(n);
    rep(i,n) {
        cin >> v[i];
        chmax(mxx, v[i]);
        mx[i] = mxx;
    }
    ll sum = 0;
    rep(i,n) {
        v[i] += (i?v[i-1]:0);
        sum += v[i];
        cout << (sum+(i+1)*mx[i]) << "\n";
    }

    auto end_time = Clock;
    #ifndef TIME
        return 0;
    #endif
    cout << "\nTime elapsed: "
    << (double)duration_cast<milliseconds>(end_time-start_time).count()
    << "ms";

    return 0;
}


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

int main(){
    int N; cin >> N;
    vector<double> a(N),b(N),c(N),d(N);
    for(int _=0; _<2; _++){
        for(int i=0; i<N; i++) cin >> a[i] >> b[i];
        int x = 0, y = 0;
        for(int i=0; i<N; i++){
            x += a[i];
            y += b[i];
            a[i] *= N;
            b[i] *= N;
        }
        for(int i=0; i<N; i++){
            a[i] -= x;
            b[i] -= y;
        }
        swap(a,c);
        swap(b,d);
    }
    for(int i=0; i<N; i++){
        if(a[i]!=0 || b[i]!=0){
            swap(a[i],a[0]);
            swap(b[i],b[0]);
        }
    }
    string ans = "No";
    const double eps = 1e-6;
    for(int i=0; i<N; i++){
        double angle = atan2(d[i],c[i])-atan2(b[0],a[0]);
        bool flag = true;
        for(int j=0; j<N; j++){
            double A = a[j]*cos(angle)-b[j]*sin(angle);
            double B = a[j]*sin(angle)+b[j]*cos(angle);
            bool flag2 = false;
            for(int k=0; k<N; k++){
                if(std::abs(A-c[k])<=eps && std::abs(B-d[k])<=eps) flag2 = true;
            }
            flag &= flag2;
        }
        if(flag) ans = "Yes";
    }
    cout << ans << endl;
}

#include<bits/stdc++.h>
#define ll long long
#define ld long double
#define f first
#define s second
#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
using namespace std;
const int mod=1e9+7;
const int maxV=2e7+1;
const ll inf=1e18+1;
int main(){
    int n;
    cin>>n;
    map<int, ll> mp1, mp2;
    int c;
    ll x;
    for(int i=0;i<n;i++){
        cin>>x>>c;
        if(mp1.find(c)==mp1.end()){
            mp1[c]=x;
        }
        if(mp2.find(c)==mp2.end()){
            mp2[c]=x;
        }
        mp1[c]=min(mp1[c], x);
        mp2[c]=max(mp2[c], x);
    }
    n=mp1.size();
    vector<pair<ll,ll>> pts(n);
    c=0;
    for(auto it:mp1){
        pts[c].f=it.s;
        c++;
    }
    c=0;
    for(auto it:mp2){
        pts[c].s=it.s;
        c++;
    }
    vector<vector<ll>> dp(n, vector<ll> (2));
    for(int i=0;i<n;i++){
        if(i==0){
            dp[i][0]=abs(pts[i].f-pts[i].s)+abs(pts[i].s);
            dp[i][1]=abs(pts[i].f-pts[i].s)+abs(pts[i].f);
        }
        else{
            dp[i][0]=abs(pts[i].f-pts[i].s)+min(dp[i-1][0]+abs(pts[i-1].f-pts[i].s), dp[i-1][1]+abs(pts[i-1].s-pts[i].s));
            dp[i][1]=abs(pts[i].f-pts[i].s)+min(dp[i-1][0]+abs(pts[i-1].f-pts[i].f), dp[i-1][1]+abs(pts[i-1].s-pts[i].f));
        }
    }
    cout<<min(dp[n-1][0]+abs(pts[n-1].f), dp[n-1][1]+abs(pts[n-1].s))<<"\n";
}


#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef double db;
#define x first
#define y second
#define bg begin()
#define ed end()
#define pb push_back
#define mp make_pair
#define sz(a) int((a).size())
#define R(i,n) for(int i(0);i<(n);++i)
#define L(i,n) for(int i((n)-1);~i;--i)
const int iinf=0x3f3f3f3f;
const ll linf=0x3f3f3f3f3f3f3f3f;

//Data
typedef long double ldb;
const ldb eps=1e-15;
ldb s,p;

//Functions
bool isi(ldb x){
    ll y=floor(x);
    for(ll t=y-5;t<=y+5;t++)
        if(abs((ldb)t*(s-t)-p)<eps&&t>0&&s-t>0)
            return true;
    return false;
}
bool check(){
    if((ldb)s*s-p*4<=-eps) return false;
    if(isi(.5*(s+sqrt((ldb)s*s-p*4)))) return true;
    if(isi(.5*(s-sqrt((ldb)s*s-p*4)))) return true;
    return false;
}

//Main
int main(){
    ios::sync_with_stdio(0);
    cin.tie(0),cout.tie(0);
    cin>>s>>p;
    if(check()) cout<<"Yes\n";
    else cout<<"No\n";
    return 0;
}

#include <bits/stdc++.h>
#define mp make_pair
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define forn(i, n) for (int i = 0; i < (int)(n); ++i)
#define for1(i, n) for (int i = 1; i <= (int)(n); ++i)
#define ford(i, a, b) for (int i = (int)(a); i >= (int)b; --i)
#define fore(i, a, b) for (int i = (int)(a); i <= (int)(b); ++i)
#define rep(i, l, r) for (int i = (l); i <= (r); i++)
#define per(i, r, l) for (int i = (r); i >= (l); i--)
#define ms(x, y) memset(x, y, sizeof(x))
#define SZ(x) int(x.size())
#define ok cerr<<"ok"<<endl
#define db(x) cerr<<(#x)<<'='<<(x)<<endl
using namespace std;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<pii> vpi;
typedef vector<vi> vvi;
typedef long long i64;
typedef vector<i64> vi64;
typedef vector<vi64> vvi64;
typedef pair<i64, i64> pi64;
typedef double ld;
template<class T> bool uin(T &a, T b) { return a > b ? (a = b, true) : false; }
template<class T> bool uax(T &a, T b) { return a < b ? (a = b, true) : false; }
//1.integer overflow (1e5 * 1e5) (2e9 + 2e9)
//2.runtime error
//3.boundary condition
int a,b,c,d;
int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.precision(10);
    cout << fixed;
#ifdef LOCAL_DEFINE
    freopen("input.txt", "r", stdin);
#endif
    cin>>a>>b>>c>>d;
    cout<<a*d-b*c<<endl;
#ifdef LOCAL_DEFINE
    cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";
#endif
    return 0;
}


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

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

int sled0[500005];
int sled1[500005];
int mvs[500005];

int main(){
    ios_base::sync_with_stdio(false), cin.tie(0);
    cout.precision(10);
    cout << fixed;

    int n;
    cin >> n;
    string s, t;
    cin >> s >> t;
    string aa = s, bb = t;
    sort(aa.begin(), aa.end());
    sort(bb.begin(), bb.end());
    if(aa != bb){
        cout << -1;
        return 0;
    }
    vector <int> p;
    vector <int> d;
    for(int i=0; i<n; i++){
        if(s[i] == '0') p.push_back(i);
        if(t[i] == '0') d.push_back(i);
    }
    int res = 0;
    for(int i=0; i<p.size(); i++){
        if(p[i] != d[i]) res++;
    }
    cout << res;
    return 0;
}

#include <bits/stdc++.h>
using namespace std;
#define IOS ios::sync_with_stdio(false); cin.tie(0);
#define FOR(i,s,n) for(int i = (s); i < (n); i++)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) for(int i = (n); i >= 0; i--)
#define ALL(n) (n).begin(), (n).end()
#define RALL(n) (n).rbegin(), (n).rend()
#define ATYN(n) cout << ( (n) ? "Yes":"No") << '\n';
#define CFYN(n) cout << ( (n) ? "YES":"NO") << '\n';
#define OUT(n) cout << (n) << '\n';
using ll = long long;
using ull = unsigned long long;
using pii = pair<int,int>;
using pll = pair<ll,ll>;

int main(void)
{
    auto ansout = [](int a,int b,int c,int d){
        cout << a << " " << b << " " << c << " " << d << '\n';};
    IOS
    int n; cin >> n;
    vector<int> x(n), y(n), r(n);
    REP(i,n) {
        cin >> x[i] >> y[i] >> r[i];
    }
    REP(i,n) ansout(x[i],y[i],x[i]+1,y[i]+1);

    return 0;
}


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

#define INF 100000000
#define MAX_N 18

int N, ds0[MAX_N], ds1[MAX_N], d[MAX_N][MAX_N], dp[1<<MAX_N][MAX_N];

int rec(int bit, int v){
    if(dp[bit][v] < INF) return dp[bit][v];
    if(bit == (1<<v)) return dp[bit][v] = ds1[v];

    int prev_bit = bit & ~(1<<v), res = INF;

    rep(u, N){
        if(!(prev_bit & (1<<u))) continue;
        res = min(res, rec(prev_bit, u) + d[u][v]);
    }
    return dp[bit][v] = res;
}

int main(){
    cin >> N;
    int X[N], Y[N], Z[N];
    rep(i, N) cin >> X[i] >> Y[i] >> Z[i];
    rep(i, (1<<N)) rep(j, N) dp[i][j] = INF;
    rep(i, N) ds1[i] = abs(X[i + 1] - X[0]) + abs(Y[i + 1] - Y[0]) + max(0, Z[i + 1] - Z[0]);
    rep(i, N) ds0[i] = abs(X[i + 1] - X[0]) + abs(Y[i + 1] - Y[0]) + max(0, Z[0] - Z[i + 1]);
    rep(i, N) rep(j, N) d[i][j] = abs(X[i + 1] - X[j + 1]) + abs(Y[i + 1] - Y[j + 1]) + max(0, Z[j + 1] - Z[i + 1]);
    int ans = INF;
    rep(i, N - 1) ans = min(ans, rec((1<<(N - 1)) - 1, i) + ds0[i]);
    cout << ans << endl;
    return 0;
}

#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
const long long MOD =  998244353;
const long long INF = 9999999999999999;
using ll = long long;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
long long pow(long long x, long long n, long long MM) {
    long long ret = 1;
    while (n > 0) {
        if (n & 1) ret = ret * x % MM;  // n の最下位bitが 1 ならば x^(2^i) をかける
        x = x * x % MM;
        n >>= 1;  // n を1bit 左にずらす
    }
    return ret;
}

int main(){
  ll N;
  cin>>N;
  vector <ll> a(N);
  rep(i,N){
    cin>>a[i];
  }
  sort(all(a));
  ll temp = 0;
  rep(i,N){
    if(i == 0){
      temp += a[i];
      temp%=MOD;
    }
    else{
      temp += a[i]*pow(2,i-1,MOD);
      temp%=MOD;
    }
  }
  ll waru = pow(2,MOD-2,MOD);
  ll ans = 0;
  rep(i,N){
    if(i != (N-1)){
      ans += a[i]*temp%MOD;
      ans%=MOD;
      if(temp<(a[i]+a[i+1])){
        temp+=MOD;
      }
      temp -= a[i];
      temp -= a[i+1];
      temp *= waru%MOD;
      temp%=MOD;
      temp += a[i+1];
      temp%=MOD;
      //cout << ans << endl;
      //cout << temp << endl;
    }
    else{
      ans += a[N-1]*a[N-1]%MOD;
      ans%=MOD;
    }
  }
  cout << ans%MOD << endl;
  return 0;
}