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

using namespace __gnu_pbds;
using namespace std;
using namespace std::chrono;

#define ll long long
#define ld long double
#define sz(c) ((ll)c.size())
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
#define int ll
const ll inf = 1e18;

const int mod = 1e9 + 7;
const int mod2 = 998244353;

high_resolution_clock::time_point curTime() { return high_resolution_clock::now(); }

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

signed main()
{
    ios_base :: sync_with_stdio(false);
    cin.tie(NULL);
    auto startTime = curTime();

    int n;
    cin>>n;

    if(n==0)
    {
        cout<<"Yes"<<endl;
        return 0;
    }

    while(n%10==0) n/=10;

    vector<char> s;

    while(n)
    {
        s.push_back(n%10);
        n/=10;
    }
    reverse(s.begin(), s.end());

    bool f =true;
    for(int i=0;i<sz(s)/2;i++)
    {
        if(s[i]!=s[sz(s)-i-1]) f=false;
    }

    cout<<(f? "Yes" : "No")<<endl;

    auto stopTime = curTime();
    auto duration = duration_cast<microseconds>(stopTime - startTime);
    //cout<<"Program ran for "<<(ld)duration.count()/1e6<<" "<<"seconds"<<endl;
}

#include<bits/stdc++.h>
using namespace std;
long long dp[15][205];
int L;
int main(){
    scanf("%d",&L);
    dp[0][0] = 1;
    for(int i=1;i<=12;i++)
        for(int j=1;j<=L;j++){
            for(int k=L;k>=max(j,i);k--){
                dp[i][k] += dp[i-1][k-j];
            }
        }
    printf("%lld\n",dp[12][L]);
    return 0;
}


#include<bits/stdc++.h>
#define ll long long
using namespace std;
const ll p=998244353;
ll n,m,ans,jc[500010],ny[500010];
ll ksm(ll x,ll y){
	ll xlh=1;
	while(y){
		if(y&1)xlh=xlh*x%p;
		x=x*x%p;
		y/=2;
	}
	return xlh;
}
ll C(ll x,ll y){
	return jc[x]*ny[y]%p*ny[x-y]%p;
}
int main(){
	ll i,j,x,y,xlh;
	scanf("%lld%lld",&n,&m);
	jc[0]=ny[0]=1;
	for(i=1;i<=500000;i++)jc[i]=jc[i-1]*i%p,ny[i]=ksm(jc[i],p-2);
	for(i=1;i<=m;i++){
		x=i;
		xlh=1;
		for(j=2;j*j<=x;j++)if(x%j==0){
			//printf("%lld %lld\n",i,j);
			y=0;
			while(x%j==0)x/=j,y++;
			xlh=xlh*C(y-1+n,n-1)%p;
		}
		if(x>1)xlh=xlh*n%p;
		ans=(ans+xlh)%p;
	}
	printf("%lld",ans);
}

#include<string>
#include<iostream>
#include <algorithm>
#include<vector>
#include<functional>
#include <cstdlib>
#include <iomanip>
#include <cmath>
#include <numeric>
#include <math.h>
#define ll long long
#define PI 3.14159265358979323846
#define rep(i,n) for(ll i=0;i<(ll)n;i++)
#define rep1(x,n) for(ll x=1;x<(ll)n+1;x++)
using namespace std;

int g1(ll g1) {
	vector<ll> a;
	bool sw = true;
	ll l1 = 1;
	while (sw) {
		if (g1 > 9) {
				a.push_back(g1 % 10);
				g1 /= 10;
				l1++;

		}
		else {
			a.push_back(g1);
			sw = false;
		}
	}
	sort(a.begin(), a.end());
	ll gg1 = 0;
	ll b = 1;
	rep(j, l1) {
		gg1 += a.at(j) * b;
		b *= 10;
	}
	return gg1;
}
int g2(ll g2) {
	vector<ll> a;
	bool sw = true;
	ll l1 = 1;
	while (sw) {
		if (g2 > 9) {
				a.push_back(g2 % 10);
				g2 /= 10;
				l1++;
		}
		else {
			a.push_back(g2);
			sw = false;
		}
	}
	sort(a.begin(), a.end(),greater<ll>());
	ll gg2 = 0;
	ll b = 1;
	rep(j, l1) {
		gg2 += a.at(j) * b;
		b *= 10;
	}
	return gg2;
}

int main() {
	float A, B;
	cin >> A >> B;
	float ans = ((A - B)*100 / A);
	cout << ans << endl;

}


#pragma GCC optimize ("O2")
#pragma GCC target ("avx")
//#include<bits/stdc++.h>
#include<iostream>
#include<cstring>
//#include<atcoder/all>
//using namespace atcoder;

using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "
#define ce(x) cerr << (x) << "\n"
#define cesp(x) cerr << (x) << " "
#define pb push_back
#define mp make_pair
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
#define Would
#define you
#define please

char cn[1200010];
char* ci = cn, * di = cn, ct;
char tc[200002], *d1 = tc + 100000, *d2 = tc + 200000;
const char d[2] = "0";

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

	rep(i, 100000) tc[i] = '0';
	rep(i, 100000) d1[i] = '1';
	d2[0] = '0';
	d2[1] = '\n';
	fread(cn, 1, 1200010, stdin);
	int T = 0;
	while ((ct = *ci++) >= '0') T = T * 10 + ct - '0';

	rep(t, T) {
		int N = 0;
		while ((ct = *ci++) >= '0') N = N * 10 + ct - '0';
		memcpy(di, d1 - N, N);
		di += N;
		memcpy(di, d2 - N, N + 2);
		di += N + 2;
		ci += 6 * N + 3;
	}
	fwrite(cn, 1, di - cn, stdout);

	Would you please return 0;
}

#include <bits/stdc++.h>

#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define endl "\n"
#define rep(i,n) repi(i,0,n)
#define repi(i,a,n) for(ll i=a;i<(ll)n;++i)
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(),(a).rend()
#define Show(val) cout<<(val)<<" "
#define Showln(val) cout<<(val)<<endl

using namespace std;
using ll = long long;
using P = pair<ll, ll>;
// using P = pair<int, int>;
void YN(bool a) { cout << (a ? "Yes" : "No"); }
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; }

void solve()
{
  ll t;
  cin >> t;

  rep(tt,t){
    ll n;
    string s;
    cin >> n >> s>>s>>s;
    s = string(n, '0')+string(n,'1')+'0';
    Showln(s);
  }
}

int main()
{
  fastio;
  solve();

  return 0;
}


// Problem: E - Train
// Contest: AtCoder - AtCoder Beginner Contest 192
// URL: https://atcoder.jp/contests/abc192/tasks/abc192_e
// Memory Limit: 1024 MB
// Time Limit: 2000 ms
//
// Powered by CP Editor (https://cpeditor.org)

#include <algorithm>
#include <bitset>
#include <cassert>
#include <chrono>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <random>
#include <set>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#define ll long long
#define mod 1000000007

// templates
#define all(v) v.begin(), v.end()
#define F first
#define S second
#define sz(x) (int)x.size()
#define po(x, y) fixed << setprecision(y) << x
#define ss(s) scanf(" %[^\n]%*c", s)
#define sc(n) scanf("%d", &n)
#define sl(n) scanf("%lld", &n)
#define ps(s) printf("%s\n", s)
#define pr(n) printf("%d\n", n)
#define pl(n) printf("%lld\n", n)
#define prs(n) printf("%d ", n)
#define pls(n) printf("%lld ", n)
using namespace std;

const ll inf = (ll)1e16 + 10;
const int N = (int)1e5 + 10;
int a[N], b[N];
vector<array<ll, 3>> adj[N];  // u->v,t,k
vector<ll> dist(N);
ll n, m, x, y;
void bfs() {
  set<array<ll, 2>> s;  // time,node
  s.insert({0, x});
  for (int i = 0; i <= n; i++) {
    dist[i] = inf;
  }
  dist[x] = 0;
  while (sz(s)) {
    auto temp = *s.begin();
    s.erase(s.begin());
    ll node = temp[1], kete = temp[0];
    for (auto c : adj[node]) {
      ll add = 0;
      if (kete < c[2] && kete != 0) {
        add = (c[2] - kete);
      } else if (kete != 0) {
        if (kete % c[2]) {
          add = c[2] - (kete % c[2]);
        }
      }
      ll curr = c[1] + add + kete;
      // printf("node-> %lld curr-> %lld\n", node, curr);
      if (dist[c[0]] > curr) {
        s.erase({dist[c[0]], c[0]});
        dist[c[0]] = curr;
        s.insert({curr, c[0]});
      }
    }
  }
  if (dist[y] == inf) {
    dist[y] = -1;
  }
  pl(dist[y]);
}
void solve() {
  sl(n), sl(m), sl(x), sl(y);
  for (int i = 1; i <= m; i++) {
    ll u, v, t, k;
    sl(u), sl(v), sl(t), sl(k);
    adj[u].push_back({v, t, k});
    adj[v].push_back({u, t, k});
  }
  bfs();
}

int main() {
  // #ifndef ONLINE_JUDGE
  // freopen("input.txt", "r", stdin);
  // freopen("output.txt", "w", stdout);
  // #endif
  int t = 1;
  // sc(t);
  while (t--) {
    solve();
  }
  // cerr << (float)clock() / CLOCKS_PER_SEC * 1000 << " ms" << endl;
  return 0;
}

#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ss second
#define ff first
#define all(a) a.begin(), a.end()
#define All(a) a.rbegin(), a.rend()
#define ios ios_base::sync_with_stdio(0), cin.tie(0), cout.precision(10), cout << fixed
const int N = 2e5 + 5;
ll cost[N], n, m;
ll inf = 1e18;
struct dt {
    int u, cost, k;
    dt(int u, int cost, int k) {
        this->u = u;
        this->cost = cost;
        this->k = k;
    }
};
vector<dt> g[N];
void dijk(ll u) {
    priority_queue<pair<ll, ll>, vector<pair<ll, ll>>, greater<pair<ll, ll>>> q;
    for (int i = 0; i <= n; ++i)
        cost[i] = inf;
    cost[u] = 0;
    q.push({0, u});
    while (!q.empty()) {
        ll src = q.top().ss, cst = q.top().ff;
        q.pop();
        for (int i = 0; i < g[src].size(); ++i) {
            ll curr = g[src][i].u;
            ll tmp = (ll)ceil(cst / (double)g[src][i].k) * g[src][i].k + g[src][i].cost;
            if (tmp < cost[curr]) {
                cost[curr] = tmp;
                q.push({cost[curr], curr});
            }
        }
    }
}
int main() {
    ios;
#ifndef ONLINE_JUDGE
    freopen("in.txt", "r", stdin);
    freopen("out.txt", "w", stdout);
#endif
    int x, y;
    cin >> n >> m >> x >> y;
    x--;
    y--;
    for (int i = 0, a, b, c, d; i < m; ++i) {
        cin >> a >> b >> c >> d;
        a--;
        b--;
        g[a].push_back(dt(b, c, d));
        g[b].push_back(dt(a, c, d));
    }
    dijk(x);
    cout << (cost[y] == inf ? -1 : cost[y]) << '\n';
    return 0;
}


#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
int n,k,mod,buf[2000005],buf2[2000005],*f=buf+1000000,*g=buf2+1000000;
int val=500000,tans[100005];
inline int addmod(int x)
{
	return x>=mod?x-mod:x;
}
inline int submod(int x)
{
	return x<0?x+mod:x;
}
int fpow(int x,int y)
{
	int ans=1;
	while(y)
	{
		if(y&1) ans=1ll*ans*x%mod;
		x=1ll*x*x%mod;
		y/=2;
	}
	return ans;
}
void ins(int x)
{
	for(int i=-val;i<=val;i++)
	{
		g[i]=addmod(g[i-x]+f[i]);
		f[i]=addmod(f[i]+submod(g[i-x]-g[i-(k+1)*x]));
	}
}
void ins2(int x)
{
	for(int i=val;i>=-val;i--)
	{
		g[i]=addmod(g[i-x]+f[i]);
		f[i]=addmod(f[i]+submod(g[i-x]-g[i-(k+1)*x]));
	}
}
void del(int x)
{
	for(int i=-val;i<=val;i++)
	{
		f[i]=submod(f[i]-submod(g[i-x]-g[i-(k+1)*x]));
		g[i]=addmod(g[i-x]+f[i]);
	}
}
int main()
{
	scanf("%d%d%d",&n,&k,&mod);
	f[0]=1;
	for(int i=1;i<n;i++)
		ins(i);
	tans[1]=submod(1ll*f[0]*(k+1)%mod-1);
	for(int i=2;i<=n;i++)
	{
		del(n-i+1);
	/*	for(int j=-val;j<=val;j++)
			if(f[j])
			{
				printf("j=%d,f=%d\n",j,f[j]);
			}*/
		ins2(-i+1);
	/*	printf("i=%d\n",i);
		for(int j=-val;j<=val;j++)
			if(f[j])
			{
				printf("j=%d,f=%d\n",j,f[j]);
			}*/
		tans[i]=submod(1ll*f[0]*(k+1)%mod-1);
	}
	for(int i=1;i<=n;i++)
		printf("%d\n",tans[i]);
	return 0;
}

#include<iostream>
#include<cstdio>
using namespace std;
long long n,k,sum,f[101][1000001],mod,ans;

int main(){
	scanf("%lld%lld%lld",&n,&k,&mod);
	sum=((n*(n-1ll))/2ll)*k;
	f[0ll][0ll]=1ll;
	for(long long i=1ll;i<=n;i++){
		for(long long j=0ll;j<=sum;j++){
			f[i][j]=f[i-1ll][j];
			if(j>=i)f[i][j]=(f[i][j]+f[i][j-i])%mod;
			if(j>=(k+1ll)*i)f[i][j]=(f[i][j]-f[i-1][j-(k+1)*i]+mod)%mod;
		}
	}
	for(long long i=1ll;i<=n;i++){
		ans=0ll;
		for(long long j=0ll;j<=sum;j++)ans=(ans+f[i-1ll][j]*f[n-i][j])%mod;
		ans=ans*(k+1ll)%mod;
		ans--;
		printf("%lld\n",ans);
	}
}


/*
	may God of speed-forces be with us !!

	--problem isnt, life is empty;
	--problem is, life is full of emptiness;
		a non-strugling pupil coder !!
*/

#include "bits/stdc++.h"
using namespace std;
#define pb push_back
#define F first
#define S second
//#define biGinf 9e+18
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
#define inpv(v) for(auto &x:v) cin>>x
#define otpv(v) for(auto &x:v) cout<<x<<nwl
#define otpv2(v) for(auto &x:v) cout<<x<<" "
#define CASES int tt;cin>>tt; while(tt--)
#define for0(i,n) for(int i=0; i<n; i++)
#define for1(i,n) for(int i=1; i<=n; i++)
#define forr(i,r,n) for(int i=r; i<=n; i++)
#define forj(j,n) for(int j=n; j>=0; j--)
#define forx(x,v) for(auto &x:v)
#define sz(v) (int)(v).size()
#define rz(n) resize(n)
#define vec(x) vector < x >
#define vvim(n,m,v) vvi v(n, vi(m))
using int64 = long long;
using vi = vector < int >;
using vi64 = vector < int64 >;
using mii = map <int , int >;
using vvi = vector < vi >;
using pii = pair < int , int >;
using vpii = vector < pii >;
const int inf = 2e9 + 7;
const char nwl = '\n';
const int mxx = 1e6 + 3;

int64 sumV(vi &v) {
	int64 s = 0;
	for (int x : v) {
		s += (int64)x;
	}
	return s;
}

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

bool powerOf2(int n) {
	if (n & (n - 1)) return 0;
	return 1;
}

//const int64 biGinf = 9e+18;
//const string yo = "Yes\n", no = "No\n";

int64 ceil2(int64 a, int64 b) {
	int64 d = a / b;
	if (a % b ) d += 1;
	return d;
}

int32_t main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	//ur code
	int64 n, m;
	cin >> n >> m;
	vi64 v(m);
	inpv(v);
	sort(all(v));

	int64 ans = 0;

	if (n == m) {
		ans = 0;
	} else if (!m) {
		ans = 1;
	} else {
		int64 c = 0, p = n;
		for0(i, m) {
			int64 z = v[i] - c - 1ll;
			if (z > 0)
				p = min(p, z);
			c = v[i];
		}

		int64 z = n - v[m - 1];
		if (z > 0) {
			p = min(p, z);
		}

		c = 0;

		for0(i, m) {
			int64 x = ceil2((v[i] - c - 1ll) , p);
			c = v[i];
			ans += x;
		}

		int64 x = ceil2((n - c), p);
		ans += x;
	}
	cout << ans << nwl;

	return 0;
}

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

int main(){
  int n, m; cin >> n >> m;
  vector<int> a(m+2);
  rep(i,m) cin >> a[i+1];
  a.back() = n+1;
  sort(a.begin(), a.end());

  int k = n;
  rep(i,m+1){
    int x = a[i+1] - a[i] - 1;
    if(x > 0) chmin(k, x);
  }

  int ans = 0;
  rep(i,m+1){
    int x = a[i+1] - a[i] - 1;
    if(x > 0) ans += (x + k-1)/k;
  }

  cout << ans << endl;
}


/*Created By:---- Dibas Behera*/
#include<bits/stdc++.h>
using namespace std;

#define db(x) cout<<x<<'\n'
#define db1(x) cout<<#x<<"="<<x<<'\n'
#define db2(x,y) cout<<#x<<"="<<x<<","<<#y<<"="<<y<<'\n'
#define db3(x,y,z) cout<<#x<<"="<<x<<","<<#y<<"="<<y<<","<<#z<<"="<<z<<'\n'
#define repi(i,n) for(int i=0;i<(n);++i)
//#define repA(i,a,n) for(int i=a;i<=(n);++i)
//#define repD(i,a,n) for(int i=a;i>=(n);--i)
#define ll long long int
#define endl '\n'
#define lld long long double
#define vi vector<int>
#define vl vector<ll>
#define vb vector<bool>
#define vvi vector<vector<int>  >
#define err(t) cout<<"Error : "<<t<<endl;
#define all(v) v.begin(),v.end()
#define mp make_pair
#define M 100000
#define MD 1000000007 //998244353
#define pb push_back
#define rep(i,a,b) for(ll i = a; i <= (b); i++)
#define pii pair<int,int>
#define pll pair<ll,ll>
#define vec(a) vector<a >
#define se second
#define fi first
#define inf 0xffffffff
#define inchar getchar_unlocked
#define outchar(x) putchar_unlocked(x)

#define goo(x)	cout<<"Case #"<<(x)<<": ";
//template <typename T>
//using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
ll binpow(ll a,ll b){	if(a==0) return 0; if(b==0) return 1;ll ans=1;while(b>0){if(b&1) ans=ans*a; a=a*a; b=b>>1;}	return ans;}
ll binpowM(ll a,ll b,ll m=MD){	if(a==0) return 0; if(b==0) return 1;ll ans=1;while(b>0){if(b&1) ans=ans*a;ans%=m; a=a*a;a%=m; b=b>>1;}	return ans;}
template <typename T>
T Min(T a,T b){ return a<b?a:b; }
template <typename T>
T Max(T a,T b){ return a>b?a:b; }

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

int32_t main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);cout.tie(NULL);
	// int n;cin>>n;
	// string s;cin>>s;

	ll n;cin>>n; vl a(n); repi(i,n) cin>>a[i];
    ll ans=0;
    repi(i,n){
        if(a[i]>10) ans+=a[i]-10;
    }
    db(ans);
	/*
	int test1;cin>>test1;while(test1--){

	 }
	 //*/
return 0;
}

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

// clang-format off
#define range(i, l, r) for ( int i = (int)(l); i < (int)(r); (i) += 1 )
#define rrange(i, l, r) for ( int i = (int)(r)-1; i >= (int)(l); (i) -= 1 )
#define debug(x) cerr << "(" << __LINE__ << ") " << #x << ": " << (x) << endl;
template <typename T1, typename T2> inline bool chmax(T1 &a, T2 b) { return a < b && (a = b, true); }
template <typename T1, typename T2> inline bool chmin(T1 &a, T2 b) { return a > b && (a = b, true); }
template <typename T1, typename T2> ostream &operator<<(ostream &os, const pair<T1, T2> &p) { os << p.first << ' ' << p.second; return os; }
template <typename T1, typename T2> ostream &operator<<(ostream &os, const map<T1, T2> &v) { for ( pair<T1, T2> x : v ) { os << x << (x.first == v.rbegin()->first && x.second == v.rbegin()->second ? "" : "\n"); } return os; }
template <typename T> ostream &operator<<(ostream &os, queue<T> v) { if(!v.empty()) { os << v.front(); v.pop(); } while (!v.empty()) { os << " " << v.front(); v.pop(); } return os; }
template <typename T> ostream &operator<<(ostream &os, stack<T> v) { if(!v.empty()) { os << v.top(); v.pop(); } while (!v.empty()) { os << " " << v.top(); v.pop(); } return os; }
template <typename T> ostream &operator<<(ostream &os, const vector<T> &v) { bool is_f = true; for ( T x : v ) { os << (is_f ? "" : " ") << x; is_f = false; } return os; }
template <typename T> ostream &operator<<(ostream &os, const deque<T> &v) { bool is_f = true; for ( T x : v ) { os << (is_f ? "" : " ") << x; is_f = false; } return os; }
template <typename T> ostream &operator<<(ostream &os, const set<T> &v) { bool is_f = true; for ( T x : v ) { os << (is_f ? "" : " ") << x; is_f = false; } return os; }
using ull = unsigned long long;
using ll = long long;
using Pll = pair<ll, ll>;
using P = pair<int, int>;
constexpr ll INF64 = INT64_MAX / 2;
constexpr int INF32 = INT32_MAX / 2;
constexpr int dy[] = { 0, -1, 1, 0, -1, 1, -1, 1 };
constexpr int dx[] = { -1, 0, 0, 1, -1, -1, 1, 1 };
constexpr int mod998244353 = 998244353;
constexpr int mod1000000007 = (int)1e9 + 7;
constexpr char newl = '\n';
// clang-format on

template <typename T>
struct CumulativeSum {
  vector<T> sum;
  CumulativeSum(const vector<T> &a) {
    int n = a.size();
    sum.assign(n + 1, 0);
    for ( int i = 0; i < n; i++ )
      sum[i + 1] = a[i] + sum[i];
  }

  T query(int l, int r) { return sum[r] - sum[l]; }
};

template <typename T1, typename T2>
T1 Binomial(T1 n, T2 r) {
  T1 res = 1;
  for ( T1 i = 0; i < r; i++ ) {
    res *= n - i;
    res /= i + 1;
  }
  return res;
}

int main() {
  int n;
  cin >> n;
  vector<ll> a(n);
  for ( auto &A : a )
    cin >> A;

  range(i, 0, n) {
    if ( i % 2 == 0 ) a[i] *= -1;
  }

  CumulativeSum<ll> sum(a);

  map<ll, ll> cntmp;
  for ( auto x : sum.sum ) {
    cntmp[x]++;
  }

  ll ans = 0;
  for ( auto [val, cnt] : cntmp ) {
    ans += Binomial(cnt, 2LL);
  }
  cout << ans << endl;
}


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

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

int a , b , c;

int main()
{
	a = read() , b = read() , c = read();
	if( ( c & 1 ) == 0 )
		a = abs( a ) , b = abs( b );
	putchar( a == b ? '=' : ( a < b ? '<' : '>' ) );
	return 0;
}

#include <bits/stdc++.h>
#include <unordered_map>
#define fast_io                                                                                \
    ios::sync_with_stdio(false);                                                                                \
    cin.tie(0)
using namespace std;
using ll = long long;
using P = pair<int, int>;
const int mod = 998244353;

string helper(string s) {
	if (s.size() % 2 == 1) s += s;
	string ret;
	for (int i = 0; i < s.size(); i += 2) {
		if (s[i] == s[i + 1]) { ret += s[i]; }
		else {
			if ((s[i] == 'R'&&s[i + 1] == 'S') || (s[i + 1] == 'R'&&s[i] == 'S')) { ret += 'R'; }
			if ((s[i] == 'R'&&s[i + 1] == 'P') || (s[i + 1] == 'R'&&s[i] == 'P')) { ret += 'P'; }
			if ((s[i] == 'P'&&s[i + 1] == 'S') || (s[i + 1] == 'P'&&s[i] == 'S')) { ret += 'S'; }
		}
	}
	return ret;
}

int main() {
	int n,k;
	string s;
	cin >> n>> k;
	cin >> s;
	char ans;
	for (int i = 0; i < k; i++) {
		s = helper(s);
	}
	ans = s[0];
	cout << ans << endl;
	return 0;
}


/*---------changeable---------*/
const int big=1000000007;
//const int big=998244353;
const double EPS=1e-8; //適宜変える
//#include <atcoder/all>
//using namespace atcoder;

#pragma region template
#ifdef LOGX
#define _GLIBCXX_DEBUG
#endif
#include <bits/stdc++.h>
using namespace std;

/*---------macro---------*/
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = s; i < (int)(n); i++)
#define ALL(a) a.begin(),a.end()
#define RALL(a) a.rbegin(),a.rend()
#define mybit(i,j) (((i)>>(j))&1)

/*---------type/const---------*/
typedef long long ll;
typedef unsigned long long ull;
typedef std::string::const_iterator state; //構文解析
const int dx[4]={1,0,-1,0};
const int dy[4]={0,1,0,-1};
const char newl='\n';
struct{
    constexpr operator int(){return -int(1e9)-10;}
    constexpr operator ll(){return -ll(1e18)-10;}
}neginf;
struct{
    constexpr operator int(){return int(1e9)+10;}
    constexpr operator ll(){return ll(1e18)+10;}
    constexpr auto operator -(){return neginf;}
}inf;

/*---------debug---------*/
#ifdef LOGX
#include <template/debug.hpp>
#else
#define dbg(...) ;
#define dbgnewl ;
#define prt(x) ;
#define _prt(x) ;
#endif

/*---------function---------*/
template<typename T> T max(const std::vector<T> &a){T ans=a[0];for(T elem:a){ans=max(ans,elem);}return ans;}
template<typename T> T min(const std::vector<T> &a){T ans=a[0];for(T elem:a){ans=min(ans,elem);}return ans;}
template<typename T,typename U> bool chmin(T &a,const U b){if(a>b){a=b;return true;}return false;}
template<typename T,typename U> bool chmax(T &a,const U b){if(a<b){a=b;return true;}return false;}
bool valid(int i,int j,int h,int w){return (i>=0 && j>=0 && i<h && j<w);}
template<class T,class U>T expm(T x,U y,const ll mod=big){T res=1;while(y){if(y&1)(res*=x)%=mod;(x*=x)%=mod;y>>=1;}return res;}
template<class T,class U>T exp(T x,U y){T res=1;while(y){if(y&1)res*=x;x*=x;y>>=1;}return res;}
#pragma endregion template

int main(){
    std::ios::sync_with_stdio(false);
    std::cin.tie(nullptr);
    std::cout.precision(10);
/*------------------------------------*/

    int n;
    cin >> n;
    vector<int> a(n),b(n);
    rep(i,n)cin >> a[i];
    rep(i,n)cin >> b[i];
    cout << max(0,min(b)-max(a)+1) << newl;
}


/* Sat-Chitta-Ananda */

#include <bits/stdc++.h>
using namespace std;
#define int long long
#define double long double
#define inf (int)1e9
#define f first
#define s second

int readInt() { int x; cin >> x; return x; }
char readChar() { char x; cin >> x; return x; }
int readDouble() { double x; cin >> x; return x; }
string readStr() { string x; cin >> x; return x; }

int Dijkstra(const vector<vector<pair<int,int>>> &g, const int &n, int sv) {
	vector<int> d(n, inf);
	d[sv] = 0;

	int ans = inf;

	priority_queue<pair<int,int>, vector<pair<int,int>>, greater<pair<int,int>>> Queue;
	Queue.push({d[sv], sv});

	while(!Queue.empty()) {
		int node = Queue.top().s;
		int weight = Queue.top().f;
		Queue.pop();

		if(weight > d[node]) continue;

		for(auto itr : g[node]) {
			int distance = itr.f;
			int neighbor = itr.s;
			// itself
			if(neighbor == sv) {
				ans = min(ans, d[node] + distance);
			}
			else {
				if(d[neighbor] > d[node] + distance) {
					d[neighbor] = d[node] + distance;
					Queue.push({d[neighbor], neighbor});
				}
			}
		}
	}

	if(ans >= inf) ans = -1;
	return ans;
}

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

	int n = readInt();
	int m = readInt();

	vector<vector<pair<int,int>>> g(n);
	for(int i = 0 ; i < m ; ++i) {
		int a = readInt();
		int b = readInt();
		int c = readInt();
		g[a-1].push_back({c, b-1});
	}

	for(int i = 0 ; i < n ; ++i) {
		cout << Dijkstra(g, n, i) << '\n';
	}

	return 0;
}

#include <bits/stdc++.h>
//#include <atcoder/modint>
//#include <atcoder/math>
//#include <boost/multiprecision/cpp_int.hpp>
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
#pragma GCC optimize("O3")
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPP(i, n) for(int i = 1; i <= n; i++)
#define ALL(obj) (obj).begin(), (obj).end()
#define EPS (1e-9)
#define INF (1e17)
#define PI (acos(-1))
//const double PI = acos(-1);
//const double EPS = 1e-15;
//long long INF=(long long)1E17;
#define i_7 (long long)(1e9+7)
//#define i_7 998'244'353
long mod(long a){
    long long c = a % i_7;
    if(c >= 0) return c;
    return c + i_7;
}
long long po(long a, long b){
    if(b == 0) return 1;

    long long z = po(a , b / 2);
    z = mod(z * z);
    if(b % 2 != 0) z = mod(a * z);
    return z;
}

bool prime_(int n){
    if(n == 1){
        return false;
    }else if(n == 2){
        return true;
    }else{
        for(int i = 2; i <= std::sqrt(n); i++) if(n % i == 0) return false;
        return true;
    }
}

long long gcd_(long long a, long long b){
    if(a < b) std::swap(a,b);
    if(a % b == 0) return b;
    else return gcd_(b, a % b);
}

long long lcm_(long long x, long long y){
    return (x / gcd_(x,y)) * y;
}

using namespace std;
//using namespace atcoder;
//using mint = modint1000000007;
//using mint = modint998244353;
//using namespace boost::multiprecision;
//using namespace __gnu_pbds;

typedef pair<int, int> P;
unordered_map<int, int> G[2010];

int main(){
    //using namespace std;

    int n, m;
    cin>>n>>m;
    int a[m], b[m], c[m];
    REP(i, m){
        cin>>a[i]>>b[i]>>c[i];
        a[i]--; b[i]--;
    }

    REP(i, m){
        if(G[a[i]].find(b[i]) == G[a[i]].end()){
            G[a[i]][b[i]] = c[i];
            continue;
        }
        G[a[i]][b[i]] = min(G[a[i]][b[i]], c[i]);
    }

    vector<int> ans(n, -1);
    REP(st, n){
        //cout << "st: " << st << endl;
        vector<int> dist(n, -1);
        dist[st] = 0;
        priority_queue<P, vector<P>, greater<P>> pq;
        pq.emplace(0, st);
        while(!pq.empty()){
            int now = pq.top().second;
            int d = pq.top().first;
            //cout << "now: " << now << "d: " << d << endl;
            pq.pop();
            if(dist[now] > 0 && dist[now] < d) continue;
            if(now == st && d > 0) continue;
            //if(now == st && d > 0) break;
            for(auto& [nxt, cost]: G[now]){
                if(nxt != st && nxt == now) continue;
                if(dist[nxt] > 0 && dist[nxt] <= d + cost) continue;
                dist[nxt] = d + cost;
                pq.emplace(dist[nxt], nxt);
            }
        }
        ans[st] = dist[st] == 0 ? -1 : dist[st];
    }
    REP(i, n) cout << ans[i] << endl;
    return 0;
}


#include <bits/stdc++.h>

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

using namespace std;
using ll = long long;

bool v_cmp(pair<int, vector<int>> &p, pair<int, vector<int>> &q) {
    return p.first < q.first;
}
// sort(v.begin(), v.end(), v_cmp); // small to large

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

    int N;
    cin >> N;
    vector<int> A(N);
    for (int i = 0; i < N; i++) {
        cin >> A[i];
        A[i] %= 200;
    }

    vector<pair<int, vector<int>>> pairs;
    for (int bits = 0; bits < (1 << min(N, 8)); bits++) {
        bitset<8> bs(bits);
        int tmp = 0;
        vector<int> s;
        for (int i = 0; i < min(N, 8); i++) {
            if (bs[i]) {
                tmp += A[i];
                tmp %= 200;
                s.push_back(i + 1);
            }
        }
        if (s.size() != 0) pairs.push_back(make_pair(tmp, s));
    }
    sort(pairs.begin(), pairs.end(), v_cmp);

    for (int i = 0; i < pairs.size() - 1; i++) {
        if (pairs[i].first == pairs[i + 1].first) {
            cout << "Yes" << endl;
            cout << pairs[i].second.size();
            for (int o : pairs[i].second) cout << " " << o;
            cout << endl;

            cout << pairs[i + 1].second.size();
            for (int o : pairs[i + 1].second) cout << " " << o;
            cout << endl;
            return 0;
        }
    }

    cout << "No" << endl;

    return 0;
}

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

ll mod = 1000000007;

int main() {
    ll N; cin >> N;
    ll dp[N+1][200]; ll A[N];
    rep(i,200){
        rep(j,N+1) dp[j][i] = 0;
    }
    dp[0][0] = 1; ll k,l; bool found = false;
    rep(i,N){
        ll a; cin >> a;
        A[i] = a%200;
        rep(j,200){
            if(!found&&j!=0&&dp[i][j]>=2){
                k = i; l = j; found = true;
            }
            dp[i+1][j] += dp[i][j];
            dp[i+1][(j+A[i])%200] += dp[i][j];
        }
    }
    rep(j,200){
        if(!found&&j!=0&&dp[N][j]>=2){
            k = N; l = j; found = true;
        }
    }
    if(!found){
        if(dp[N][0]>=3){
            cout << "Yes" << endl;
            ll s=0,t=0;
            rep(i,N){
                if(s==0&&A[i]%200==0){
                    s = i+1;
                }
                else if(A[i]%200==0) t = i+1;
            }
            cout << 1 << " " << s << endl;
            cout << 1 << " " << t << endl;
            return 0;
        }
        cout << "No" << endl;
    }
    else{
        cout << "Yes" << endl;
        vector<int> aa,ab;
        ll res = l;
        for(int i=k;i>=1;i--){
            if(dp[i-1][(res+200-A[i-1])%200]>=1){
                res = (res+200-A[i-1])%200; aa.push_back(i);
            }
        }
        res = l;
        for(int i=k;i>=1;i--){
            if(dp[i-1][res]>=1){
                continue;
            }
            else{
                res = (res+200-A[i-1])%200; ab.push_back(i);
            }
        }
        reverse(aa.begin(),aa.end()); reverse(ab.begin(),ab.end());
        cout << aa.size() << " ";
        for(int x:aa) cout << x << " ";
        cout << endl;
        cout << ab.size() << " ";
        for(int x:ab) cout << x << " ";
        cout << endl;
    }
    //cout << ans << endl;
}


#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define fi first
#define se second
const int N=101;
const ll mod=1e9+7;
int n;
bool a[N][N];
int main(){
	ios::sync_with_stdio(false);
	cin >> n;
	for(int i=1; i<=n ;i++){
		for(int j=1; j<=n ;j++){
			char c;cin >> c;
			if(c=='1') a[i][j]=1;
		}
		a[i][i]=1;
	}
	for(int k=1; k<=n ;k++){
		for(int i=1; i<=n ;i++){
			for(int j=1; j<=n ;j++){
				a[i][j]|=a[i][k]&a[k][j];
			}
		}
	}
	double ans=0;
	for(int i=1; i<=n ;i++){
		int cnt=0;
		for(int j=1; j<=n ;j++) cnt+=a[j][i];
		ans+=1.0/(cnt);
	}
	cout << fixed << setprecision(15) << ans << '\n';
}

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

 ll s,d,m,n,x;
 s=d=0;
 m=0;
 cin >> n;
 while(n--)
 {
  cin >> x;
  s+=abs(x);
  d+=x*x;
  m=max(m,abs(x));
 }
 cout << s << '\n';
 cout << setprecision(15) << fixed << (double)sqrt(d) << '\n';
 cout << m;
 return 0;
}


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

int charToInt(char c){
    char zero_num = '0';
    return (int)c - (int)zero_num;
}

signed main(){
    int M, H; cin>>M>>H;
    if(H%M==0){
        cout<<"Yes"<<endl;
    }else{
        cout<<"No"<<endl;
    }
    return 0;
}

#include <bits/stdc++.h>
#include <iomanip>
#define ll long long
#define lli long long int
#define ms0(x) memset(x, 0, sizeof(x))
using namespace std;
long long MAXN = 1e9;

long double pi = 3.1415926536;

long long mod = 1e9;

bool secgreat(pair<pair<lli, lli>, lli> a, pair<pair<lli, lli>, lli> b)
{
    pair<lli, lli> x, y;
    x = a.first;
    y = b.first;

    return (x.first > y.first) || (x.first == y.first && x.second > y.second);
}

bool secgreat2(pair<pair<lli, lli>, lli> a, pair<pair<lli, lli>, lli> b)
{
    pair<lli, lli> x, y;
    x = a.first;
    y = b.first;

    return (x.first > y.second) || (x.first == y.second && x.second > y.first);
}

/*
long long fact(long long n){
    n%=mod;
    if(n==0){
        return 1;
    }
    else if(n == 1){
        return 1;
    }
    else{
        return ((n%mod)*(fact(n-1)%mod))%mod;
    }
}

long long power(long long n, long long pow){
    n%=mod;
    long long res = 1;
    while(pow){
        if(pow%2){
            res = ((res%mod)*(n%mod))%mod;
        }
        pow/=2;
        n= ((n%mod)*(n%mod))%mod;
    }
    res%=mod;
    return res;

}

long long inversemod(long long n){
    return power(n, mod-2)%mod;
}
long long ncr(long long a){
    long long z = ((fact(a)%mod)(((inversemod(fact((a/2)%mod)%mod)%mod)(inversemod(fact((a/2)%mod)%mod)%mod)%mod)%mod)%mod)%mod;
    return z;
}
*/

/*
struct node{
    long long key;
    node* left;
    node* right;
};

struct node* newnode(long long item){
    struct node* temp = new struct node;
    temp->key = item;
    temp->left = NULL;
    temp->right = NULL;
    return temp;
};

struct node* insert(struct node* root, long long key){
    if(root == NULL){
        return newnode(key);
    }

    if (key<root->key){
        root->left = insert(root->left, key);
    }
    else if(key>root->key){
        root->right = insert(root->right, key);
    }
};
*/
/*
string binary(int a){
    string s;
    int x = 9;
    while(x>0){
        s.push_back(48+a%2);
        a/=2;
        x--;
    }
    reverse(s.begin(), s.end());

    return s;
}

int strtoi(string s){
    int n = s.length();
    int i;
    int sum = 0;
    for(i = 0; i<n; i++){
        sum+=pow(2, i)*s[i];
    }
    return sum;
}
*/

/*
long long nCrModp(long long n, long long r, long long p)
{

    if (r > n - r)
        r = n - r;

    long long C[r + 1];
    memset(C, 0, sizeof(C));

    C[0] = 1;
    for (long long i = 1; i <= n; i++) {

        for (int j = min(i, r); j > 0; j--)

            C[j] = (C[j] + C[j - 1]) % p;
    }
    return C[r];
}
*/

// int dfs_far(vector<bool> visited, int v, vector<int> node[])
// {
//     visited[v - 1] = true;
//     if (int(node[v - 1].size()) == 1)
//     {
//         return v;
//     }
//     int x;
//     for (auto i : node[v - 1])
//     {
//         if (visited[i - 1] == false)
//         {
//             x = dfs_far(visited, i, node);
//             break;
//         }
//     }
//     return x;
// }

// int dfs_dia(vector<bool> visited, int v, vector<int> node[], int dist)
// {

//     visited[v - 1] = true;
//     //cout << "Correct answer should be " << node[v].size() << endl;
//     if (node[v - 1].size() == 1 && dist != 0)
//     {

//         return dist;
//     }
//     int x;
//     for (auto i : node[v - 1])
//     {
//         if (visited[i - 1] == false)
//         {
//             dist++;
//             //cout << i << " dist -> " << dist << endl;
//             x = dfs_dia(visited, i, node, dist);
//             break;
//         }
//     }
//     return x;
// }

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    lli n;
    long long int x, y, t;
    cin >> n >> t;
    t *= 100;
    lli i;
    lli sum = 0;
    for (i = 0; i < n; i++)
    {
        cin >> x >> y;
        sum += x * y;
        if (sum > t)
        {
            cout << i + 1;
            return 0;
        }
    }

    cout << "-1";
}


#include<bits/stdc++.h>
using namespace std;
// #include <atcoder/all>
// using namespace atcoder;
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define drep(i,n) for(int i = (n-1); i >= 0; i--)
#define all(v) (v).begin(),(v).end()
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
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; }
template <class T> T gcd(T a, T b) { return b ? gcd(b, a % b) : a; }
template <class T> T lcm(T a, T b) { return a/gcd(a,b)*b; }
typedef pair<int, int> P;
typedef long long ll;
const int INF = 1001001001;
const ll LINF = 1001002003004005006ll;
const ll MOD = 1e9+7;

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int r, c;
    cin >> r >> c;
    vector<vector<int>> a(r, vector<int>(c-1));
    vector<vector<int>> b(r-1, vector<int>(c));
    rep(i,r) rep(j,c-1) cin >> a[i][j];
    rep(i,r-1) rep(j,c) cin >> b[i][j];

    priority_queue<P, vector<P>, greater<P>> q;
    vector<int> dist(r*c*2, INF);
    auto push = [&](int i, int j, int k, int x) {
        int v = i*c*2 + j*2 + k;
        if (dist[v] <= x) return;
        dist[v] = x;
        q.emplace(x, v);
    };
    push(0,0,0,0);
    while (!q.empty()) {
        auto [x, v] = q.top(); q.pop();
        if (dist[v] != x) continue;
        int i = v/(c*2);
        int j = v/2%c;
        int k = v%2;
        if (k==0) {
            if (j+1 < c) push(i, j+1, k, x+a[i][j]);
            if (j-1 >=0) push(i, j-1, k, x+a[i][j-1]);
            if (i+1 < r) push(i+1, j, k, x+b[i][j]);
            push(i, j, 1, x+1);
        } else {
            if (i-1 >=0) push(i-1, j, k, x+1);
            push(i, j, 0, x);
        }
    }
    int ans = dist[(r*c-1)*2];
	cout << ans << endl;
	return 0;
}

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

struct PQItem{
    int d,x,y;
    bool jump;
    bool operator<(const PQItem& other)const{
        return d>other.d;
    }
};

int main() {
    int r,c;
    cin>>r>>c;
    vector<vector<int>> a(r,vector<int>(c-1)),b(r-1,vector<int>(c));
    for(auto &row:a)
        for(int &x:row)
            cin>>x;
    for(auto &row:b)
        for(int &x:row)
            cin>>x;
    vector<vector<array<int,2>>> best(r,vector<array<int,2>>(c,{INT_MAX,INT_MAX}));
    priority_queue<PQItem> pq;
    pq.push({0,0,0,false});
    while(true){
        PQItem it=pq.top();
        pq.pop();
        if(best[it.x][it.y][it.jump]<it.d)continue;
        if(it.x==r-1&&it.y==c-1){
            cout<<it.d<<endl;
            break;
        }
        if(it.y<c-1&&best[it.x][it.y+1][false]>it.d+a[it.x][it.y]){
            best[it.x][it.y+1][false]=it.d+a[it.x][it.y];
            pq.push({it.d+a[it.x][it.y],it.x,it.y+1,false});
        }
        if(it.y>0&&best[it.x][it.y-1][false]>it.d+a[it.x][it.y-1]){
            best[it.x][it.y-1][false]=it.d+a[it.x][it.y-1];
            pq.push({it.d+a[it.x][it.y-1],it.x,it.y-1,false});
        }
        if(it.x<r-1&&best[it.x+1][it.y][false]>it.d+b[it.x][it.y]){
            best[it.x+1][it.y][false]=it.d+b[it.x][it.y];
            pq.push({it.d+b[it.x][it.y],it.x+1,it.y,false});
        }
        if(!it.jump)
            for(int i=0;i<it.x;i++)
                if(best[i][it.y][true]>it.d+it.x-i+1){
                    best[i][it.y][true]=it.d+it.x-i+1;
                    pq.push({it.d+it.x-i+1,i,it.y,true});
                }
    }
}


#include<bits/stdc++.h>
// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp>
// using namespace __gnu_pbds;
using namespace std;
// typedef tree<pair<int,int>, null_type, less<pair<int,int>>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
#define ll long long
#define scn(n) scanf("%d",&n)
#define lscn(n) scanf("%lld",&n)
#define lpri(n) printf("%lld",n)
#define pri(n) printf("%d",n)
#define pln() printf("\n")
#define priln(n) printf("%d\n",n)
#define lpriln(n) printf("%lld\n",n)
#define rep(i,init,n) for(int i=init;i<n;i++)
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define gcd __gcd
#define inf INT_MAX
#define ninf INT_MIN
#define inf INT_MAX
#define linf LLONG_MAX
#define lninf LLONG_MIN
const ll mod = 1e9 + 7;
const int N = 1e6 + 4;

int solve()
{
	int n, k; scn(n); scn(k);

	if(k == 0)
	{
		int temp = 1;

		while(n--)
		{
			printf("%d %d\n", temp + 1, temp + 2);

			temp += 2;
		}

		return 0;
	}

	if(k < 0 or k >= n - 1)
	{
		pri(-1); return 0;
	}

	k++;

	int l = 1, r = (int)1e8;

	printf("%d %d\n", l, r);

	n--;

	while(k--)
	{
		n--;

		printf("%d %d\n", l + 1, l + 2); l += 2;
	}

	while(n > 0)
	{
		n--;

		printf("%d %d\n", r + 1, r + 2); r += 2;
	}

	return 0;
}

//be careful whether to take the input for testcases or not
int main()
{
	int t = 1; //scn(t);

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

    return 0;
}

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

//const ll MAX = 4e5;
//const int MOD = 3;

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

//int bf[MAX + 1], bg[MAX + 1];

char colorOnTop(char c0, char c1) {
  if (c0 == c1) return c0;
  if (c0 == 'W' && c1 == 'B') return 'R';
  if (c0 == 'W' && c1 == 'R') return 'B';
  if (c0 == 'B' && c1 == 'W') return 'R';
  if (c0 == 'B' && c1 == 'R') return 'W';
  if (c0 == 'R' && c1 == 'W') return 'B';
  if (c0 == 'R' && c1 == 'B') return 'W';
}

char getTopColor(int n, string s) {
  if (n == 1) return s[0];

  int k = 1;
  while (3 * k < n) k *= 3;

  string ns = "";
  for (int i = 0; i + k < n; i++) ns += colorOnTop(s[i], s[i + k]);
  return getTopColor(n - k, ns);
}

int main() {
  fast_io();

  int n;
  string s;
  cin >> n >> s;
  cout << getTopColor(n, s);
}


/* *****fireice**** */

#include<bits/stdc++.h>

#define ll long long int
#define ld long double
#define vi vector<int>
#define vc vector<char>
#define vl vector<ll>
#define vii vector<pair<int,int>>
#define vll vector<pair<ll,ll>>
#define pii pair<int,int>
#define pb push_back
#define eb emplace_back
#define el '\n'
#define N 1000000007
#define M 2147483647
#define MM 1e18;
#define re return
#define F first
#define S second
#define L length
#define deb(x) cout<<#x<<" "<<x<<el;
#define mp make_pair
#define con continue
#define PI 3.14159265
#define all(a) (a).begin(),(a).end()
#define forup(i,n) for(int i=0;i<n;i++)
#define forf(i,x,n) for(int i=x;i<n;i++)
#define ford(i,n) for(int (i)=(n)-1;i>=0;(i)--)
#define take(a,n) forup(i,n) cin>>a[i];
using namespace std;

int gcdExtended(int a, int b, int *x, int *y)
{
    // Base Case
    if (a == 0)
    {
        *x = 0, *y = 1;
        return b;
    }

    int x1, y1; // To store results of recursive call
    int gcd = gcdExtended(b%a, a, &x1, &y1);

    // Update x and y using results of recursive
    // call
    *x = y1 - (b/a) * x1;
    *y = x1;

    return gcd;
}

ll modInverse(int a, int m)
{
    int x, y;
    int g = gcdExtended(a, m, &x, &y);
        // m is added to handle negative x
    ll res = ((ll)x%m + (ll)m) % m;

    return res;
}

ll poww(ll x,ll n)
{
    if(n==0)
        return 1;
    else if(n==1) return x;
    else if(n%2 == 0)        //n is even
        return poww(x*x,n/2);
    else                              //n is odd
        return x*poww(x*x,(n-1)/2);
}

ll modularExponentiation(ll x,ll n,ll Z)
{
    ll result=1;
    while(n>0)
    {
        if(n % 2 ==1)
            result=(result * x)%Z;
        x=(x*x)%Z;
        n=n/2;
    }
    return result;
}

template<typename T>
T maxx(T a,T b)
{
  if(a<b) re b;
  re a;
}
template<typename T, typename... Args>
T maxx(T a,T b, Args... args)
{
    re(maxx(maxx(a,b),args...));
}

template<typename T>
T minn(T a,T b)
{
  if(a<b) re a;
  re b;
}
template<typename T, typename... Args>
T minn(T a,T b, Args... args)
{
    re(minn(minn(a,b),args...));
}

template<typename T>
void read(T& a)
{
  cin>>a;
}
template<typename T, typename... Args>
void read(T& a,Args&... args)
{
  cin>>a; read(args...);
}

template<typename T>
void write(T a)
{
  cout<<a<<' ';
}
template<typename T, typename... Args>
void write(T a,Args... args)
{
  cout<<a<<' '; write(args...);
}

inline ll min(ll a,ll b)
{
  if(a<b) re a;
  else re b;
}
inline ll max(ll a,ll b)
{
  if(a<b) re b;
  else re a;
}

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

    if (a == b)
        return a;

    if (a > b)
        return gcd(a-b, b);
    else return gcd(a, b-a);
}

ll ncr(int n,int r)
{
  ll ans=1;
  r=min(r,n-r);
  forup(i,r)
  {
    ans=((ans*((n-i)%N))%N*modInverse(i+1,N))%N;
  }
  re ans;
}

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

  int t=1;
  //cin>>t;
  while(t--)
  {
    ll n,m,k;
    // cin>>n;
    string s;
    cin>>s;
    string y="ZONe";
    m=0;
    forup(i,s.L()-3)
    {
      if(s.substr(i,4)==y) m++;
    }
    cout<<m<<el;

  }

  return 0;
}

#include <bits/stdc++.h>
#include <math.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
const ll mod = 1000000007;
const ll mod9 = 998244353;
const ll INF = 1001001001;
const ll LINF = 1001001001001001001;

void prvec(vector<ll> vec){
    ll n = vec.size();
    rep(i,n) cout << i << " " << vec.at(i) << "\n";
}

void prvec_won(vector<ll> vec){
    ll n = vec.size();
    rep(i,n) cout << vec.at(i) << " ";
    cout << endl;
}

void pr2d(vector<vector<ll>> vvec){
    ll h = vvec.size();
    ll w = vvec.at(0).size();
    rep(i,h){
        rep(j,w){
            cout << vvec.at(i).at(j) << " ";
        }
        cout << "\n";
    }
}

void deb_mk(ll n){
    cout << "debug " << n << endl;
}

struct SegmentTree {
    int n;
    vector<ll> node;
    //int nとvector<int> nodeの2つを変数に持つ

    //初期化処理
    SegmentTree(vector<ll> v) {
        int sz = v.size(); //szは扱う配列の長さ
        n = 1; while(n < sz) n *= 2; //nはvの配列を入れるために必要なseg treeの葉の数
        node.resize(2*n-1, 0); //segtreeでは全部で2n-1の配列が必要
        for(int i=0; i<sz; i++) node[i+n-1] = v[i]; //segtreeの葉の部分に扱う配列を埋め込む
        for(int i=n-2; i>=0; i--) node[i] = node[2*i+1]^node[2*i+2]; //演算によって変える場所　segtreeを作る(注目しているnode iの子ノードを見て二項演算をして、node iの値を決定する)
    }

    void update(int x, int val) {
        x += (n - 1); //配列のx番目(1-indexed)の要素を更新しようとするとき、segtreeで対応する要素はx+n-1(0-indexed)番目である
        node[x] = val; //segtree上で値を更新
        while(x > 0) { //葉から根に向かってsegtreeの要素を更新していく
            x = (x - 1) / 2;
            node[x] = node[2*x+1]^node[2*x+2]; //演算によって変える
        }
    }

    int getxor(int a, int b, int k=0, int l=0, int r=-1) {
        //求めたいのは区間[a,b)の中で演算しつづけた結果(たとえばこの区間の最小値)
        //自分がいるノードのindex(何階にいるか？)
        //ノードkは元の配列でいうとどの区間をカバーしているか？
        if(r < 0) r = n; //最初に呼び出す時はノードk=0はsegtreeの根なので区間は[0,n)を指す
        if(r <= a || b <= l) return 0; //今のノードが求める区間と無関係の場合は、最終的な答えに影響しない単位元(最小値を求めたい場合は単位元はINF)を返す 演算によって変える
        if(a <= l && r <= b) return node[k]; //今見ている区間[l,r)が答えを求めたい区間[a,b)に完全に含まれるなら、この区間について演算し続けた結果(=node[k];例えば最小値)を返す

        //上記に当てはまらない場合
        //kの子ノードを見に行って、再帰的に処理を行う k=0の場合はノード1と2を見る
        int vl = getxor(a, b, 2*k+1, l, (l+r)/2); //kの子ノード(left)の子孫のうち、求めたい区間に含まれる要素について演算し続けた結果を返す
        int vr = getxor(a, b, 2*k+2, (l+r)/2, r); //kの子ノード(right)の子孫のうち、求めたい区間に含まれる要素について演算し続けた結果を返す
        return vl^vr; //演算によって変える場所 子ノードの子孫のうち、演算しつづけた結果を返す
    }
};

int main(){
    ll nn , q; cin >> nn >> q;
    vector<ll> a(nn);
    rep(i,nn) cin >> a.at(i);
    SegmentTree tree(a);

    rep(i,q){
        ll t,x,y; cin >> t >> x >> y;
        if(t==1){
            tree.update(x-1,(tree.node.at(x-1+ (tree.n) -1))^y);
        }else{
            cout << tree.getxor(x-1,y) << endl;
        }
      	//prvec_won(tree.node);
    }
    return 0;
}


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

typedef long long ll;
typedef pair<int, int> pii;
#define FOR(i, n) for(int (i)=0; (i)<(n); (i)++)
#define FOR1(i, n) for(int (i)=1; (i)<=(n); (i)++)
#define FORI(i, n) for(int (i)=n-1; (i)>=0; (i)--)
template<class T, class U> void umin(T& x, const U& y){ x = min(x, (T)y);}
template<class T, class U> void umax(T& x, const U& y){ x = max(x, (T)y);}
template<class T, class U> void init(vector<T> &v, U x, size_t n) { v=vector<T>(n, (T)x); }
template<class T, class U, typename... W> void init(vector<T> &v, U x, size_t n, W... m) { v=vector<T>(n);  for(auto& a : v) init(a, x, m...); }

int n, m;
int main(int argc, char** argv) {
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); cout << setprecision(15);
    if (argc == 2 && atoi(argv[1]) == 123456789) freopen("d:\\code\\cpp\\contests\\stdin", "r", stdin);

    cin >> n >> m;
    vector<int> a(n+1);
    FOR1(i, n) cin >> a[i];
    vector<vector<int>> edges(n+1);
    FOR(i, m){
        int u, v;
        cin >> u >> v;
        edges[v].push_back(u);
    }

    const ll inf = 1e9+1;
    vector<ll> dp(n+1, inf);
    ll sol = -1e9;
    FOR1(v, n){
        for(int u : edges[v])
            umin(dp[v], dp[u]);
        if (edges[v].size())
            umax(sol, (ll)a[v] - dp[v]);
        umin(dp[v], a[v]);
    }
    cout << sol << endl;

    if (argc == 2 && atoi(argv[1]) == 123456789) cout << clock()*1.0/CLOCKS_PER_SEC << " sec\n";
    return 0;
}

#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <algorithm>
#include <utility>
#include <functional>
#include <set>
#include <map>
#include <queue>
#include <deque>
#include <bitset>
#include <math.h>
#include <random>
#include <chrono>
#include <assert.h>
using namespace std ;
using ll = long long ;
using ld = long double ;
template<class T> using V = vector<T> ;
template<class T> using VV = V<V<T>> ;
using pll = pair<ll,ll> ;
#define all(v) v.begin(),v.end()
ll mod = 1000000007 ;
long double pie = acos(-1) ;
ll INF = 1e18 ;

void yorn(bool a){if(a) cout << "Yes" << endl ; else cout << "No" << endl ;}
//void YorN(bool a){if(a) cout << "YES" << endl ; else cout << "NO" << endl ;}
ll gcd(long long a,long long b){if(b==0) return a ; return gcd(b,a%b) ;}
ll lcm(long long a,long long b){return a/gcd(a,b)*b ;}
ll extGCD(ll a,ll b,ll &x,ll &y){
    if(b==0){
        x = 1 ;
        y = 0 ;
        return a ;
    }
    ll d = extGCD(b,a%b,y,x) ;
    y -= a/b*x ;
    return d ;
}
void fix_cout(){cout << fixed << setprecision(20) ;}
template<class T> void chmax(T &a,T &b){if(a<b) a = b ;}
template<class T> void chmin(T &a,T &b){if(a>b) a = b ;}

int main(){
    int n,m ;
    cin >> n >> m ;
    V<ll> c(n) ;
    for(auto &i:c) cin >> i ;
    VV<int> g(n) ;
    for(int i=0;i<m;i++){
        int a,b ;
        cin >> a >> b ;
        g[a-1].push_back(b-1) ;
    }
    V<ll> dp(n,INF) ;
    ll ans = -INF ;
    for(int i=0;i<n;i++){
        ans = max(ans,c[i]-dp[i]) ;
        c[i] = min(c[i],dp[i]) ;
        for(int j=0;j<g[i].size();j++){
            dp[g[i][j]] = min(dp[g[i][j]],c[i]) ;
        }
    }
    // for(auto i:dp) cout << i << " " ; cout << endl ;
    cout << ans << endl ;
}


#include <iostream>
#include <algorithm>
#include <string>

using namespace std;

constexpr int Z = 1e9+7;

void add(int cnt[], int &ccnt, int x) {
    cnt[x]++;
    if (cnt[x] == 1) {
        ccnt++;
    }
}

void sub(int cnt[], int &ccnt, int x) {
    cnt[x]--;
    if (cnt[x] == 0) {
        ccnt--;
    }
}

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

    string t;
    cin >> t;
    int k;
    cin >> k;

    int n = t.length();
    int a[n];
    for (int i = 0; i < n; i++) {
        a[i] = t[i] <= '9' ? t[i] - '0' : t[i] - 'A' + 10;
    }

    int dp[n][k+1];
    fill(dp[0], dp[n], 0);
    dp[0][0] = 1;
    for (int i = 1; i < n; i++) {
        for (int j = 0; j <= k; j++) {
            dp[i][j] = (1ll * dp[i-1][j] * (k - j) + 1ll * (j == 0 ? 0 : dp[i-1][j-1]) * (16 - k + j)) % Z;
        }
    }

    int ans = 0;
    for (int i = 1; i < n; i++) {
        ans = (0ll + ans + dp[i][k] - dp[i-1][k-1] + Z) % Z;
    }

    int cnt[16];
    fill(cnt, cnt + 16, 0);
    int ccnt = 0;
    for (int i = 0; i < n; i++) {
        for (int j = (i == 0 ? 1 : 0); j < a[i]; j++) {
            add(cnt, ccnt, j);
            if (ccnt <= k) {
                (ans += dp[n-1-i][k-ccnt]) %= Z;
            }
            sub(cnt, ccnt, j);
        }
        add(cnt, ccnt, a[i]);
    }

    (ans += (ccnt == k)) %= Z;

    cout << ans << endl;

    return 0;
}


#include <bits/stdc++.h>
#define IO_OP std::ios::sync_with_stdio(0); std::cin.tie(0);
#define F first
#define S second
#define V vector
#define PB push_back
#define MP make_pair
#define EB emplace_back
#define ALL(v) (v).begin(), (v).end()
#define debug(x) cerr << "Line(" << __LINE__ << ") -> " << #x << " is " << x << endl

using namespace std;

typedef long long ll;
typedef pair<int, int> pi;
typedef V<int> vi;

const int INF = 1e9 + 7, N = 102;

double x[N], y[N], n;

double dist(int i, int j) {
	return hypot(x[i] - x[j], y[i] - y[j]);
}

bool ok(double m) {
	vi p(n + 2);
	int s = n, t = n + 1;
	iota(ALL(p), 0);
	function<int(int)> find = [&](int u) {
		return p[u] == u ? u : p[u] = find(p[u]);
	};
	auto unite = [&](int x, int y) {
		int rx = find(x), ry = find(y);
		p[rx] = ry;
	};
	for(int i = 0; i < n; i++) {
		for(int j = 0; j < i; j++) {
			if(dist(i, j) <= m)
				unite(i, j);
		}
	}
	for(int i = 0; i < n; i++) {
		if(100 - y[i] <= m)
			unite(s, i);
		if(100 + y[i] <= m)
			unite(t, i);
	}
	return find(s) != find(t);
}

signed main()
{
	IO_OP;

	cin >> n;
	for(int i = 0; i < n; i++) cin >> x[i] >> y[i];

	double lb = 0, rb = 300;
	for(int i = 0; i < 100; i++) {
		double mb = (lb + rb) / 2;
		if(ok(mb)) lb = mb;
		else rb = mb;
	}
	cout << fixed << setprecision(10) << lb / 2 << endl;

}

#include<bits/stdc++.h>
using namespace std;
#define ll long long
int main()
{
    int n,m;
  	int vdnsddk;
    cin>>n>>m;
    vector<pair<int,int>>a(m);
    for(int i=0;i<m;i++)
    {
        cin>>a[i].first>>a[i].second;
    }
    int k;
    cin>>k;
    vector<pair<int,int>>b(k);
    for(int j=0;j<k;j++)
    {
        cin>>b[j].first>>b[j].second;
    }
    ll l=0;
    ll tot=1<<k;
    for(ll mask=0;mask<tot;mask++)
    {
        vector<int>v(n+1);
        ll ans=0;
        for(int i=0;i<k;i++)
        {
            if(mask & (1<<i))
                v[b[i].second]=1;
            else
                v[b[i].first]=1;
        }
        for(int i=0;i<m;i++)
        {
            if(v[a[i].first] && v[a[i].second])
                ans++;
        }
        l=max(l,ans);
    }
    cout<<l<<endl;
    return 0;
}


#include<algorithm>
#include<iostream>
#include<cstdio>
#define int long long
int t;
std::string st,goal="atcoder";
bool can(int len){
	for(int i=0;i<st.length()-len;i++){
		std::swap(st[i],st[len+i]);
		if(st>goal)return true;
		std::swap(st[i],st[len+i]);
	}
	return false;
}
signed main(){
	scanf("%lld",&t);
	for(int wc=1;wc<=t;wc++){
		std::cin>>st;
		if(st>goal){
			puts("0");
			continue;
		}
		bool flag=false;
		for(int i=1;i<=st.length()-1;i++)if(can(i)){
			printf("%lld\n",i);
			flag=true;
			break;
		}
		if(!flag)puts("-1");
	}
	return 0;
}

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

#define ll long long
#define mp make_pair
#define pb push_back

#define eprintf(...) fprintf(stderr, __VA_ARGS__)
#define rep(i, n) for (int i = 0; i < (int)(n); ++ i)

int main() {
	auto solve = [&] () {
		static char s[1005];
		scanf("%s", s);
		int n = strlen(s);
		const char *t = "atcoder";
		int m = strlen(t);
		int ans = 0x3f3f3f3f, cur = 0;
		bool full = 1;
		rep(i, min(n, m)) {
			int mneq = n, mngeq = n;
			for (int j = i; j < n; ++ j) {
				if (s[j] == t[i]) mneq = min(mneq, j);
				if (s[j] > t[i]) mngeq = min(mngeq, j);
			}
			if (mngeq < n) ans = min(ans, cur + mngeq - i);
			if (mneq < n) cur += mneq - i;
			else { full = 0; break; }
		}
		if (full && n > m) ans = min(ans, cur);
		if (ans >= 1e9) printf("-1\n");
		else printf("%d\n", ans);
	};
	int T; scanf("%d", &T);
	while (T --) solve();
	return 0;
}


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

const int mod = 1e9 + 7;
class mint
{
public:
    long long x;
    mint(long long x = 0) :x((x% mod + mod) % mod) {}
    mint operator -() const { return mint(-x); }
    mint& operator +=(const mint a)
    {
        if ((x += a.x) >= mod) x -= mod;
        return *this;
    }
    mint& operator -=(const mint a)
    {
        if ((x += -a.x + mod) >= mod) x -= mod;
        return *this;
    }
    mint& operator *=(const mint a)
    {
        (x *= a.x) %= mod;
        return *this;
    }
    mint operator+(const mint a)
    {
        mint res(*this);
        return res += a;
    }
    mint operator-(const mint a)
    {
        mint res(*this);
        return res -= a;
    }
    mint operator*(const mint a)
    {
        mint res(*this);
        return res *= a;
    }
    mint pow(long long t) const
    {
        if (!t) return 1;
        mint a = pow(t >> 1);
        a *= a;
        if (t & 1) a *= *this;
        return a;
    }
    //for only prime number
    //Fermat's little theorem
    mint inv() const
    {
        return pow(mod - 2);
    }
    mint& operator/=(const mint a)
    {
        return (*this) *= a.inv();
    }
    mint operator/(const mint a)
    {
        mint res(*this);
        return res /= a;
    }
};

struct Matrix
{
    int s;
    mint A[100][100];
};
Matrix cal_matrix(Matrix X, Matrix Y)
{
    int s = X.s;
    Matrix Z = {s};
    rep(i,s)rep(j,s) Z.A[i][j] = 0;
    //xとyのサイズが同じとする
    rep(i,s)rep(j,s)rep(k,s)
    {
        Z.A[i][j] += X.A[i][k]*Y.A[k][j];
    }
    return Z;
}

Matrix matrix_pow(Matrix X,ll n)
{
    Matrix table[64];
    Matrix An = X;

    //A^(2n)を計算
    for(int i = 0;i<64;++i)
    {
        table[i] = An;
        An = cal_matrix(An,An);
    }
    //基本行列
    Matrix I = {X.s};
    rep(i,X.s)rep(j,X.s)
    {
        if(i==j) I.A[i][j] = 1;
        else I.A[i][j] = 0;
    }
    if(n == 0) return I;
    //繰り返し2乗法
    for(int i = 0;i < 64;++i)
    {
        if(n & (1LL<<i)) I = cal_matrix(I,table[i]);
    }

    return I;
}
//繰り返し２乗法
mint pow_mod(mint x,int n)
{
    if(n == 0) return 1;
    mint table[64];
    mint t = x;
    for(int i=0;i<60;++i)
    {
        table[i] = x;
        x = x*x;
    }
    mint res = 1;
    for(int i = 0;i < 64;++i)
    {
        if(n & (1LL<<i)) res *= table[i];
    }
    return res;
}
bool g[100][100];

int main()
{
    int n,m,k;
    cin>> n >> m >> k;
    vector<int> A(n);
    rep(i,n) cin >> A[i];
    //頂点の次数
    vector<int> D(n);
    rep(i,m)
    {
        int a,b;cin >> a >> b;
        --a,--b;
        g[a][b] = true;
        g[b][a] = true;
        ++D[a],++D[b];
    }
    Matrix F;
    F.s = n;
    //行列の作成
    //分子だけ計算する
    rep(i,n)rep(j,n)
    {
        if(i==j)
        {
            F.A[i][j] = 2*(m-D[i])+D[i];
        }
        else
        {
            if(g[i][j])
            {
                F.A[i][j] = 1;
            }
            else
            {
                F.A[i][j] = 0;
            }
        }
    }
    //繰り返し2情報で行列累乗
    F = matrix_pow(F,k);
    //分母の計算
    mint x = 2*m;
    x = pow_mod(x,k);
    //累乗した行列に対して計算する
    mint Y[100];
    rep(i,n)
    {
        rep(j,n)
        {
            Y[i] += F.A[i][j]*A[j];
        }
    }

    rep(i,n)
    {
        cout << (x.inv()*Y[i]).x << endl;
    }
    return 0;
}

#include<bits/stdc++.h>
#define int long long
#define N 100
#define P 1000000007
#define inf 999999999999999999
using namespace std;
int n,m,K,d[N+1],dq[N+1],g[N+1][N+1],ny2,ans[N+1],p,q;
int ksm(int x,int y){int nans=1;for(;y;y>>=1,x=x*x%P)if(y&1)nans=nans*x%P;return nans;}
int qny(int x){return ksm(x,P-2);}
struct mat{
	int a[N+1][N+1];
	const mat operator *(mat y)const{
		mat nans;
		for(int i=1;i<=n;i++){
			for(int j=1;j<=n;j++){
				nans.a[i][j]=0;
				for(int k=1;k<=n;k++)nans.a[i][j]+=this->a[i][k]*y.a[k][j],nans.a[i][j]%=P;
			}
		}return nans;
	}
}I,A;
void ycl(){
	ny2=qny(2);
	for(int i=1;i<=n;i++)I.a[i][i]=1;
	for(int i=1;i<=n;i++){
		A.a[i][i]=ny2+(m-d[i])*qny(2*m%P)%P;
		for(int j=1;j<=n;j++){
			if(g[i][j])A.a[i][j]=qny(2*m%P);
		}
	}
}
mat ksm(mat x,int y){mat nans=I;for(;y;y>>=1,x=x*x)if(y&1)nans=nans*x;return nans;}
signed main(){
	cin>>n>>m>>K;
	for(int i=1;i<=n;i++)cin>>dq[i];
	for(int i=1;i<=m;i++)cin>>p>>q,g[p][q]=g[q][p]=1,d[p]++,d[q]++;
	ycl();
	A=ksm(A,K);
	for(int i=1;i<=n;i++)for(int j=1;j<=n;j++)ans[i]+=dq[j]*A.a[i][j],ans[i]%=P;
	for(int i=1;i<=n;i++)printf("%lld\n",ans[i]);
	return 0;
}


#pragma GCC optimize ("Ofast")
#include<bits/stdc++.h>
#define int long long
using namespace std;
inline int read()
{
	bool flag=1;
	int x=0;
	char c=getchar();
	while(c<'0'||c>'9')
	{
		if(c=='-')
			flag=0;
		c=getchar();
	}
	while(c>='0'&&c<='9')
	{
		x=(x<<1)+(x<<3)+c-'0';
		c=getchar();
	}
	return (flag?x:~(x-1));
}
set<int> s;
int n,a,ans=1;
const int mod=1e9+7;
signed main()
{
	n=read();
	while(n--)
		s.insert(read());
	s.insert(0);
	for(auto a=++s.begin(),b=s.begin();a!=s.end();a++,b++)
	{
		(ans*=(1+*a-*b))%=mod;
	}
	cout<<ans;
	return 0;
}

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

using ll = long long;

#define fi first
#define se second

const int N = 2e5 + 5;
const int INF = 2e9;
const ll LINF = 9e18;

const int MOD = 1e9 + 7;

int n;
int a[N], dp[N];

int add(int x, int y) { return (x + 0ll + y) % MOD; }
int mul(int x, int y) { return x * 1ll * y % MOD; }

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

  cin >> n;
  for(int i = 1; i <= n; i++) {
    cin >> a[i];
  }
  sort(a + 1, a + n + 1);

  int ans = 1;
  for(int i = 1; i <= n; i++) {
    ans = mul(ans, a[i] - a[i - 1] + 1);
  }

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


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

int main() {
  int n;
  cin >> n;
  if(n%2==0) cout << "White" << endl;
  else cout << "Black" << endl;
}

#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
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   sz(s)         s.size()
#define   ll            long long int
#define   ull           unsigned ll
#define   ld            long double
#define   print(v)      for(ll i=0;i<v.size();i++)cout<<v[i]<<" "
#define   printpair(v)  for(ll i=0;i<v.size();i++)cout<<v[i].first<<" "<<v[i].second<<"\n"
#define   bmd           1000000007
#define   bmd1          998244353
#define   umll          unordered_map<ll,ll>
#define   mll           map<ll,ll>
#define   mcl           map<char,ll>
#define   pll           pair<ll,ll>
#define   F             first
#define   S             second
#define   setp(x)       setprecision(x)
#define   pb            push_back
#define   all(v)        v.begin(),v.end()
#define   tr(a)         for(auto it=a.begin();it!=a.end();it++)
#define   trr(a)        for(auto it1=a.begin();it1!=a.end();it1++)
#define   vll           vector<long long int>
#define   sorty(v)      sort(v.begin(),v.end())
#define   rsort(v)      sort(v.rbegin(),v.rend())
#define   unik(v)       v.erase(unique(all(v)),v.end())
#define   PI            3.1415926535897932384626
#define   db()          cout<<"\n"<<"here"<<"\n"
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;

//---------------------------------------------------------------------------
const int MOD = 1e9+7;
const int N=2e5+100;
inline  ll sqr(ll x){return x*x;}
inline  void normal(ll &a) { a = (a+MOD)%MOD; }
inline  ll modMul(ll a, ll b) { a %= MOD, b %= MOD; normal(a), normal(b); return (a*b)%MOD; }
inline  ll modAdd(ll a, ll b) { a %= MOD, b %= MOD; normal(a), normal(b); return (a+b)%MOD; }
inline  ll modSub(ll a, ll b) { a %= MOD, b %= MOD; normal(a), normal(b); a -= b; normal(a); return a; }
inline  ll modPow(ll b, ll p) { ll r = 1;b=b%MOD; while(p) { if(p&1) r = modMul(r, b); b = modMul(b, b); p >>= 1; } return r; }
inline  ll modInv(ll a) { return modPow(a, MOD-2); }
inline  ll modDiv(ll a,ll b) { return modMul(a, modInv(b)); }
//---------------------------------------------------------------------------
void solve()
{
    ll n;
    cin >> n;
    if(n%2)
        cout << "Black";
    else cout << "White";
}
int main()
{
	#ifndef ONLINE_JUDGE
	freopen("input.txt", "r" , stdin);
    freopen("output.txt", "w" , stdout);
    #endif
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    ll t=1;
    // cin>>t;
    while(t--){
        solve();
    }

    return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define dd double
#define ll long long int
#define light ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
int main()
{
	#ifndef ONLINE_JUDGE
	freopen("input1.txt","r",stdin);
	freopen("output1.txt","w",stdout);
	#endif

	light;
	dd x1,y1,x2,y2;
	cin>>x1>>y1>>x2>>y2;
	cout<<setprecision(15)<<x1+((x2-x1)*y1)/(y2+y1)<<"\n";
}

// Problem: D - Opposite
// Contest: AtCoder - AtCoder Beginner Contest 197（Sponsored by Panasonic）
// URL: https://atcoder.jp/contests/abc197/tasks/abc197_d
// Memory Limit: 1024 MB
// Time Limit: 2000 ms
//
// Powered by CP Editor (https://cpeditor.org)

#include<bits/stdc++.h>
using namespace std;
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);
#define int long long
#define ld long double
#define inf 1000000000
#define pii pair<int,int>
#define fi first
#define se second
#define pb push_back
#define mod 1000000007
#define mod2 998244353
#define all(x) (x).begin(), (x).end()
#define rep(i,x,y) for(int i=x; i<y; i++)
#define fill(a,b) memset(a, b, sizeof(a))
#define vi vector<int>
#define setbits(x) __builtin_popcountll(x)
#define w(x)  int x; cin>>x; while(x--)
#define in(a) for(auto &x: a)cin>>x;
void print(bool n){if(n)cout<<"YES";else cout<<"NO";}
#define pi 3.14159
signed main(){
	ld n,a,b,c,d;
	cin>>n;
	cin>>a>>b>>c>>d;
	ld mx=(a+c)/2.0;
	ld my=(b+d)/2.0;
	a-=mx;
	b-=my;
	ld aa=a*cos(pi/(n/2))-b*sin(pi/(n/2));
	ld bb=a*sin(pi/(n/2))+b*cos(pi/(n/2));
	//cout<<mx<<' '<<my<<'\n';
	cout<<fixed<<setprecision(6)<<aa+mx<<' '<<bb+my;
}


#include <bits/stdc++.h>
using namespace std;
#define rep(a,b,c) for(int a=b;a<=c;a++)
#define per(a,b,c) for(int a=b;a>=c;a--)
#define pii pair<int,int>
#define mp make_pair
#define fi first
#define se second
const int N=1e3+5;
const int inf=0x3f3f3f3f;
template<class T>inline void read(T &x) {
	T f=1;x=0;char s=getchar();
	while(s<'0'||s>'9'){if(s=='-')f=-1;s=getchar();}
	while(s>='0'&&s<='9'){x=x*10+s-'0';s=getchar();}
	x*=f;
}
vector<int> to[26][N];
int e[N][N];
int dis[N][N],n,m,a,b,ad,cnt[N];
char s[5];
queue<pii> q;
pii tp;
int main() {
	read(n); read(m);
	rep(i,1,m) {
		read(a); read(b);
		scanf("%s",s+1);
		ad=s[1]-'a';
		e[a][b]=1; e[b][a]=1;
		to[ad][a].emplace_back(b);
		to[ad][b].emplace_back(a);
	}
	memset(dis,0x3f,sizeof(dis));
	dis[1][n]=0;
	q.push(mp(1,n));
	int Ans=inf;
	while(!q.empty()) {
		tp=q.front(); q.pop();
		rep(i,0,25) {
			for(int v1:to[i][tp.fi]) for(int v2:to[i][tp.se]) {
				if(dis[v1][v2]>(dis[tp.fi][tp.se]+2)) {
					dis[v1][v2]=dis[tp.fi][tp.se]+2;
					q.push(mp(v1,v2));
				}
			}
		}
	}
	rep(i,1,n) Ans=std::min(Ans,dis[i][i]);
	rep(i,1,n) rep(j,1,n) if(e[i][j]) Ans=std::min(Ans,dis[i][j]+1);
	if(Ans==inf) puts("-1");
	else printf("%d\n",Ans);
}

#include <bits/stdc++.h>
using namespace std;
#define int long long
#define ld long double
#define pb push_back
#define mp make_pair
#define f first
#define s second
#define all(x) x.begin(),x.end()
#define LOL cout << '\n';
#define kill(x) {cout << (x) << '\n'; return;}
#define sz(x) ((int)x.size())
#define INF LONG_LONG_MAX
#define NINF LONG_LONG_MIN
#define deb(x) cout << "[" << (#x) << "=" << x << "]" << '\n'
#define deb2(x,y) cout << "[" << (#x) << "=" << x << "] [" << (#y) << "=" << y << "]" << '\n'
#define deb3(x,y,z) cout << "[" << (#x) << "=" << x << "] [" << (#y) << "=" << y << "] [" << (#z) << "=" << z << "]" << '\n'

void solve(){
  int a,b,c,d; cin>>a>>b>>c>>d;
  int x=max(a,b),y=min(c,d);
  kill(x-y);
}

signed main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0); cout.tie(0);
  int _ = 1; // cin >> _;
  for(int i = 1 ; i <= _ ; i++){
    // cout << "\nCase #" << i << ": \n";
    solve();
  }
  return 0;
}

// 1.77245


#include <bits/stdc++.h>
using namespace std;
int main() {
  int N, A, B;
  cin >> N >> A >> B;

  cout << N - A + B;
}

#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;++i)
#define rrep(i,n) for(int i=n-1;i>=0;--i)
#define yesno(flg) if(flg){cout<<"YES"<<endl;}else{cout<<"NO"<<endl;}
#define MAX_N 100001
#define i197 1000000007

using namespace std;
typedef long long ll;
typedef pair<ll,ll> P1;
typedef pair<int,int> Pi;
typedef pair<double,Pi> Pdi;
typedef pair<ll,int>Pli;
typedef pair<int,ll>Pil;
typedef pair<P1,ll> P2;
typedef pair<string,string> Ps;
const ll INF=1000000000000000001;
struct edge{int to,cost;};
int dy[]={0, 0, 1, -1};
int dx[]={1, -1, 0, 0};
struct Road{double cost;int a,b;};
struct pos{
	// 1 変数を入れる;
	int a;
};

int main(){

	int n,a,b;
	cin>>n>>a>>b;
	cout<<n-a+b<<endl;

	return 0;
}


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

int T ;

int main(){
  cin >> T ;
  vector<ll> val ;
  for(int i = 0 ; i < T ; i++){
    ll R , L ;
    cin >> L >> R ;
    ll tmp = 2 * L ;
    if(R < tmp){
      val.push_back(0) ;
      continue ;
    }
    ll res = R - tmp + 1 ;
    ll ans = res * (res + 1) / 2 ;
    val.push_back(ans) ;
  }
  for(ll u : val) cout << u << endl ;
}

// Jai Shree Ram
#include<bits/stdc++.h>
typedef long long int ll;
#define pb push_back
#define max2(a,b) (a>b)?a:b
#define mi2(a,b) (a<=b)?a:b
#define fori(i,n) for(ll i=0;i<(ll)n;i++)
#define ford(i,n) for(ll i=n;i>=0;i--)
#define pll pair<ll,ll>
#define MOD 998244353
#define ff first
#define ss second
using namespace std;
#define MAX_LIMIT 1000001

// ll power(ll n, ll pow)
// {
//     n %= MOD;
//     long long int res = 1;
//     while (pow)
//     {
//         if (pow % 2)
//         {
//             res = ((res % MOD) * (n % MOD)) % MOD;
//         }
//         pow /= 2;
//         n = ((n % MOD) * (n % MOD)) % MOD;
//     }
//     res %= MOD;
//     return res;
// }

void solve()
{

	ll l,r;
	cin>>l>>r;
	ll ptr1=l,ptr2=r;

	ll n=(r-2*l)+1;
	if(r-l<l)
	{
		cout<<0<<"\n";
		return;
	}
	ll cn=(n*(n+1))/2;
	// while(true)
	// {
	// 	if(ptr2-ptr1>=ptr1)
	// 	{
	// 		cn+=(ptr2-2*ptr1+1);
	// 		ptr2--;
	// 	}
	// 	else
	// 	{
	// 		break;
	// 	}
	// }
	cout<<cn<<"\n";

}

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

    ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);

    ll T;
    T=1;
    cin>>T;
    //sievefun(1000004);
    fori(_,T)
    {
        solve();
    }

}


#include <cstdio>
#include <cstring>

using namespace std;

#define rei register int
#define rep(i, l, r) for(rei i = l, i##end = r; i <= i##end; ++i)
#define per(i, r, l) for(rei i = r, i##end = l; i >= i##end; --i)
inline void chmax(int &x, const int y) { if(x < y) x = y; }
const int N = 105;
inline int read() {
	int res = 0; char ch = getchar(); bool f = true;
	for(; ch < '0' || ch > '9'; ch = getchar())
		if(ch == '-') f = false;
	for(; ch >= '0' && ch <= '9'; ch = getchar())
		res = res * 10 + (ch ^ 48);
	return f ? res : -res;
}
int n, m, ans, sum, k, a[N], b[N], c[N][2];
bool buc[N];

signed main() {
	n = read(); m = read();
	rep(i, 1, m) a[i] = read(), b[i] = read();
	k = read();
	rep(i, 1, k) c[i][0] = read(), c[i][1] = read();
	rep(s, 0, (1 << k) - 1) {
		sum = 0;
		memset(buc, 0, sizeof(buc));
		rep(i, 1, k) buc[c[i][(s >> i - 1) & 1]] = 1;
		rep(i, 1, m) if(buc[a[i]] && buc[b[i]]) sum ++;
		chmax(ans, sum);
	}
	printf("%d\n", ans);
	return 0;
}

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

#define pb          push_back
#define vi          vector<int>
#define all(a)      (a).begin(),(a).end()
#define F           first
#define S           second
#define endl        "\n"
#define fast        ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define int         long long int
#define mod         1000000007
#define MAXN        1000005

typedef tree<int, null_type,
     less_equal<int>, rb_tree_tag,
          tree_order_statistics_node_update>
    Ordered_set;
// s.find_by_order(idx) find using index..!
// s.order_of_key(val) Gives iterator to the key..!

/* First solve then try Writing Code.. And be cool ^_^ and calm. */

int n, q, a[MAXN], BIT[MAXN];

void update(int idx, int val)
{
    while(idx <= n)
    {
        BIT[idx] ^= val;
        idx += (idx&(-idx));
    }
}

int getAns(int idx)
{
    int ans = 0;
    while(idx > 0)
    {
        ans ^= BIT[idx];
        idx -= (idx & (-idx));
    }
    return ans;
}

void solve(){

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

    for(int i=1;i<=n;i++)
    {
        update(i, a[i]);
    }

    while(q--)
    {
        int ch;cin>>ch;
        if(ch == 1)
        {
            int l,r;cin>>l>>r;
            update(l, r);
        }
        else
        {
            int l, r; cin>>l>>r;
            cout<<(getAns(r)^getAns(l-1))<<endl;
        }
    }
}

// 12 - 12 + 11 c
int32_t main()
{
    fast;
    int t=1;
    // cin>>t;
    while(t--) solve();

    return 0;
}


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

long long L = 10000000000;

int main(){
  long long N;
  string T;
  cin >> N >> T;

  if(N==1){
    if(T=="0") cout << L << endl;
    else cout << L*2 << endl;
  }
  else if(N==2){
    if(T=="00") cout << 0 << endl;
    else if(T=="01") cout << L-1 << endl;
    else cout << L << endl;
  }
  else{
    int s=-1;
    if(T[0]=='0') s = 0;
    else if(T[1]=='0') s = 1;
    else if(T[2]=='0') s = 2;
    else{
      cout << 0 << endl;
      return 0;
    }

    long long count=0;
    for(int i=s+1;i<N;i++){
      if(T[i]=='0') count++;
      if((i-s)%3==0 && T[i]!='0'){
        cout << 0 << endl;
        return 0;
      }
      if((i-s)%3!=0 && T[i]!='1'){
        cout << 0 << endl;
        return 0;
      }
    }

    long long ans = L - count;
    if(T[N-1]=='1') ans--;

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

#include<iostream>
#include<algorithm>
#include<map>
#include<cstdio>
#include<cstring>
#include<cmath>
#define ll long long
#define lson (rt<< 1)
#define rson (rt<< 1 | 1)
#define gmid ((l+r)>> 1 )
using namespace std;

const int maxn=20000050;

string s;

char a[4];
int main()
{
	ll k=10000000000;
	int n;
	cin>>n;
	a[0]='1';a[1]='1';a[2]='0';
	cin>>s;
	//cout<<s[0]<<endl;
	int f=-1;
	for(int i=0;i<=2;++i)
	  {
	  	  f=i;
	  	  for(int j=0;j<n;++j)
	  	    if(s[j]!=a[(i+j)%3])
	  	      {
	  	      	  f=-1;
	  	      	 // cout<<j<<" "<<(i+j)%3<<endl;
	  	      	  //cout<<s[j]<<"  "<<a[(i+j)%3]<<endl;
	  	      	  break;
	  	      }
	  	  //cout<<endl;
	  	  if(f>=0) break;
	  }
	//cout<<f<<endl;
	if(f==-1) cout<<0<<endl;
	  else
	  if(n==1)
	  {
	  	  if(s[0]=='1') cout<<k*2<<endl;
	  	  else cout<<k<<endl;
	  }
	  else if(n==2)
	  {
	  	  if(s[0]=='1')
	  	  {
	  	  	  cout<<k<<endl;
	  	  }
	  	  else
	  	  {
	  	  	  if(s[1]=='1')
	  	  	    cout<<k-1<<endl;
	  	  }
	  }
	  else
	    {
	    	n=n-(3-f);
	    	ll t=n/3;
			ll l=0;
			if(n%3>0)  t++;
			if(n>0) cout<<k-t<<endl;
			  else cout<<k<<endl;
	    }
}


/*	_____________________
	|Author : canhnam357|
	|___________________|
*/
#include <bits/stdc++.h>
#include <unordered_map>
#include <unordered_set>
using namespace std;
typedef unsigned long long ull;
typedef long long ll;
typedef long double ld;
typedef vector <int> vi;
typedef vector <ll> vll;
typedef vector <string> vs;
typedef vector <vector <int>> vvi;
typedef vector <vll> vvll;
typedef map<int, int> mi;
typedef map<string, int> ms;
typedef map<char, int> mc;
typedef map <int, bool> mb;
typedef map<ll, ll> mll;
typedef unordered_map<int, int> umi;
typedef unordered_map<string, int> ums;
typedef unordered_map<char, int> umc;
typedef unordered_map <int, bool> umb;
typedef unordered_map<ll, ll> umll;
typedef vector <ld> vld;
typedef vector <bool> vb;
typedef pair <int, int> pii;
typedef pair<ll, ll> pll;
typedef vector <pii> vpii;
typedef vector <pll> vpll;
int CASE = 1;
const int mxn = 4e3 + 1;
const ll INF = 1e10;
#define FOR(i,N) for(ll i = 0 ; i < N;i++)
#define eFOR(i,a,b) for(ll i = a; i <=b;i++)
#define dFOR(i,N) for(ll i = N - 1; i>=0;i--)
#define edFOR(i,b,a) for(ll i = b ; i >=a;i--)
#define all(x) x.begin(),x.end()
#define SORT(x) sort(all(x))
#define RSORT(x) sort(x.rbegin(),x.rend())
#define UNQ(x)  unique(all(x))
#define mine(x) min_element(all(x))
#define maxe(x) max_element(all(x))
#define lb(v, x) lower_bound(all(v) , x)
#define ub(v , x) upper_bound(all(v) , x)
#define pb push_back
#define PI 3.141592653589793
#define FIX cout << fixed << setprecision(15)
#define g(i , a) get<i>(a)
const ll mod = 2e5;
bool prime(ll n)
{
	if (n <= 1)
		return false;
	eFOR(i, 2, sqrt(n))
		if (!(n % i))
			return false;
	return true;
}
ll __gcd(ll a, ll b)
{
	return !b ? a : __gcd(b, a % b);
}
void solve()
{
	int n;
	string t;
	cin >> n >> t;
	string s = "";
	if (t.length() == 1)
	{
		if (t == "1")
			cout << 2LL * INF;
		else
			cout << INF;
		return;
	}
	while (s.length() < mod)
		s += "110";
	if (s.find(t) == -1)
	{
		cout << 0;
		return;
	}
	bool ok = true;
	int cnt = 0;
	for (char c : t)
	{
		if (ok)
		{
			ok = false;
			cnt++;
		}
		if (c == '0')
			ok = true;
	}
	cout << INF - cnt + 1;
}
int main()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	int T = 1;
	while (T--)
	{
		solve();
	}
	return 0;
}

#include<bits/stdc++.h>
using namespace std;
#define me(a,x) memset(a,x,sizeof(a))
#define sc scanf
#define pr printf
#define IN freopen("in",stdin);
#define OUT freopen("out","w",stdout);
typedef long long ll;
typedef unsigned long long ull;
const int N=1e7+6;
const int mod=1e9+7;
int O(){putchar('\n');return 0;}template<typename T,typename... Ty>
int O(const T& a,const Ty&... b){cout<<a<<' ';return O(b...);}
void I(){}template<typename T,typename... Ty>void I(T& a,Ty&... b){cin>>a;I(b...);}
template<typename T>void db(T *bg,T *ed){while(bg!=ed)cout<<*bg++<<' ';pr("\n");}
inline ll mul_64(ll x,ll y,ll c){return (x*y-(ll)((long double)x/c*y)*c+c)%c;}
inline ll ksm(ll a,ll b,ll c){ll ans=1;for(;b;b>>=1,a=a*a%c)if(b&1)ans=ans*a%c;return ans;}
int n;
string s;
//110
//101
//011
string p[]={"110","101","011"};
ll m=1e10;
int check(string x){
    for(int i=0;i<3;i++){
        if(p[i]==x){
            return i;
        }
    }
    return -1;
}
bool istrue(int pos){
    int n=s.size();
    for(int i=0;i<n;i+=3){
        if(n-i<3){
            if(p[pos].substr(0,n-i)!=s.substr(i,n-i))return false;
            return true;
        }
        if(p[pos]!=s.substr(i,3))return false;
    }
    return true;
}
int main(){
    I(n,s);
    if(n==1){
        if(s[0]=='0')return O(m);
        else return O(m*2);
    }
    if(n==2){
        if(s=="00")return O(0);
        if(s=="11"||s=="10")return O(m);
        return O(m-1);
    }
    int pos=check(s.substr(0,3));
    if(pos==-1)return O(0);
    bool f=istrue(pos);
    if(!f)return O(0);
    ll ans=m*3-n-pos;
    ll k=ans/3;
    while(3LL*k+n+pos<=m*3)k++;
    O(k);
}


#pragma GCC optimize("O3")
#include<bits/stdc++.h>
using namespace std;
using ll=long long;
using P=pair<ll,ll>;
template<class T> using V=vector<T>;
#define fi first
#define se second
#define all(v) (v).begin(),(v).end()
const ll inf=(1e18);
//const ll mod=998244353;
const ll mod=1000000007;
ll GCD(ll a,ll b) {return b ? GCD(b,a%b):a;}
ll LCM(ll c,ll d){return c/GCD(c,d)*d;}
struct __INIT{__INIT(){cin.tie(0);ios::sync_with_stdio(false);cout<<fixed<<setprecision(15);}} __init;
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; }
template<class T>void debag(const vector<T> &a){cerr<<"debag :";for(auto v:a)cerr<<v<<" ";cerr<<"\n";}
template<class T>void print(const vector<T> &a){for(auto v:a)cout<<v<<" ";cout<<"\n";}
//#include <unistd.h>
void solve(){
        int n;
        cin>>n;
        V<int> a(n);
        for(int i=0;i<n;i++){
                cin>>a[i];
                a[i]--;
        }
        int t=0;
        V<int> ans;
        V<bool> ok(n,false);
        while(1){
              bool ok=true;
                for(int j=0;j<n;j++){
                        if(a[j]<j){
                              ok=false;
                               if(j%2==t){
                                      if(t==0){
                                             swap(a[0],a[1]);
                                             ans.emplace_back(1);
                                      }else{
                                            swap(a[1],a[2]);
                                            ans.emplace_back(2);
                                      }
                                      t^=1;
                               }
                               while(a[j]<j){
                                       swap(a[j-1],a[j]);
                                       ans.emplace_back(j);
                                       j--;
                                       t^=1;
                               }
                               break;
                        }
                }
                if(ok)break;
        }
      //  print(a);
        cout<<ans.size()<<"\n";
        print(ans);
}
int main(){
      int t;
      cin>>t;
      while(t--)solve();
}

#include<bits/stdc++.h>
using namespace std;
//#include<atcoder/all>
//using namespace atcoder;
using ll = long long;
#define For(i,n,k) for(int i=(n);i<(k);i++)
#define ALL(a) (a).begin(),(a).end()
auto canMove = [](int cnt, int idx){return (cnt + idx) % 2 == 0;};
void Cout(vector<int> &ans){
    cout << ans.size() << endl;
    for(auto i : ans) cout << i + 1 << " ";
    cout << endl;
}
void Check(vector<int> &p, vector<int> &ans){
    int n = p.size(), m = ans.size();
    if(m > n * n) throw runtime_error("over the limit");
    For(i,0,n){
        if(p[i] != i){
            throw runtime_error("vector is not sorted");
        }
    }
    For(i,0,m){
        if(!canMove(i, ans[i])){
            throw runtime_error("invalid swap");
        }
    }
}
void In(int &n, vector<int> &p){
    cin >> n;
    p.resize(n);
    For(i,0,n){
        cin >> p[i];
        p[i]--;
    }
    return;
}
void Rand(int &n, vector<int> &p){
  random_device seed_gen;
  mt19937 engine(seed_gen());
  n = engine() % 500 + 1;
  p.resize(n);
  iota(ALL(p), 0);
  shuffle(ALL(p), engine);
}
void solve(){
    int n;
    vector<int> p, ans;
    In(n, p);
    // Rand(n, p);
    For(cnt,0,n*n){
        int target = -1;
        for(int i=n-1; i>-1; i--){
            if(p[i] != i){
                target = i;
                break;
            }
        }
        if(target == -1){
            Check(p, ans);
            Cout(ans);
            return;
        }
        For(i,0,n-1){
            if(p[i] == target){
                if(canMove(cnt, i)){
                    ans.push_back(i);
                    swap(p[i], p[i+1]);
                }
                else{
                    ans.push_back(cnt % 2);
                    swap(p[cnt % 2], p[cnt % 2 + 1]);
                }
                break;
            }
        }
    }
}
void Main(){
    int t;
    cin >> t;
    For(_,0,t){
        solve();
    }
}
int main(){
    Main();
    /*
    東方風神録は神が出てくるので当然神ゲー
    */
    return 0;
}


//clear adj and visited vector declared globally after each test case
//check for long long overflow
//Mod wale question mein last mein if dalo ie. Ans<0 then ans+=mod;
//Incase of close mle change language to c++17 or c++14
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#define int long long
#define IOS std::ios::sync_with_stdio(false); cin.tie(NULL);cout.tie(NULL);cout.precision(dbl::max_digits10);
#define pb push_back
#define mod 1000000007ll //998244353ll
#define lld long double
#define mii map<int, int>
#define pii pair<int, int>
#define ff first
#define ss second
#define all(x) (x).begin(), (x).end()
#define rep(i,x,y) for(int i=x; i<y; i++)
#define fill(a,b) memset(a, b, sizeof(a))
#define vi vector<int>
#define setbits(x) __builtin_popcountll(x)
#define print2d(dp,n,m) for(int i=0;i<=n;i++){for(int j=0;j<=m;j++)cout<<dp[i][j]<<" ";cout<<"\n";}
typedef std::numeric_limits< double > dbl;
using namespace __gnu_pbds;
using namespace std;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> indexed_set;
//member functions :
//1. order_of_key(k) : number of elements strictly lesser than k
//2. find_by_order(k) : k-th element in the set
const long long N=200005, INF=2000000000000000000;
lld pi=3.1415926535897932;
int lcm(int a, int b)
{
    int g=__gcd(a, b);
    return a/g*b;
}
int power(int a, int b, int p)
    {
        if(a==0)
        return 0;
        int res=1;
        a%=p;
        while(b>0)
        {
            if(b&1)
            res=(res*a)%p;
            b>>=1;
            a=(a*a)%p;
        }
        return res;
    }

int32_t main()
{
    IOS;
    int n;
    cin>>n;
    int a[n+1], b[n+1], c[n+1];
    rep(i,1,n+1)
    cin>>a[i];
    rep(i,1,n+1)
    cin>>b[i];
    int co[n+1];
    fill(co, 0);
    rep(i,1,n+1)
    {
        cin>>c[i];
        c[i]=b[c[i]];
        co[c[i]]++;
    }
    int ans=0;
    rep(i,1,n+1)
    ans+=co[a[i]];
    cout<<ans;
}

// #pragma GCC target("avx2")
// #pragma GCC optimize("O3")
// #pragma GCC optimize("unroll-loops")
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define all(a) a.begin(), a.end()
#define sz(x) x.size()
#define yn(p) cout << (p?"Yes":"No") << endl;
using namespace std;
using ll = long long;
using P = pair<int, int>;
// #include <atcoder/all>
// #include <boost/multiprecision/cpp_int.hpp>
// using namespace atcoder;
// using lll = boost::multiprecision::cpp_int;
#define Pr pair<ll,ll>
#define Tp tuple<ll,ll,ll>
using Graph = vector<vector<int>>;
const int INF = 1000000000;
const int MOD = 1000000007;
const ll llINF = 1000000000000000000;

void solve() {
  int n;
  cin >> n;
  vector<ll> a(n), b(n), c(n);
  for (int i = 0; i < n; ++i) {
    cin >> a[i];
  }
  for (int i = 0; i < n; ++i) {
    cin >> b[i];
  }
  for (int i = 0; i < n; ++i) {
    cin >> c[i];
  }
  vector<ll> x(100001, 0), y(100001, 0);
  for (int i = 0; i < n; ++i) {
    ++x[a[i]];
    ++y[b[c[i]-1]];
  }
  ll ans = 0;
  for (int i = 0; i < 100001; ++i) {
    ans += x[i] * y[i];
  }
  cout << ans << endl;
}

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


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

int main() {
	int a,b,c,d;
	cin >> a >> b >> c >> d;
	int n=0;
	if (a <= n*d*c) {
		cout << n << endl;
		return 0;
	}
	n++;
	if (d*c-b <= 0) {
		cout << -1 << endl;
		return 0;
	}
	while ( a > n*(d*c-b)) {
		n++;
	}
	cout << n++ << endl;
	return 0;
}

#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define endl '\n'
typedef pair<int, int> P;
typedef long long ll;
class Combination
{
    vector<long long> fact;
    vector<long long> factinv;
    long long MOD = 1e9 + 7;
    long long modpow(long long a, long long n)
    {
        if (n == 0)
            return 1;
        if (n % 2 == 0)
        {
            long long t = modpow(a, n / 2);
            return t * t % MOD;
        }
        return a * modpow(a, n - 1) % MOD;
    }

    long long modinv(long long a)
    {
        // mod is prime
        return modpow(a, MOD - 2);
    }

public:
    Combination(int n) : fact(n), factinv(n)
    {
        fact[0] = 1;
        for (int i = 1; i < n; i++)
        {
            fact[i] = fact[i - 1] * i % MOD;
        }
        factinv[n - 1] = modinv(fact[n - 1]);
        for (int i = n - 2; i >= 0; i--)
        {
            factinv[i] = factinv[i + 1] * (i + 1) % MOD;
        }
    }

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

    long long npr(long long n, long long r)
    {
        if (r < 0 || r > n)
            return 0;
        return fact[n] * factinv[n - r] % MOD;
    }

    long long nhr(long long n, long long r)
    {
        if (n == 0 && r == 0)
            return 1;
        return ncr(n + r - 1, r);
    }
};

ll solve1(int n)
{
    ll ans = 0;
    ll mod = 1e9 + 7;
    Combination C(100000);
    for (int i = 1; i <= n / 2; i++)
    {
        ans += C.nhr(i, n - 2 * i);
        ans %= mod;
    }
    return ans;
}

ll solve2(int n)
{
    if (n <= 2)
    {
        return 1;
    }
    ll ans = 1;
    ll mod = 1e9 + 7;
    for (int i = 0; i < n - 3; i++)
    {
        ans *= 2;
        ans %= mod;
    }
    return ans;
}
int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int n;
    cin >> n;
    ll ans = 0;
    char caa, cab, cba, cbb;
    cin >> caa >> cab >> cba >> cbb;
    if (cab == 'A')
    {
        if (caa == 'A')
        {
            ans = 1;
        }
        else
        {
            if (cba == 'A')
            {
                ans = solve1(n);
            }
            else
            {
                ans = solve2(n);
            }
        }
    }
    else
    {
        if (cbb == 'B')
        {
            ans = 1;
        }
        else
        {
            if (cba == 'B')
            {
                ans = solve1(n);
            }
            else
            {
                ans = solve2(n);
            }
        }
    }
    cout << ans << endl;
}


#include<bits/stdc++.h>
using namespace std;
inline int read(){
	int res=0;
	bool zf=0;
	char c;
	while(((c=getchar())<'0'||c>'9')&&c!='-');
	if(c=='-')zf=1;
	else res=c-'0';
	while((c=getchar())>='0'&&c<='9')res=(res<<3)+(res<<1)+c-'0';
	if(zf)return -res;
	return res;
}
signed main(){
	int n=read();
	string s;cin>>s;s=' '+s;
	int Q=read(),f=0;
	while(Q--){
		int t=read(),x=read(),y=read();
		if(t==1){
			if(f){
				if(x<=n){
					x+=n;
				}
				else{
					x-=n;
				}
				if(y<=n){
					y+=n;
				}
				else{
					y-=n;
				}
			}
			swap(s[x],s[y]);
		}
		else{
			f^=1;
		}
	}
	if(!f){
		for(register int i=1;i<=n+n;++i){
			putchar(s[i]);
		}
		puts("");
	}
	else{
		for(register int i=n+1;i<=n+n;++i){
			putchar(s[i]);
		}
		for(register int i=1;i<=n;++i){
			putchar(s[i]);
		}
		puts("");
	}
	return 0;
}

#include <bits/stdc++.h>
#define int long long
using namespace std;
int n,a,minv=1<<30,maxv,T,b,q,num;
string s,t,tt;
char tmp1,tmp2;
signed main()
{
	cin>>n>>s>>q;
	for(int i=1;i<=q;i++)
	{
		scanf("%lld%lld%lld",&T,&a,&b);
		if(T==1)
		{
			if(num==1)
			{
				if(a>n)
					a-=n;
				else
					a+=n;
				if(b>n)
					b-=n;
				else
					b+=n;
			}
			swap(s[a-1],s[b-1]);
		}
		else
			num=1-num;
	}
	if(num==1)
	{
		t=s.substr(0,n);
		tt=s.substr(n,n);
		s=tt+t;
	}
	cout<<s;
    return 0;
}


#include <bits/stdc++.h>
#include<stdio.h>
#include<math.h>
#include<algorithm>
#include<queue>
#include<deque>
#include<stack>
#include<string>
#include<string.h>
#include<vector>
#include<set>
#include<map>
#include<bitset>
#include<stdlib.h>
#include<cassert>
#include<time.h>
#include<bitset>
#include <numeric>
using namespace std;

typedef long long ll;
#define rep(i,n) for(int i = 0 ; i < n ; i++)
#define Rep(i,n) for(int i = 1 ; i <= n ; i++)
const int maxn=2e5+5;
const ll mod = 1e9 + 7;
const bool DEBUG = 0;

int main(){

    int a,b,ans;

    cin >> a >> b;

    int sum = 500500;
    Rep(i,a){
        if( i < a ){
            cout << i << ' ';
            sum = sum - i;
        }else{
            cout << sum << ' ';
        }
    }

    sum = 500500;
    Rep(i,b){
        if( i < b){
            cout << -i << ' ';
            sum = sum - i;
        }else{
            cout << -sum << ' ';
        }
    }

    return 0;
}

#include "bits/stdc++.h"
#include "ext/pb_ds/assoc_container.hpp"
#include "ext/pb_ds/tree_policy.hpp"
using namespace std;

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

#define sync ios_base::sync_with_stdio(0); cin.tie(0);
#define all(x) x.begin(),x.end()
#define unq(a) sort(all(a));a.resize(unique(all(a)) - a.begin())
#define ll long long
#define ld long double
#define pb push_back
#define fi first
#define se second
#define endl '\n'
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
//mt19937 rng(0);
using pii = pair<int , int>;

int inline max(const int x, const int y){return (x > y ? x : y);}
int inline min(const int x, const int y){return (x < y ? x : y);}
int inline abs(const int x){return (x < 0 ? -x : x);}

int main(){

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

    sync

    int t = 1;
    //cin >> t;
    while(t--){
      int n, m;
      cin >> n >> m;
      bool f = 0;
      if (n < m){
        swap(n , m);
        f = 1;
      }
      vector<int> a(n), b(m);
      ll sm = 0;
      for (int i = 0; i < n; i++){
        a[i] = i + 1;
        sm += a[i];
      }
      for (int i = 0; i < m - 1; i++){
        b[i] = -(i + 1);
        sm += b[i];
      }
      b[m - 1] = -sm;
      for (int i = 0; i < n + m; i++){
        if (i < n){
          cout << a[i] * (f ? -1 : 1) << " ";
        }
        else{
          cout << b[i - n] * (f ? -1 : 1) << " ";
        }
      } cout << endl;
    }
    cerr << "processor time: " << clock() / (double) CLOCKS_PER_SEC << "s    ";
    return 0;
}


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

mt19937 rand_mt(42);

const int N = 20;

class Genome{
public:
    Genome(const vector<string>& S): sequences(S){

        // auto dna = init_random();
        auto dna = init_bf();

        for(int i=0; i<N; i++){
            dna_w[i] = dna[i];

            for(int j=0; j<N; j++){
                dna_h[j] += dna[i][j];
            }
        }
        for(int i=0; i<N; i++){
            dna_w[i] += dna_w[i];
            dna_h[i] += dna_h[i];
        }
    }

    array<string, N> init_random(){
        auto dna = array<string, N>();
        for(int i=0; i<N; i++){
            for(int j=0; j<N; j++){
                dna[i] += 'A' + rand_mt() % 8;
            }
        }
        return dna;
    }

    array<string, N> init_bf(){
        auto dna = array<string, N>();
        int i = 0;
        for(auto s : sequences){
            for(int i=0; i<N; i++){
                if(N - dna[i].size() < s.size()) continue;

                dna[i] += s;
                break;
            }
        }
        return dna;
    }

    int evaluate(){
        const auto M = sequences.size();
        int c = 0;
        for(auto s : sequences){
            bool hasSeq = false;
            for(auto dw : dna_w){
                if(dw.find(s) != string::npos){ hasSeq = true; break;}
            }
            if (hasSeq){ c++; continue;}

            for(auto dw : dna_h){
                if(dw.find(s) != string::npos){ hasSeq = true; break;}
            }
            if (hasSeq){ c++; continue;}
        }

        int d = 0;
        auto dna = getDNA();
        for(auto s : dna){
            d += count(s.begin(), s.end(), '.');
        }

        if(c < M){
            return int(1e+8 * (c / (double) M));
        }else{
            return int(1e+8 * ((2 * N * N) / (double) (2 * N * N - d)));
        }
    }

    array<string, N> getDNA(){
        auto dna = array<string, N>();
        for(int i=0; i<N; i++){
            dna[i] = dna_w[i].substr(0, 20);
        }
        return dna;
    }

    void print(){
        auto dna = getDNA();
        for(int i=0; i<N; i++){
            cout << dna[i] << endl;
        }
    }

public:
    array<string, N> dna_w;
    array<string, N> dna_h;

    const vector<string> sequences;

};

int main()
{
    int M;
    cin >> M >> M;
    vector<string> S(M, "");
    for(int i=0; i<M; i++) cin >> S[i];
    sort(S.begin(), S.end(), [](const string& s1, const string& s2){return s1.size() > s2.size();});

    auto genome = Genome(S);
    genome.print();

    // cerr << "score = "<< genome.evaluate() << endl;

    return 0;
}

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

class Timer {
public:
    Timer() { start_time_ = std::chrono::steady_clock::now(); }
    int64_t elapsedMilliSeconds() const {
        auto elapsed = std::chrono::steady_clock::now() - start_time_;
        return std::chrono::duration_cast<std::chrono::milliseconds>(elapsed).count();
    }

private:
    std::chrono::steady_clock::time_point start_time_;
};

unsigned int randxor() {
    static unsigned int x = 123456789, y = 362436069, z = 521288629, w = 88675123;
    unsigned int t;
    t = (x ^ (x << 11));
    x = y;
    y = z;
    z = w;
    return (w = (w ^ (w >> 19)) ^ (t ^ (t >> 8)));
}

int main() {
    int32_t N, M;
    cin >> N >> M;
    vector<string> s(M);
    for (string &i : s) {
        cin >> i;
    }

    Timer timer;

    // 操作
    // (1)まだ載せてないものからランダムに選んで載せる
    // (2)すでに載っているものを取り除く
    vector<string> ans(N, string(N, '.'));

    // 各マスが何個の文字列へ影響しているか
    vector<vector<int32_t>> dependence_num(N, vector<int32_t>(N, 0));

    // まだ載せてないもの
    vector<int32_t> remainder(M);
    iota(remainder.begin(), remainder.end(), 0);

    constexpr int64_t TIME_LIMIT = 1800;

    while (true) {
        int64_t curr_time = timer.elapsedMilliSeconds();
        if (curr_time >= TIME_LIMIT) {
            break;
        }

        int64_t rand = randxor();
        if (!remainder.empty() && true) {
            // まだ載せてないもんをランダムに選んで載せる
            int32_t index = randxor() % remainder.size();
            int32_t x = randxor() % N;
            int32_t y = randxor() % N;
            int32_t h_or_v = randxor() % 2;
            const string &curr_str = s[remainder[index]];
            bool ok = true;
            for (int32_t i = 0; i < curr_str.size(); i++) {
                int32_t curr_x = (h_or_v == 0 ? (x + i) % N : x);
                int32_t curr_y = (h_or_v == 0 ? y : (y + i) % N);
                if (ans[curr_y][curr_x] != '.' && ans[curr_y][curr_x] != curr_str[i]) {
                    ok = false;
                    break;
                }
            }

            if (ok) {
                // 書き込む
                for (int32_t i = 0; i < curr_str.size(); i++) {
                    int32_t curr_x = (h_or_v == 0 ? (x + i) % N : x);
                    int32_t curr_y = (h_or_v == 0 ? y : (y + i) % N);
                    ans[curr_y][curr_x] = curr_str[i];
                    dependence_num[curr_y][curr_x]++;
                }

                remainder[index] = remainder.back();
                remainder.pop_back();
            }
        } else {
        }
    }

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