# include <iostream>
# include <math.h>
# include <fstream>
# include <vector>
# include <algorithm>
# include <string>
using namespace std;
//printf ("%.6lf\n", a);
// erase

# define all(a) a.begin(), a.end()
# define Sort(a) sort(all(a));
# define pause system("pause");
# define ll long long

struct toch
{
    int x;
    int y;
};

toch hanako(toch t)
{
    if(t.y>=22)
    {
        t.y=t.y-22;
        return t;
    }
    if(t.x>0&&t.y>=11)
    {
        t.x--;
        t.y=t.y-12;
        return t;
    }
    if(t.x>1&&t.y>1)
    {
        t.x-=2;
        t.y-=2;
        return t;
    }

    t.x=-1;
    //t.y=-1;
    return t;
}

toch ciel(toch t)
{
    if(t.x>1&&t.y>1)
    {
        t.x-=2;
        t.y-=2;
        return t;
    }
    if(t.x>0&&t.y>=11)
    {
        t.x--;
        t.y=t.y-12;
        return t;
    }
    if(t.y>=22)
    {
        t.y=t.y-22;
        return t;
    }

    t.x=-1;
    //t.y=-1;
    return t;
}

string prob(toch t)
{
    for(int i=0; i<t.x+t.y; i++)
    {
        if(i%2)
        {
            t=hanaco(t);
            if(t.x==-1) return "Ciel";
        }
        else
        {
            t=ciel(t);
            if(t.x==-1) return "Hanaco";
        }
    }
}

int main()
{
    toch
    cin>>t.x>>t.y;

    cout<<prob(t);
}


#include "bits/stdc++.h"
using namespace std;
#define max(a, b) (a < b ? b : a)
#define min(a, b) ((a > b) ? b : a)
#define mod 1e9 + 7

#define FOR(a, c) for (ll (a) = 0; (a) < (c); (a)++)
#define FORL(a, b, c) for (ll (a) = (b); (a) <= (c); (a)++)
#define FORR(a, b, c) for (ll (a) = (b); (a) >= (c); (a)--)
#define INF 1000000000000000003
typedef long long int  ll;
typedef vector<int > vi;
typedef pair<ll , ll > pi;
#define F first
#define S second
#define PB push_back
#define POB pop_back
#define MP make_pair
void solve();
int  main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

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

    ll  t = 1;
    /*is Single Test case?*/ cin >> t;
    while (t--) {
        solve();
        cout << "\n";
    }

    cerr << "time taken : " << (float)clock() / CLOCKS_PER_SEC << " secs" << endl;
    return 0;
}

int modd(int a)
{if(a<0)
	return -a;
	else return a;

}

void solve()
{
  ll x,y,count=0;
  cin>>x>>y;
  while (count<INF)
  {
     if(count%2==0)
     {
         if(x>=2 && y>=2)
         {
             x-=2;
             y-=2;

         }
         else if(x>=1 && y>=12)
         {
             x-=1;
             y-=12;
         }
         else if(x==0 && y>=22)
         {
             y-=22;

         }
         else{
             cout<<"Hanako";
             break;

            }

    }
    else if(count%2==1)
    {
        if(x>=0 && y>=22)
        {
            y-=22;

        }
        else if(x>=1 && y>=12)
        {
            x-=1;
            y-=12
        }
        else if(x>=2 && y>=2)
        {
            x-=2;
            y-=2;
        }
        else
        {
            cout<<"Ceil";
            break;
        }

    }
    count++;
  }
}


#include <iostream>

using namespace std;
int main()
{
    int x, y;
    cin >> x >> y;
    int maximum = min(x/2, y/24);
    x -= maximum * 2;
    y -= maximum * 24;

    while(1)
    {
        if(x >= 2 && y >= 2)
        {
            x -= 2; y -= 2;
        }
        else if (x == 1 && y >= 12)
        {
            x--; y -= 12;
        }
        else if (y >= 22)
        {
            y -= 22;
        }
        else
        {
            cout << "Hanako";
            break;
        }

        if(y > 21)
        {
            y -= 22;
        }
        else if (x == 1 && y > 11)
        {
            x--; y -= 12;
        }
        else if (x >= 2 && y > 1)
        {
            x -= 2; y -= 2;
        }
        else
        {
            cout << "Ciel";
            break;
        }
    }
    return 0;
}


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

typedef long long ll;
typedef unsigned long long ull;

#define fr(i,a,b) for(ll i= (a) ; i< (b) ; i++)
#define pb push_back
#define mp make_pair
#define pii pair< int, int >
#define pll pair< long long, long long >
#define all(a) a.begin(), a.end()

int main()
{

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

	time_t t1, t2;
	t1 = clock();

	ll n,k; cin>>n>>k;

	if(n==1 && k==1) { cout<<"Yes"; return 0;}

	if(k>=n){cout<<"No"; return 0;}

	int used[1e7+5];

	fr(i,0,1e7+5) used[i]=0;

	for(ll i=1; i<=k; i++)
	{
		if(used[n%i]==1)
		{
			cout<<"No"; return 0;
		}
		used[n%i]=1;
	}

	cout<<"Yes";

	t2 = clock();
	cerr << "time taken: " << t2-t1;

	return 0;
}


#include<bits/stdc++.h>
#define lli long long int
using namespace std;
int main()
{
	ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
lli i,j,k,n,m;
cin>>n>>k;
if(n==1 && k==1)
{
	cout<<"Yes";
	return 0;
}
if(n==k)
{
	cout<<"No";
	return 0;
}
lli x=0;
int flag=1;
int a[10];
std::fill(a,a+10,0);
for(i=1;i<=k/2;i++)
{
p=n%i;
if(p>=0 && p<=9)
{
	a[p]++;
}
for(i=0;i<=9;i++)
{
	if(a[i]>1)
	{
	cout<<"No";
	return 0;
	}
	}
}
cout<<"Yes";
}


#include<iostream>
#include<vector>
#include<algorthm>
using namespace std;
int main()
{
    int long long n,k;
    cin>>n>>k;
    if(k>=n)
    {
        cout<<"No";
    }
    else
    {
        cout<<"Yes";
    }
    return 0;
}


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

set<long long> a;
int main()
{
	long long n,k;
	cin>>n>>k;
	k=min(k,1000000)
	for(long long i=1;i<=k;++i)
	{
		if(a.find(n%i)!=a.end())
		{
			cout<<"No"<<endl;
//			system("pause");
			return 0;
		}
		a.insert(n%i);
	}
	cout<<"Yes"<<endl;
//	system("pause");
	return 0;
}


#include <iostream>
#include <cstring>
int main()
{
	char s[25];
	int a, len;
	cin >> s;
	len = strlen(s);
	a = len * 26 - (len - 1) * 2;
	cout << a;
	return 0;
}


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

int main()
{
    int n;
    string s;
    long long c= 1;

    cin>>s;
    c=51;
    int l= s.size()-2;
    c+= 25*l;
    cout<< c <<endl;

    return 0;
}


#include<iostream>
#include<string>
int main()
{

  string s;
  int a;
  cin >>s;
  a=(s.length()+1)*25+1;
  cout << a <<endl;
  return 0;
}


//To Be Continued

#include<iostream>
#include<cstdio>
#include<vector>
#include<stack>
#include<queue>
#include<deque>
#include<map>
#include<set>
#include<string>
#include<fstream>
#include<sstream>
#include<memory.h>
#include<cmath>
#include<algorithm>
#include<iomanip>
using namespace std;

    int main(){

    string a;'
    cin>>a;
    int len=a.length();
    cout<<26*(len+a)-len;

    return 0;
    }


#include <iostream>
#include <string>
using namespace std;
int n,i,j,x;
string a,b,c,d[10];
int main(){
    cin>>a;
    for (i=0; i<a; i+=10)
        cin>>d[a];
    for (i=0; i<a; i++){
        str.substr (i,10);
        for (j=0; j<a; j++) {
            if (x==d[j]) cout<<j;
        }
    }

}


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

int main()
{

int index=0;

string binary_code,cp[8],codes[10];

cin>>binary_code;
vector<int>c;

for(int i=0;i<=80;i+=10)
 {

 cp[index]=binary_code.substr(i,10);

 cout<<cp[index]<<endl;
 index++;

     }

 for(int i=0;i<10;i++)
    {
        cin>>codes[i];

    }
    for (int i=0;i<10;i++)
    {
        for(int j=0;j<10;j++)
        {
            if(cp[i]==codes[j]){c.push_back(j);}
        }
    }
for(int i=0;i<8;i++)
{
    cout<<c[i];
}


//
//  main.cpp
//
//
//  Created by Maxim on 14.12.13.
//  Copyright (c) 2013 Maxim. All rights reserved.
//

#include <stdio.h>
#include <math.h>
#include <string.h>
#include <iostream>
#include <time.h>
#include <stdlib.h>
using namespace std;

void sch (FILE *f1, char *a, int b);

int main (int argc, char **argv) {
    int i,j,k,m;
    char a[81];
    char d[11];
    sch(stdin,a,81);
    char b[10][11];
    for(i=0;i<10;i++)
        sch(stdin,b[i],11);

    strcpy(d,a);

    for(i=0;i<10;i++)
        if (strstr(d,b[i])==NULL) {}
        else cout<<i;

    return 0;
}

void sch (FILE *f1, char *a, int b) {
    int i,k;
    char c;
    k=fscanf(f1,"%c",&c);
    while(c==10)  k=fscanf(f1,"%c",&c);
    i=0;
    while((k==1) && (c!=10) && (i!=b-1)){
        a[i]=c;
        i++;
        k=fscanf(f1,"%c",&c);
    }
    a[i]=0;


//
//  main.cpp
//  acm
//
//  Created by Colors Client 2 on 1/22/13.
//  Copyright (c) 2013 Colors Client 2. All rights reserved.
//

#include <iostream>
#include <memory.h>
using namespace std;
long long memo[21][21][21][5][3];
int N ,T , R1,R2;
int getR(int n1,int n2)
{
    return (n1>n2)+1;
}

long long DP(int idx , int r1 ,int r2, int lst , int rel)
{
    if(idx>=N)
    {
        if(r1==R1 && r2==R2)
            return 1;
        return 0;
    }
    long long &ref = memo[idx][r1][r2][lst][rel];
    if(ref!=-1)
        return ref;
    ref=0;
    for(int i=1;i<=4;++i)
    {
        if(i==lst)
            continue;
        int nrel = getR(i,lst);
        if (nrel==rel) {
            ref+=DP(idx+1,r1,r2,i,nrel);
        }
        else
        {
            if(rel==1)
                ref+=DP(idx+1,r1,r2+1,i,nrel);
            else
                ref+=DP(idx+1,r1+1,r2,i,nrel);

        }

    }
    return ref;
}
int main(int argc, const char * argv[])
{

    scanf("%d%d",&N,&T);
    R1 = T;
    R2 = T-1;
    memset(memo, -1, sizeof(memo));
    long long cnt=0;
    for(int i=1;i<=4;++i)
    {
        for(int j=1;j<=4;++j)
            cnt+=DP(2,0,0,j,getR(j, i));
    }
    cout<<cnt<<endl;
    return 0;
}


#include<iostream>
#pragma GCC optimize(4)
#define For(k,i,j) for(int k=i;k<=j;k++)
using namespace std;
const int maxn 20
const int maxt 10
const int maxk 4
const int maxr 2
int f[maxn+2][maxk+2][maxt+2][maxr+2];
int main(){
    int n,t,ans;
    cin>>n>>t;
    f[2][2][1][1]=1;
    f[2][3][1][1]=2;
    f[2][4][1][1]=3;
    For(i,3,n){
       For(j,1,4){
            For(k,1,t){
                for(int r=4;r>j;r--){
                    f[i][j][k][0]+=f[i-1][r][k][0]+f[i-1][r][k][1];
                }
                For(r,1,j-1){
                    f[i][j][k][1]+=f[i-1][r][k][1]+f[i-1][r][k-1][0];
                }
            }
        }
    }
    for(i,1,maxk){
        ans+=f[n][i][t][0];
    }
    cout<<ans;
    return 0;
}


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

int main() {

	int grid[9];
	int a = 100000;
	int total = a;
	scanf("%d", grid + 0);
	scanf("%d", grid + 1);
	total += grid[1];
	scanf("%d", grid + 2);
	total += grid[2];

	int b = total;
	scanf("%d", grid + 3);
	b -= grid[3];
	scanf("%d", grid + 4);
	scanf("%d", grid + 5);
	b -= grid[5];

	int c = total;
	scanf("%d", grid + 6);
	c -= grid[6];
	scanf("%d", grid + 7);
	c -= grid[7];
	scanf("%d", grid + 8);

	int off = min(a, min(b, c)) - 1;
	a -= off;
	b -= off;
	c -= off;

	int total = a + grid[1] + grid[2];
	off = (total - a - b - c) / 2;
	a += off;
	b += off;
	c += off;

	printf("%d %d %d\n", a, grid[1], grid[2]);
	printf("%d %d %d\n", grid[3], b, grid[5]);
	printf("%d %d %d\n", grid[6], grid[7], c);

	return 0;
}


#include <iostream>

using namespace std;
struct twod{
	int xCord;
	int yCord;
};
int main(){
	int oriX, oriY;
	//int arr[3][3] = {};
	twod containter;
	for (int i = 0; i < 8; ++i){
		cin >> container[i].xCord >> container[i].yCord;
	}
		oriX = container[0].xCord;
		oriY = container[0].yCord;
		int n = 0;
		int flag = 1;
	while(n<8){
		for (int i = 0; i < 3; ++i){  //i = x coordinate, k = y coordinate

			for (int k= 0; k < 3; ++k)
			{
				if(i == 2 && k ==2) continue;
				if(((container[n].yCord - oriY) == k && (container[n].xCord - oriX) == k)|| ((container[k].XCord - oriX) !=1 && (container[k].yCord - oriY) !=1)){
					n++;
				}
				else{
					flag = 0;
					break;
				}

			}
		}

	}

	if (flag == 0) cout << "ugly";
	else cout <<"respectable";
}


#include <cstdio>
#include <iostream>
#include <algorithm>
using namespace std;
struct point
{
  int x, y;
  friend bool operator < (point x, point y)
  {
    return x.x < y.x || x.x == y.x && x.y < y.y;
  }
}s[8];
int main(int argc, char **argv)
{
	int i;
	bool f = 1;
	for(i = 0; i < 8; i++)
	  cin >> s[i].x >> s[i].y;
	sort(s, s + 8);
	for(i = 0; i < 7; i++)
	  if(!(s[i] != s[i + 1])) f = 0;
	if(s[0].x == s[1].x && s[1].x == s[2].x && s[5].x == s[6].x && s[6].x == s[7].x && s[3].x == s[4].x && s[2].x != s[3].x && s[4].x != s[5].x);
	else f = 0;
	if(s[0].y == s[3].y && s[3].y == s[5].y && s[2].y == s[4].y && s[4].y == s[7].y && s[1].y == s[6].y && s[5].y != s[1].y && s[6].y != s[2].y);
	else f = 0;
	if(f) cout << "respectable" << endl;
	else cout << "ugly" << endl;
	return 0;
}


#define FNAME ""

#include <bits/stdc++.h>

#define pb push_back
#define mp make_pair
#define forn(i, n) for (int i = 0; i < (int) n; i++)
#define fornr(i, n) for (int i = n - 1; i >= 0; i--)
#define forab(i, a, b) for (int i = a; i < (int) b; i++)
#define gcd __gcd

#ifdef WIN32
    #define I64 "%I64d"
#else
    #define I64 "%lld"
#endif

using namespace std;

typedef long long LL;
typedef unsigned long long ULL;
typedef long double LD;
typedef pair <int, int> pii;
typedef vector <int> vi;

template <class T> T sqr(const T &a) {return a * a;}

struct st
{
    int l, r, type, cost, num;
    st(){}
    st(int _l, int _r, int _t, int _c, int _n) : l(_l), r(_r) ,type(_t), cost(_c), num(_n) {}
    bool operator < (const st &a) const
    {
        if (l != a.l)
            return l < a.l;
        return mp(type, num) < mp(a.type, a.num);
    }
};

int n, m;
vector <st> a;
LL ans;
pii res;
set <pair <int, int> > s;
set <pair <pii, int> > q;
int x, y, z;
vi b;
map <int, int> Map;
pii t[1600000];

void add(int vl, int vr, int pos, pii val, int v)
{
    if (vl + 1 == vr)
    {
        t[v] = max(t[v], val);
        return;
    }
    int vm = (vl + vr) / 2;
    if (vm > pos)
        add(vl, vm, pos, val, 2 * v);
    else
        add(vm, vr, pos, val, 2 * v + 1);
    t[v] = max(t[2 * v], t[2 * v + 1]);
}

pii Get(int vl, int vr, int l, int r, int v)
{
    if (vl >= l && vr <= r)
        return t[v];
    if (vl >= r || vr <= l)
        return mp(0, 0);
    int vm = (vl +vr) / 2;
    return max(Get(vl, vm, l, r, 2 * v), Get(vm, vr, l, r, 2 * v + 1));
}

int main()
{

    scanf("%d%d", &n, &m);
    forn(i, n)
        scanf("%d%d", &x, &y), a.pb(st(x, y, 0, 0, i)), b.pb(x), b.pb(y);
    forn(i, m)
        scanf("%d%d%d", &x, &y, &z), a.pb(st(x, y, 1, z, i)), b.pb(x), b.pb(y);
    sort(a.begin(), a.end());
    sort(b.begin(), b.end());
    unique(b.begin(), b.end());
    forn(i, (int) b.size())
        Map[b[i]] = i;

    forn(i, (int) a.size())
    {
        if (a[i].type == 0)
        s.insert(mp(a[i].r, a[i].num));

        else if (s.size())
        {
            auto pos = s.upper_bound(mp(a[i].r, 1e9));
            int r;
            if (pos != s.end())
                r = a[i].r;
            else
                pos--, r = pos->first;
            if (ans < 1ll*(r - a[i].l) * 1ll*a[i].cost)
                ans = 1ll*(r - a[i].l) * 1ll*a[i].cost, res = mp(a[i].num, pos->second);
        }
    }
    forn(i, (int) a.size())
    {
        if (a[i].type == 1)
            add(0, b.size(), Map[a[i].r], mp(a[i].cost, a[i].num), 1);
        else

            pii tmp = Get(0, b.size(), Map[a[i].r], b.size(), 1);
            if (1ll * tmp.first * (a[i].r - a[i].l) > ans)
                ans = 1ll * tmp.first * (a[i].r - a[i].l), res = mp(a[i].num, tmp.second);
        }
    }
    s.clear();
    forn(i, a.size())
        a[i].l = 1e9 - a[i].l, a[i].r = 1e9 - a[i].r, swap(a[i].l, a[i].r);
    fornr(i, (int) a.size())
    {
        if (a[i].type == 0)
            s.insert(mp(a[i].r, a[i].num));

        else if (s.size())
        {
            auto pos = s.upper_bound(mp(a[i].r, 1e9));
            int r;
            if (pos != s.end())
                r = a[i].r;
            else
                pos--, r = pos->first;
            if (ans < 1ll*(r - a[i].l) * 1ll*a[i].cost)
                ans = 1ll*(r - a[i].l) * 1ll*a[i].cost, res = mp(a[i].num, pos->second);
        }
    }
    printf(I64"\n", ans);
    if (ans)
        printf("%d %d\n", res.second + 1, res.first+ 1);
}


#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <ctime>
#include <cstring>
#include <cassert>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <bitset>
#include <queue>
#include <deque>
#include <stack>
#include <complex>

using namespace std;

#define pb push_back
#define mp make_pair
#define sz(s) int((s).size())
#define len(s) int((s).size())
#define all(x) (x).begin(), (x).end()
#define fs first
#define sc second
#define next _next
#define prev _prev
#define rank _rank
#define link _link
#define hash _hash
#ifdef LOCAL42
#define eprintf(...) fprintf(stderr, __VA_ARGS__)
#else
#define eprintf(...) 42
#endif
#if _WIN32 || _WIN64 || __WIN32__ || __WIN64__
#define LLD "%I64d"
#else
#define LLD "%lld"
#endif

typedef long long ll;
typedef long long llong;
typedef long long int64;
typedef unsigned int uint;
typedef unsigned long long ull;
typedef unsigned long long ullong;
typedef unsigned long long lint;
typedef long double ld;
typedef complex<double> tc;
typedef pair<int, int> pii;
typedef vector<int> vi;

const int inf = int(1e9);
const double eps = 1e-9;
const double pi = 4 * atan(double(1));
const int N = int(2e5) + 100;

struct seg {

    int l, r, pl, num;

};

bool operator < (const seg& a, const seg& b) {
    return a.r - a.l > b.r - b.l;
}

int k;
seg s[N];
int a[N], pa[N], b[N], c[N], l[N], r[N], ans[N], mid[N], x[N], fen_sum[N], fen_max[N];
bool good[N];
pii q[N];

inline void add(int num) {
    for (int pos = s[num].pl; pos < k; pos = (pos | (pos + 1))) {
        ++fen_sum[pos];
        fen_max[pos] = max(fen_max[pos], s[num].r);
    }
}

inline int get_max(int pos) {
    int res = -inf;
    while (pos >= 0) {
        res = max(res, fen_max[pos]);
        pos = (pos & (pos + 1)) - 1;
    }
    return res;
}

inline int get_cnt(int pos) {
    int res = 0;
    while (pos >= 0) {
        res += fen_sum[pos];
        pos = (pos & (pos + 1)) - 1;
    }
    return res;
}

inline int get_cnt(int l, int r) {
    if (l > r) {
        return 0;
    }
    return get_cnt(r) - (l > 0 ? get_cnt(l - 1) : 0);
}

int main() {
#ifdef LOCAL42
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
    int n, m;
    cin >> n >> m;
    for (int i = 0; i < n; ++i) {
        scanf("%d %d", &s[i].l, &s[i].r);
        x[i] = s[i].l;
        s[i].num = i;
    }
    sort(s, s + n);
    sort(x, x + n);
    k = (int) (unique(x, x + n) - x);
    for (int i = 0; i < n; ++i) {
        s[i].pl = (int) (lower_bound(x, x + k, s[i].l) - x);
    }
    for (int i = 0; i < m; ++i) {
        scanf("%d %d %d", a + i, b + i, c + i);
        pa[i] = (int) (upper_bound(x, x + k, a[i]) - x);
        l[i] = 1;
        r[i] = inf;
        ans[i] = 0;
    }
    for (;;) {
        bool fl = false;
        int sz = 0;
        for (int i = 0; i < m; ++i) {
            if (l[i] <= r[i]) {
                mid[i] = (l[i] + r[i]) / 2;
                good[i] = false;
                fl = true;
                q[sz++] = mp(mid[i], i);
            }
        }
        if (!fl) {
            break;
        }
        sort(q, q + sz);
        for (int i = 0; i < k; ++i) {
            fen_sum[i] = 0;
            fen_max[i] = -inf;
        }
        int ptr = 0;
        for (int i = 0; i < sz; ++i) {
            while (ptr < n && s[ptr].r - s[ptr].l >= q[i].fs) {
                add(ptr++);
            }
            int num = q[i].sc;
            if (get_max(pa[num] - 1) >= a[num] + mid[num]) {
                good[num] = true;
                continue;
            }
            int pos = (int) (upper_bound(x, x + k, b[num] - mid[num]) - x);
            if (get_cnt(pa[num], pos - 1) > 0) {
                good[num] = true;
            }
        }
        for (int i = 0; i < m; ++i) {
            if (l[i] <= r[i]) {
                if (good[i]) {
                    ans[i] = mid[i];
                    l[i] = mid[i] + 1;
                } else {
                    r[i] = mid[i] - 1;
                }
            }
        }
    }
    ll best = 0;
    int x = -1, y = -1;
    for (int i = 0; i < m; ++i) {
        ll cur = 1LL * c[i] * ans[i];
        if (cur > best) {
            best = cur;
            y = i;
        }
    }
    if (best > 0) {
        for (int i = 0; i < n; ++i) {
            int l = max(s[i].l, a[y]);
            int r = min(s[i].r, b[y]);
            if (1LL * (r - l) * c[y] == best) {
                x = s[i].num;
            }
        }
        assert(x != -1);
    }
    cout << best << endl;
    if (best > 0) {
        cout << x + 1 << " " << y + 1 << endl;
    }
    return 0;
}


#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <ctime>
#include <cstring>
#include <cassert>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <bitset>
#include <queue>
#include <deque>
#include <stack>
#include <complex>

using namespace std;

#define pb push_back
#define mp make_pair
#define sz(s) int((s).size())
#define len(s) int((s).size())
#define all(x) (x).begin(), (x).end()
#define fs first
#define sc second
#define next _next
#define prev _prev
#define rank _rank
#define link _link
#define hash _hash
#ifdef LOCAL42
#define eprintf(...) fprintf(stderr, __VA_ARGS__)
#else
#define eprintf(...) 42
#endif
#if _WIN32 || _WIN64 || __WIN32__ || __WIN64__
#define LLD "%I64d"
#else
#define LLD "%lld"
#endif

typedef long long ll;
typedef long long llong;
typedef long long int64;
typedef unsigned int uint;
typedef unsigned long long ull;
typedef unsigned long long ullong;
typedef unsigned long long lint;
typedef long double ld;
typedef complex<double> tc;
typedef pair<int, int> pii;
typedef vector<int> vi;

const int inf = int(1e9);
const double eps = 1e-9;
const double pi = 4 * atan(double(1));
const int N = int(2e5) + 100;

struct seg {

    int l, r, pl, num;

};

bool operator < (const seg& a, const seg& b) {
    return a.r - a.l > b.r - b.l;
}

int k;
seg s[N];
int a[N], pa[N], b[N], c[N], l[N], r[N], ans[N], mid[N], x[N], fen_sum[N], fen_max[N];
bool good[N];
pii q[N];

inline void add(int num) {
    for (int pos = s[num].pl; pos < k; pos = (pos | (pos + 1))) {
        ++fen_sum[pos];
        fen_max[pos] = max(fen_max[pos], s[num].r);
    }
}

inline int get_max(int pos) {
    int res = -inf;
    while (pos >= 0) {
        res = max(res, fen_max[pos]);
        pos = (pos & (pos + 1)) - 1;
    }
    return res;
}

inline int get_cnt(int pos) {
    int res = 0;
    while (pos >= 0) {
        res += fen_sum[pos];
        pos = (pos & (pos + 1)) - 1;
    }
    return res;
}

inline int get_cnt(int l, int r) {
    if (l > r) {
        return 0;
    }
    return get_cnt(r) - (l > 0 ? get_cnt(l - 1) : 0);
}

int main() {
#ifdef LOCAL42
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
    int n, m;
    cin >> n >> m;
    for (int i = 0; i < n; ++i) {
        scanf("%d %d", &s[i].l, &s[i].r);
        x[i] = s[i].l;
        s[i].num = i;
    }
    sort(s, s + n);
    sort(x, x + n);
    k = (int) (unique(x, x + n) - x);
    for (int i = 0; i < n; ++i) {
        s[i].pl = (int) (lower_bound(x, x + k, s[i].l) - x);
    }
    for (int i = 0; i < m; ++i) {
        scanf("%d %d %d", a + i, b + i, c + i);
        pa[i] = (int) (upper_bound(x, x + k, a[i]) - x);
        l[i] = 1;
        r[i] = inf;
        ans[i] = 0;
    }
    for (;;) {
        bool fl = false;
        int sz = 0;
        for (int i = 0; i < m; ++i) {
            if (l[i] <= r[i]) {
                mid[i] = (l[i] + r[i]) / 2;
                good[i] = false;
                fl = true;
                q[sz++] = mp(mid[i], i);
            }
        }
        if (!fl) {
            break;
        }
        sort(q, q + sz);
        for (int i = 0; i < k; ++i) {
            fen_sum[i] = 0;
            fen_max[i] = -inf;
        }
        int ptr = 0;
        for (int i = 0; i < sz; ++i) {
            while (ptr < n && s[ptr].r - s[ptr].l >= q[i].fs) {
                add(ptr++);
            }
            int num = q[i].sc;
            if (min(get_max(pa[num] - 1), b[num]) >= a[num] + mid[num]) {
                good[num] = true;
                continue;
            }
            int pos = (int) (upper_bound(x, x + k, b[num] - mid[num]) - x);
            if (get_cnt(pa[num], pos - 1) > 0) {
                good[num] = true;
            }
        }
        for (int i = 0; i < m; ++i) {
            if (l[i] <= r[i]) {
                if (good[i]) {
                    ans[i] = mid[i];
                    l[i] = mid[i] + 1;
                } else {
                    r[i] = mid[i] - 1;
                }
            }
        }
    }
    ll best = 0;
    int x = -1, y = -1;
    for (int i = 0; i < m; ++i) {
        ll cur = 1LL * c[i] * ans[i];
        if (cur > best) {
            best = cur;
            y = i;
        }
    }
    if (best > 0) {
        for (int i = 0; i < n; ++i) {
            int l = max(s[i].l, a[y]);
            int r = min(s[i].r, b[y]);
            if (l > r) {
                continue;
            }
            if (1LL * (r - l) * c[y] == best) {
                x = s[i].num;
            }
        }
        assert(x != -1);
    }
    cout << best << endl;
    if (best > 0) {
        cout << x + 1 << " " << y + 1 << endl;
    }
    return 0;
}


#include <iostream>
#include <cstdlib>
#include <cstdio>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <cstring>
#include <algorithm>
#include <cctype>
#include <ctime>
#include <cmath>
#include <complex>
#include <cassert>

using namespace std;

#define forab(i, a, b) for(int i = int(a); i < int(b); ++i)
#define forba(i, b, a) for(int i = int(b) - 1; i >= int(a); --i)
#define forn(i, n) forab(i, 0, n)

typedef long long ll;
typedef long double ldb;

const int INF = 1e9;
const int MAXN = 2e5 + 10;

struct tree {
	int x[4 * MAXN];
	int sz;

	void build(int n) {
		sz = 1;
		while (sz < n)
			sz *= 2;

		forab(i, 1, 2 * sz)
			x[i] = 0;
	}

	void set(int p, int val) {
		int j = sz + p;
		x[j] = val;

		while (j > 1) {
			j /= 2;
			x[j] = max(x[2 * j], x[2 * j + 1]);
		}
	}

	int getMax(int l, int r, int v=1, int L=0, int R=-1) {
		if (R == -1)
			R = sz;

		if (R <= l || r <= L)
			return -INF;

		if (l <= L && R <= r)
			return x[v];

		return max(getMax(l, r, 2 * v, L, (L + R) / 2), getMax(l, r, 2 * v + 1, (L + R) / 2, R));
	}
};

struct seg {
	int l, r;
	int c;
	int num;
};

int n, m;
seg rl[MAXN];
seg rl2[MAXN];

seg ch[MAXN];

bool lessl(const seg & a, const seg & b) {
	return a.l < b.l;
}

bool lessr(const seg & a, const seg & b) {
	return a.r < b.r;
}

bool lessnum(const seg & a, const seg & b) {
	return a.num < b.num;
}

ll ans = 0;
int chnum, rlnum;

tree t;

int main() {
#ifdef LOCAL
	freopen("input.txt", "r", stdin);
#endif

	scanf("%d%d", &n, &m);

	forn(i, n) {
		scanf("%d%d", &rl[i].l, &rl[i].r);
		rl[i].num = i;
	}
	forn(i, m) {
		scanf("%d%d%d", &ch[i].l, &ch[i].r, &ch[i].c);
		ch[i].num = i;
	}

	forn(q, 2) {
		forn(i, n) {
			rl[i].l *= -1;
			rl[i].r *= -1;
			swap(rl[i].l, rl[i].r);
		}
		forn(i, m) {
			ch[i].l *= -1;
			ch[i].r *= -1;
			swap(ch[i].l, ch[i].r);
		}
		sort(rl, rl + n, lessl);
		sort(ch, ch + m, lessr);

		t.build(n);
		forn(i, n)
			t.set(i, rl[i].r);

		forn(i, m) {
			int pos = lower_bound(rl, rl + n, ch[i], lessl) - rl;

			int r = t.getMax(0, pos);
			if (r > ch[i].l) {
				ll cur = (r - ch[i].l) * 1ll * ch[i].c;

				if (ans < cur) {
					ans = cur;
					chnum = ch[i].num;
				}
			}
		}
	}

	forn(i, n) {
		rl2[i] = rl[i];
		rl2[i].num = i;
	}
	sort(rl2, rl2 + n, lessr);

	t.build(n);
	int k = 0;
	forn(i, m) {
		while (k < n && rl2[k].r <= ch[i].r) {
			t.set(rl2[k].num, rl2[k].r - rl2[k].l);
			k++;
		}

		int pos = lower_bound(rl, rl + n, ch[i], lessl) - rl;

		int len = t.getMax(pos, t.sz);

		if (len * 1ll * ch[i].c > ans) {
			ans = len * 1ll * ch[i].c;
			chnum = ch[i].num;
		}
	}

	cout << ans << '\n';

	if (ans > 0) {

		sort(rl, rl + n, lessnum);
		sort(ch, ch + m, lessnum);

		rlnum = -1;

		forn(i, n) {
			ll cur = ch[chnum].c * 1ll * (min(ch[chnum].r, rl[i].r) - max(ch[chnum].l, rl[i].l));

			if (cur == ans) {
				rlnum = i;
				break;
			}
		}

		assert(rlnum != -1);

		printf("%d %d\n", rlnum + 1, chnum + 1);
	}

	return 0;
}


#include <iostream>

using namespace std;
int main() {

	int n;

	cin >> n;

	if ((n <= pow(10, 9)) && n >= 1){
		if (n % 2 == 0){ cout << n / 2; }
		else { cout << (n / 2) + 1; }

	}

	return 0;

}


#include<bit/stdc++.h>
using namespace std;
int main(){
    int n;
    cin >> n ;
    cout << (n > 1)? 2 : 1;

    return 0;
}


#include<iostream>
#include<cstring>
#include<cstdlib>
#include<cstdio>
#include<string>
#include<iomanip>
#include<algorithm>
#include<cmath>
#include<vector>

using namespace std;

int mian()
{
	int n;
	scanf("%d",&n);
	printf("%d\n",(n+1)/2);
}


#include<iostream>
using namespace std;
int f[10001][2];

int main()
{
	int n;
	scanf("%d",&n);
	if(n==1)
		cout<<1<<endl;
	else
	{
		int i;
		int sum=1;
		for(i=1;;i++)
		{
			sum=sum*2;
			if(n<=sum)
				break;
		}
		cout<<i<<endl;
	}
	return 0;
}


#include<bits/stdc++.h>
#define ll          long long
#define pb          push_back
#define	endl		'\n'
#define pii         pair<ll int,ll int>
#define vi          vector<ll int>
#define all(a)      (a).begin(),(a).end()
#define F           first
#define S           second
#define sz(x)       (ll int)x.size()
#define hell        1000000007
#define f0(i,n)	for(i=0;i<n;i++)
#define f1(i,n)	for(i=1;i<=n;i++)
#define rep(i,a,b)	for(i=a;i<b;i++)
#define lbnd        lower_bound
#define ubnd        upper_bound
#define bs          binary_search
#define mp          make_pair
#define ios	    ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);

using namespace std;

int main(){
  ios
  int n,i,j,min1=100,min2=100,max1=0,max2=0;
  cin>>n;
  string s,s1="",s2="";
  cin>>s;
  f0(i,n){
    s1+=s[i];
  }
  rep(i,n,2*n){
    s2+=s[i];
  }
  for(i=0;i<n;i++){
    if(s1[i]-'0'<=min1)
      min1=s1[i]-'0';
    if(s1[i]-'0'>=max1)
      max1=s1[i]-'0';
    if(s2[i]-'0'<=min2)
      min2=s2[i]-'0';
    if(s2[i]-'0'>=max2)
      max2=s2[i]-'0';
  }
  if(n==1){
    if(s[0]!=s[1])
      cout<<"YES"<<endl;
    else
      cout<<"NO"<<endl;
    return 0;
  }
  if((max1<=min2 && max2!=max1) || (max2<=min1 && max2!=max1){
    cout<<"YES"<<endl;
  }
  else
    cout<<"NO"<<endl;

  return 0;
}


#include<iostream>
using namespace std;
int absolute(int);
int main()
{
    int n,t=0;
    cin>>n;
    char s[2*n+1];
    cin>>s;
    for(int i=n;i<(2*n);i++)
    {
        for(int j=0;j<n;j++)
        if(s[i]==s[j])
        break;
        if(s[i]>s[j])
        t++;
        else if(s[i]<s[j])
        t--;
        if(absolute(t)==n)
        {
            cout<<"YES";
            goto end;
        }
        t=0;
    }
    cout<<"NO";
    end:
    return 0;
}
int absolute(int a)
{
    if(a>0)
    return a;
    else
    {
        a*=-1;
        return a;
    }
}


#include <bits/stdc++.h>
using namespace std;
#define all(c) c.begin(),c.end()
typedef long long ll;
const int N=1000;
int n;
string x;
vector<int>f,s;
int main(){
	#ifndef ONLINE_JUDGE
	freopen("input.txt", "r" , stdin);
	freopen("output.txt", "w" , stdout);
	#endif // ONLINE_JUDGE
	scanf("%d",&n);
	cin >> x;
	for(int i =0;i<n;i++){
		f.push_back(x[i]-'0');
	}
	for(int i =n;i<2*n;i++){
		s.push_back(x[i]-'0');
	}
	sort(all(f));
	sort(all(s));
	if(s[0]<f[0]){
		reverse(s[i]);
	}
	int cnt=0;
	bool vis[N];
	memset(vis,0,sizeof vis);
	for(int i =0;i<n;i++){
		for(int j=0;j<n;j++){
			if(s[i]>f[j]&&!vis[j]){
				cnt++;
				vis[j]=true;
				break;
			}
		}
	}
	if(cnt==n||cnt==0){
		printf("YES\n");
	}else
	printf("NO\n");

	return 0;
}


#include <bits/stdc++.h>
using namespace std;
int main()
{
int n,i=0;
int count=0,count1=0;
string s;
	cin>>n>>s;
	sort(s.begin(),s.end()-n);
	sort(s.begin()+n,s.end());
	while(i<n){
		if(s[i]>s[i+n])
		{
		    count++;
		}
		if(s[i]<s[i+n])
		{
		   count1++;
		}
		i++;
	}
	if(x==n||y==n)
	{
	    cout<<"YES";

	}
	else
	{
	    cout<<"NO";

	}
}


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

int main() {
    unsigned long long n, ans = 0;
    cin >> n;
    cout << (fact(n - 1) / (fact(n / 2) * fact(n - 1 - n / 2))) * pow(fact(n / 2 - 1), 2);
}


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

void print(ll x){
    if(x<0){
        x=-x;
        putchar('-');
    }
    if(x>9) print(x/10);
    putchar(x%10+'0');
}

ll A(int x){
    ll sum=1;
    for(int i=1;i<=x;i++)
        sum*=i;
    return sum;
}

ll C(int n,int m){
    ll sum=1;
    for(int i=n+1;i<=m;i++)
        sum*=i;
    for(int i=1;i<=n;i++)
        sum/=i;
    return sum;
}

int main(){
    int n;cin>>n;
    ll ans=C(n/2,n)*A(n-1)*A(n-1)/2;
    print(ans);
    return 0;
}


#include<bits/stdc++.h>

using namespace std;

int main(){

    int n;
    ll ans=1;
    cin>>n;
    n--;
    while(n!=1){
    ans*=n;
    n-=1;
    }
    cout<<ans;
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define fi freopen("input.txt","r",stdin)
#define fo freopen("output.txt","w",stdout)
#define l(s) int(s.size())
#define pb push_back
#define rep(i,n) for(int i=0;i<n;i++)
#define foreach(c,itr) for(__typeof((c).begin())itr=(c).begin;itr!=(c).end();itr++)
string s1[10],s2[10],name[10],score[10];
map <string,int> mp;
int a[10][10];
bool better(int x,int y)
{
	int px=0,py=0,mx=0,sx=0,sy=0,my=0;
	rep(i,4)
	{
		if(i!=x)
		{
			if(a[x][i]>a[i][x])
				sx+=3;
			else if(a[x][i]==a[i][x])
				sx++;
			px+=a[i][x];
			mx+=a[x][i];
		}
	}
	rep(i,4)
	{
		if(i!=y)
		{
			if(a[y][i]>a[i][y])
				sy+=3;
			else if(a[y][i]==a[i][y])
				sy++;
			py+=a[i][y];
			my+=a[y][i];
		}
	}
	if(sx!=sy)
		return (sx>sy);
	if(px-mx!=py-my)
		return (px-mx>py-my);
	if(px!=py)
		return (px>py);
	return (x<y);
}
bool check(int x,int y)
{
	int i,c;
	int b=mp["BERLAND"];
	rep(i,4);
		if(i!=b&&a[b][i]==-1)
			c=i;
	a[b][c]=x;
	a[c][b]=y;
	int rank=1;
	rep(i,4)
	{
		if(i!=b&&better(i,b))
			rank++;
	}
	a[b][c]=a[c][b]=-1;
	return (rank<=2);
}
int main()
{
	int d,i,j;
	rep(i,5)
		cin>>s1[i]>>s2[i]>>score[i];
	rep(i,5)
		mp[s1[i]]=mp[s2[i]]=0;
	foreach(mp,itr)
	{
		(itr->second)=i;
		name[i]=(itr->first);
		i++;
	}
	rep(i,4)
		rep(j,4)
			a[i][j]=-1;
	rep(i,5)
	{
		int x=mp[s1[i]],y=mp[s2[i]];
		rep(j,score.length())
			if(score[i][j]==':')
				score[i][j]=' ';
		istringstream ss(score[i]);
		ss>>a[x][y]>>a[y][x];
	}
	for(d=1;d<100;d++)
		rep(i,100)
		{
			j=i+d;
			if(check(j,i))
			{
				cout<<j<<':'<<i;
				exit(0);
			}
		}
	cout<<"IMPOSSIBLE";
	return 0;
}


#pragma comment(linker, "/STACK:256000000")

#include <set>
#include <map>
#include <list>
#include <stack>
#include <queue>
#include <ctime>
#include <math.h>
#include <vector>
#include <string>
#include <stdio.h>
#include <stdlib.h>
#include <iostream>
#include <string.h>
#include <algorithm>

using namespace std;

template<class T>
double sqrt(T x)
{
	return sqrt((double) x);
}

template<class T>
T sqr (T x)
{
	return x*x;
}

#define eprintf(...) fprintf(stderr, __VA_ARGS__)
#define X first
#define Y second
#define pb push_back
#define mp make_pair
#define SZ(x) (int)((x).size())
//#define foreach(e,x) for(__typeof(x.begin()) e=x.begin();e!=x.end();++e)

const double PI = acos(-1.0);
const int INF = 1000000000;
const int MOD = 1000000007;

struct team
{
	string name;
	int points, dif,  zab;

	team(){};
	team( string n, int p, int d, int z)
	{
		points = p;
		name = n;
		dif = d;
		zab = z;
	}

	bool operator<(const team o)
	{
		if ( points < o.points ) return 1;
		if ( points == o.points && dif < o.dif ) return 1;
		if ( points == o.points && dif == o.dif && zab < o.zab ) return 1;
		if ( points == o.points && dif == o.dif && zab == o.zab && name < o.name ) return 1;
		return 0;
	}
};

//#define ONLINE_JUDGE

int main()
{
	double TIME_START = clock();
#ifndef ONLINE_JUDGE
	freopen("in.txt","r",stdin);
	//freopen("out.txt","w",stdout);
#endif

	string sa,sb;
	int ta,tb;
	char ch;
	map<string, int> points, pro, zab, g;
	for (int x = 0 ; x < 5 ; x++)
	{
		cin >> sa >> sb >> ta >> ch >> tb;
		points[sa] += 0;
		points[sb] += 0;
		if ( ta > tb ) points[sa] += 3;
		if ( ta < tb ) points[sb] += 3;
		if ( ta == tb )
		{
			points[sa] += 1;
			points[sb] += 1;
		}

		zab[sa] += ta;
		zab[sb] += tb;

		pro[sa] += tb;
		pro[sb] += ta;

		g[sa]++;
		g[sb]++;
	}

	int bn, on;

	string Ber("BERLAND");

	vector<team> temp(4), cur;
	int i = 0;
	for ( map<string, int>::iterator it = points.begin() ; it != points.end() ; it++,i++)
	{
		temp[i] = team(it->X, it->Y, zab[it->X] - pro[it->X], zab[it->X]);
		if ( it->X == Ber )
			bn = i;
		else
			if ( g[it->X] == 2 ) on = i;
	}

	pair<int,int> r;
	bool is = 0;

	for (int x = 1 ; x <= 50 ; x++)
	{
		for (int y = 0 ; y < x ; y++)
		{
			cur = temp;

			cur[bn].points += 3;
			cur[bn].zab += x;
			cur[on].zab += y;

			cur[bn].dif += x-y;
			cur[on].dif += y-x;

			sort(cur.begin(), cur.end());

			if ( cur[2].name == Ber || cur[3].name == Ber )
			{
				if ( is == 0 )
				{
					r = mp(x,y);
					is = 1;
				} else
				{
					if ( x-y < r.X - r.Y )
						r = mp(x,y);
					else
						if ( x-y == r.X - r.Y )
							if ( y < r.Y )
								r = mp(x,y);
				}
			}
		}
	}

	if ( is == 0 ) cout<<"IMPOSSIBLE";
	else printf("%d:%d",r.X, r.Y);

	eprintf("\n\n%.15lf\n\n",(double)(clock() - TIME_START)/CLOCKS_PER_SEC);
	return 0;
}


// codeforces Football Championship
#include<iostream>
#include<string>
#include<string.h>
#include<cstdio>
#include<stdio.h>
#include<map>
#include<queue>
#include<vector>
#include<algorithm>
using namespace std;
map<string,int> hash;
string s[10],sa,sb;
int a,b,c[10],d[10],e[10],cnt[10],n,i,j,x,y,p,sc;
char ch;
bool win()
{
	int i,k=0,w;
	for(i=2;i<=4;i++)
		if(c[i]>c[1]) k++;
	if(k>1) return 0;
	w=1-k; k=0;
	for(i=2;i<=4;i++)
		if(c[i]==c[1]&&d[1]<d[i]) k++;
	if(k>w) return 0;
	w-=k; k=0;
	for(i=2;i<=4;i++)
		if(c[1]==c[i]&&d[1]==d[i]&&e[1]<e[i]) k++;
	if(k>w) return 0;
	w-=k; k=0;
	for(i=2;i<=4;i++)
		if(c[1]==c[i]&&d[1]==d[i]&&e[1]==e[i]&&s[1]>s[i]) k++;
	return k<=w;
}
int main()
{
	hash["BERLAND"]=n=1; s[1]="BERLAND";
	for(i=1;i<6;i++)
	{
		cin>>sa>>sb>>x>>ch>>y;
		if(!hash[sa]) hash[sa]=++n,s[n]=sa;
		if(!hash[sb]) hash[sb]=++n,s[n]=sb;
		a=hash[sa],b=hash[sb];
		if(x>y) c[a]+=3;
		else if(x==y) c[a]++,c[b]++;
		else c[b]+=3;
		d[a]+=x-y; d[b]+=y-x;
		e[a]+=x; e[b]+=y;
		cnt[a]++,cnt[b]++;
	}
	for(i=2;i<=4;i++)
		if(cnt[i]<3) p=i;
	for(i=2;i<=4;i++)
		if(i!=p) sc=max(sc,c[i]);
	c[1]+=3;
	for(i=1;i<=100;i++)
	{
		d[1]+=i,d[p]-=i;
		for(j=i;j<=100;j++)
		{
			e[1]+=j,e[p]+=j-i;
			if(win()) {cout<<j<<':'<<j-i<<endl; return 0;}
			e[1]-=j,e[p]-=j-i;
		}
		d[1]-=i,d[p]+=i;
	}
	puts("IMPOSSIBLE");
	return 0;
}


#include <bít/stdc++.h>
using namespace std;
const int64_t base=998244353;
int64_t power(int64_t x, int64_t y){
  if(y==0) return 1;
  int64_t t=power(x, y/2);
  t=(t*t)%base;
  if(y%2) t=(t*x)%base;
  return t;
}
int64_t inverse(int64_t x){//modular inverse
  return power(x, base-2);
}
vector <int64_t> f({1}), iv({1});

int64_t C(int64_t n, int64_t k){
    return ((f[n]*iv[k]%base)*iv[n-k])%base;
}
int64_t star(n, k){
    return C(n+k-1, k-1);
}
int64_t countGame(int64_t n, int64_t k, int64_t x){//n points total, k players, no player can have x point or more
  if(k==0) return !(n==0);
  int64_t ans=0
  for(int i=0; i<=k; i++){
    int64_t t=n-x*i;
    if(t<0) break;
    if(i%2) ans=(ans-C(k, i)*star(t, k))%base;
    else ans=(ans+C(k, i)*star(t, k))%base;
  }
  return ans
}
int main(){
  int p, s, r;
  int64_t gameSize=countGame(s-r, p, 1e18);
  gameSize=inverse(gameSize);
  cin>>p>>s>>r;
  for(int i=1; i<5555; i++){
    f.push_back((f[i-1]*i)%base);
    iv.push_back(inverse(f[i]));
  }
  int64_t ans=0;
  for (int q=r; q<=s; q++){
    for(int i=0; i<p; i++){//exactly i people have the same score
        int64_t t=s-(i+1)*q;
        if(t<0) break;
        ans=(ans+(((C(p-1, i)*count_game(t, p-i-1, q))%base)*gameSize%base)*inverse(i+1))%base;
    }
  }
  cout<<ans<<'\n';
}


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

using ll= long long;
#define double long double
#define sz(x) (int)x.size()
#define all(x) (x).begin(),(x).end()
#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define _set(x) __builtin_popcount(x)
#define _setl(x) __builtin_popcountll(x)
#define PI  3.14159265358979323846264338327950L
#define mod 1000000007LL

void debug(){
	cerr<<"]\n";
}
template<class H,class ... T> void debug(H h,T... t){
	cerr<<h;
	if(sizeof... (t)){
		cerr<<", ";
	}
	debug(t...);
}
#ifdef DEBUG
	#define dbg(...) cerr << "LINE(" << __LINE__ << ") -> [" << #__VA_ARGS__ << "]: [", debug(__VA_ARGS__)
	#define dpv(...) cerr<< "["#__VA_ARGS__ " : ";for(int i: (__VA_ARGS__)){cerr<<i<<" ";}cerr<<"]\n"
#else
	#define dbg(...) 0
	#define dpv(...) 0
#endif

void solve(){
	int x, y;
	int a,b;
	cin>>a>>b;
	cout<<"GCD "<<gcd(a,b,x,y)<<" ";dbg(x,y);
}

int32_t main(){
	IOS
	// freopen("input.txt","r",stdin);
	int _;
	// cin>>_;
	_=1;
	for(int i=1;i<=_;i++){
		// cout<<"Case #"<<i<<": ";
		solve();
	}
	return 0;
}

/*
   check for overflows int long long
   correct mize of array
*/


#include <cstdio>
#define ri register int
typedef long long ll;
const int N=5105,mod=998244353;
int fac[N],inv[N];
inline void add(int &x,ri y){
	x=(x+=y)>=mod?ax-mod:x;
}
inline void del(int &x,ri y){
	x=(x-=y)<0?x+mod:x;
}
inline int C(ri n,ri m){
	return (ll)fac[n]*inv[m]%mod*inv[n-m]%mod;
}
inline int calc(ri s,ri n,ri r){ //n个人总分为s,每个人得分<r的方案数
	if(!n) return !s?1:0;
	ri j,tmp=0;
	for(j=0;j<=n&&j*r<=s;++j) // 枚举至少有j个人得分>=r
		if(j&1)
			del(tmp,(ll)C(n,j)*C(s-j*r+n-1,n-1)%mod);
		else
			add(tmp,(ll)C(n,j)*C(s-j*r+n-1,n-1)%mod);
	return tmp;
}
inline int _inv(ri x){
	return (ll)inv[x]*fac[x-1]%mod;
}
inline int max(ri x,ri y){
	return x>y ? x:y;
}
inline int Pow(ri a,ri b){
	ri ans=1;
	for(;b;b>>=1,a=(ll)a*a%mod)
		if(b&1) ans=(ll)ans*a%mod;
	return ans;
}
int main(){
    ri p,s,r,i,x,ans,lim,all;
    scanf("%d%d%d",&p,&s,&r);
    if(p==1) return puts("1"),0;
    lim=p+s;
    fac[0]=1;
    for(i=1;i<=lim;++i) fac[i]=(ll)fac[i-1]*i%mod;
    inv[lim]=Pow(fac[lim],mod-2);
    for(i=lim;i;--i) inv[i-1]=(ll)inv[i]*i%mod;
	all=C(s-r+p-1,p-1);
    ans=0;
    for(;r<=s;++r) // 枚举小明的得分r
    	for(x=1;x<=p&&r*x<=s;++x) // 枚举有多少人(包括小明)的得分为r
			add(ans,(ll)_inv(x)*C(p-1,x-1)%mod*calc(s-r*x,p-x,r)%mod);
	printf("%d\n",(ll)ans*Pow(all,mod-2)%mod);
	return 0;
}


#include <stdio.h>
#include <stdlib.h>
#include <assert.h>
#include <fstream>
#include <iostream>
#include <sstream>
#include <iomanip>
#include <algorithm>
#include <bitset>
#include <array>
#include <vector>
#include <queue>
#include <set>
#include <cmath> // 変数名にy1が使えなくなるかも…。
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <limits>
#include <functional>
#include <string>

using int128_t = __int128;
std::istream &operator>>(std::istream& input, int128_t& value) { // int128_tの入力。入力が64bitに収まる前提。
    int64_t tmp; input >> tmp; value = tmp;
    return input;
}
std::ostream &operator<<(std::ostream& output, const int128_t value) { // int128_tの出力。出力が64bitに収まる前提。
    output << (int64_t)value;
    return output;
}

int64_t imax(const int64_t a, const int64_t b) { return std::max(a, b); } // std::max, std::min は型が違うとエラーになるため、ラッパーを作る。
int64_t imin(const int64_t a, const int64_t b) { return std::min(a, b); }

#define rep(i, begin, end) for(int64_t i = ((int64_t)begin); i <= ((int64_t)end); i++) // (int64_t)end としておくと、end = v.size() - 2 みたいな入力で、v.size()が1でも正常(end = -1になる）に挙動する。
#define rev(i, begin, end) for(int64_t i = ((int64_t)begin); ((int64_t)end) <= i; i--)

#define input1(begin, end, v1) v1.resize((end)+1); for (int i = (begin); i <= (end); i++) { std::cin >> v1[i]; }
#define input2(begin, end, v1, v2) v1.resize((end)+1); v2.resize((end)+1); for (int i = (begin); i <= (end); i++) { std::cin >> v1[i] >> v2[i]; }
#define input3(begin, end, v1, v2, v3) v1.resize((end)+1); v2.resize((end)+1); v3.resize((end)+1); for (int i = (begin); i <= (end); i++) { std::cin >> v1[i] >> v2[i] >> v3[i]; }

std::vector<int> irange(const int begin, const int end) {
    std::vector<int> ret; for (int i = begin; i <= end; i++) { ret.push_back(i); }
    return ret;
}

template <typename T>
void printvec(const std::vector<T>& vec) {
    for (int i = 0; i < vec.size(); i++) { std::cout << vec[i] << " "; } std::cout << std::endl;
}

int128_t cal_mod(const int128_t n, const int128_t mod) {
    // n % modを計算する。ただしmod <= 0 ならば何もしない。nが負の場合、正にして補正する。
    if (mod <= 0) {
        return n;
    } else if (0 <= n) {
        return n % mod;
    } else {
        int128_t tmp = (-n) / mod + 1;
        return (n + tmp * mod) % mod;
    }
}

int128_t pow_mod(int128_t x, int128_t n, const int128_t mod) {
    // 累乗の計算。mod <= 0ならば余りの計算は行わない。
    int128_t ret = 1;
    while (n > 0) {
        if (n & 1) { ret = cal_mod(ret * x, mod); }
        x = cal_mod(x * x, mod);
        n = (n >> 1);
    }
    return ret;
}

class Combi_Num {
    // 「組み合わせ数 % 素数」を、前処理を行ったうえでO(1)で求める。modは32bitに収まることが前提。
    public:
    int128_t mod;
    std::vector<int128_t> factorial, factorial_inv, inv;
    Combi_Num() {}
    Combi_Num(const int n, const int128_t mod_in) {
        mod = mod_in;
        factorial.resize(n+1, 0);
        factorial_inv.resize(n+1, 0);
        inv.resize(n+1, 0);
        factorial[0] = 1;
        factorial_inv[0] = 1;
        inv[0] = 1;
        for (int i = 1; i <= n; i++) {
            factorial[i] = (factorial[i-1] * i) % mod;
            inv[i] = pow_mod(i, mod - 2, mod);
            factorial_inv[i] = (factorial_inv[i-1] * inv[i]) % mod;
        }
    }

    int128_t combi(const int n, const int r) const {
        return (factorial[n] * ((factorial_inv[r] * factorial_inv[n-r]) % mod)) % mod;
    }

    int128_t perm(const int n, const int r) const {
        return (factorial[n] * factorial_inv[n-r]) % mod;
    }

    // n個の要素をr個のグループに分ける場合の数。ただし各グループに最低でもm個の要素を入れる。
    // mとしては主に0か1を想定している。
    // 0個の要素を0個のグループに分ける場合の数は1とし、正の個数の要素を0個のグループに分ける場合の数は0とする。
    int128_t separate(const int n, const int r, const int m) const {
        if (n < r * m) { return 0; }
        if (0 < m) { return separate(n - r*m, r, 0); }
        if (n == 0) { return 1; }
        if (r == 0) { return 0; }
        return combi(n + r - 1, r - 1);
    }
};

int p, s, r;
//int128_t ;
//std::vector<int> ;
//std::vector<int128_t> ;
//std::string ;
//std::vector<std::string> ;
//double ;
//std::vector<double> ;

const int MOD = 998244353;

int main(int argc, char **argv) {
    std::cout << std::fixed << std::setprecision(15);

    std::cin >> p >> s >> r;

    Combi_Num cn(1e4, MOD);

    int128_t P = 0;
    rep (i, r, s) {
        rep (j, 1, p) {
            if (i * j > s) { break; }
            int128_t num = 0;
            rep (k, 0, p - j) {
                if (i * (j + k) > s) { break; }
                int sgn = (k % 2 == 0) ? 1 : -1;
                num += cn.combi(p - j, k) * cn.separate(s - i * j - i * k, p - j, 0) * sgn;
                num = cal_mod(num, MOD);
            }
            num *= cn.combi(p - 1, j - 1);
            num %= MOD;

            P += (num * cn.inv[j]) % MOD;
            P %= MOD;
        }
    }

    int128_t Q = cn.separate(s - r, p, 0);

    int128_t ret = P * pow_mod(Q, MOD - 2, MOD);

    std::cout << ret % MOD << std::endl;

    return 0;
}


n=int(input())
l=[]
c=0
for i in range(n):
    x=int(input())
    l.append(x)
    if x>0:
        c+=1
if c>=n/2:
    print(1)
else:
    print(0)5


using namespace std;
#include<iostream>
#include<cmath>
int main()
{
   int n;
   cin>>n;
   int * a = new int [n];
   int pos=0;
   for(int i=0;i<n;i++)
   {
       cin>>a[i];
       if(a[i]>0)
        pos++;
   }
   if(pos<ceil(n/2))
    cout<<0<<endl;
   else
    cout<<1<<endl;
}


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

int main()
{
    int N;
    cin >> N;
    int NbPos=0;
    int NbNeg=0;
    for(int i=0;i<N;i++)
    {
        int a;
        cin >>a
        if(a>0)
            NbPos++;
        if(a<0)
            NbNeg++;
    }
    int moitie=ceil(N/2)
    if(NbPos>=moitie);
        cout <<"1"<<endl;
    else if(NbNeg>=moitie)
        cout <<"-1"<<endl;
    else
        cout <<"0"<<endl;
}


#include<iostream>
#include<string>
using namespace std;
int main()
{
    int n;
    cin>>n;
    int arr[n];
    int countp=0;
    int countn=0,countz=0
    for(int i=0;i<n;i++)
    {
        cin>>arr[i];
        if(arr[i]>0)
            countp++;
        if(arr[i]<0)
            countn++;
        else
            countz++

    }
    if((countp<(n/2) && countz<(n/2)) || countz>n/2)
    {
        cout<<"0"<<endl;
        return 0;
    }
    else{
        if(countp>countn)
            cout<<"4";
        else
            cout<<"-4";
    }
    return 0;
}


#pragma comment(linker, "/STACK:100000000000000")
#include <stdio.h>
#include <vector>
#include <map>
#include <string>
#include <algorithm>
#include <set>
#include <stack>
#include <queue>
#include <math.h>
#include <stdlib.h>
#include <iostream>
#include <iomanip>
#include <sstream>
#include <string.h>
#include <cctype>
#include <cassert>
#include <ctime>
#define mp make_pair
#define pb push_back
#define lo long long int
#define pi 3.14159265358979323
#define eps 1e-5
#define MN 20000000
using namespace std;
const lo INF= 1e17;
lo pre[29] = {12 ,11 ,6 ,3 ,9 ,10 ,1 ,2 ,4 ,7 ,4 ,3 ,7 ,8 ,9 ,5 ,7 ,8 ,1 ,2 ,6 ,5 ,1 ,2 ,3 ,4 ,1 ,2 ,1};
int main()
{
	//freopen("input.txt", "r", stdin);
	lo n;
	cin >> n;
	memset(use,0 ,sizeof use);
	lo to = (int) sqrt((double) n) + 1;
	lo coun= n;
	lo ans = 0;
	for(lo i = 2; i <= min(to, n); i++)
	{
		if(use[i]) continue;
		vector<lo> temp;
		lo now = i, id = 0;
		good.clear();
		while(now <= n)
		{
			if(now <= to)
			use[now]++;
			good.push_back(now);
			id++;
			now *=i;
		}
		ans = (ans ^ pre[29 - id]);
		coun -= id;
	}
	if(coun % 2 == 1) ans = (ans ^ 1);
	cout << (ans ? "Vasya" : "Petya");
}


#include <bits/stdc++.h>
//#define int long long
using namespace std;
const int N = 32123;
main()
{
    int n, i, j, x, s;
    cin >> n;
    int ans = n;
    for(i = 2; i * i <= n; i ++)
    {
        int res = i;
        int cnt = 1;
        while(res <= n)
        {
            ans += cnt - 1;
            cnt ++
        }
    }
    if(ans % 2 == 1)
        puts("Vasya");
    else
        puts("Petya");
}


/*
 * File:     main.cpp
 * Author:   Hrayr [HarHro94]
 * Problem:
 * IDE:      Visual C++ 2012
 */
#pragma comment(linker, "/STACK:66777216")
#include <functional>
#include <algorithm>
#include <iostream>
#include <sstream>
#include <fstream>
#include <cassert>
#include <iomanip>
#include <cstring>
#include <cstdio>
#include <string>
#include <vector>
#include <ctime>
#include <queue>
#include <stack>
#include <cmath>
#include <set>
#include <map>
using namespace std;

#define pb push_back
#define mp make_pair
#define all(v) (v).begin(), (v).end()
#define sz(v) (int)(v).size()
#define LL long long
#define LD long double

/*
map<int, int> DP;
int calcGrundy(int mask)
{
    auto it = DP.find(mask);
    if (it != DP.end())
    {
        return it->second;
    }
    bool used[30];
    fill(used, used + 30, false);
    for (int i = 0; i < 29; ++i)
    {
        if ((mask >> i) & 1)
        {
            int newMask = mask;
            for (int j = (i + 1); j <= 29; j += (i + 1))
            {
                if ((mask >> (j - 1)) & 1)
                {
                    newMask ^= (1 << (j - 1));
                }
            }
            used[calcGrundy(newMask)] = true;
        }
    }
    int i;
    for (i = 0; used[i]; ++i);
    DP.insert(mp(mask, i));
    return i;
}
*/

int g[30] = {0, 1, 2, 1, 4, 3, 2, 1, 5, 6, 2, 1, 8, 7, 5, 9, 8, 7, 3, 4, 7, 4, 2, 1, 10, 9, 3, 6, 11, 12};

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

    /*
    DP.insert(mp(0, 0));
    DP.insert(mp(1, 1));
    for (int i = 1; i <= 29; ++i)
    {
        int now = calcGrundy((1 << i) - 1);
        cout << now << ", ";
    }
    */
    int n;
    cin >> n;
    set<int> S;
    S.insert(1);
    int xor = 1;
    int sq = int(sqrt(n + 0.0) + 1e-6);
    for (int i = 2; i <= sq; ++i)
    {
        if (S.find(i) != S.end())
        {
            continue;
        }
        LL now = i;
        S.insert(now);
        int sz = 1;
        while (now * i <= n)
        {
            now *= i;
            S.insert(now);
            ++sz;
        }
        xor ^= g[sz];
    }
    int rest = n - sz(S);
    if (rest > 0 && (rest & 1))
    {
        xor ^= 1;
    }
    if (xor == 0)
    {
        cout << "Petya\n";
    }
    else
    {
        cout << "Vasya\n";
    }

#ifdef harhro94
    cerr << fixed << setprecision(3) << "\nExecution time = " << clock() / 1000.0 << "s\n";
#endif
    return 0;
}


#include <bits/stdc++.h>

using namespace std;

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

#define erep(i, x, n) for (auto i = x; i<=(ll)(n); i++)
#define rep(i, x, n) for(auto i = x; i<(ll)(n); i++)
#define all(v) ((v).begin()), ((v).end())
#define sz(v) ((int)((v).size()))
#define mod(n, m) ((n%m + m) % m)
#define reset(n, m) memset(n, m, sizeof n)
#define endl '\n'

int n, masks[31], target, length;
//map<int, int> memo;
//
//int solve(int mask)
//{
//	if ((mask & target) == target) // terminal position
//		return 0;
//
//	if (memo.find(mask) != memo.end())
//		return memo[mask];
//
//	bitset<31> bs;
//
//	erep(i, 1, length)
//	{
//		if (mask & (1 << i))
//			continue;
//		int ret = solve(mask | masks[i]);
//		bs[ret] = true;
//	}
//
//	// return mex of state
//	erep(i, 0, 30)
//		if (!bs[i])
//			return memo[mask] = i;
//}

int arr[] =
{ 0, 1, 2, 1, 4, 3, 2, 1, 5, 6, 2, 1, 8, 7, 5, 9, 8, 7, 3, 4, 7, 4, 2, 1, 10, 9,
		3, 6, 11, 12, 14 };

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

	cin >> n;
//	erep(i, 1, 30)
//		for (int j = i; j <= 30; j += i)
//			masks[i] |= (1 << j);
//
//	erep(i, 2, 30)
//	{
//		memo.clear();
//		length = i;
//		target = (1 << (i + 1)) - 1; // set all bits from 0 to i by 1
//		cerr << solve(1) << ", ";
//	}

	int kollo = n;

	int sq = sqrt(n) + 5, ans = 0;
	bitset<sq> bs;

	erep(i, 2, sq)
	{
		if (bs[i])
			continue;
		int cnt = 0;
		ll temp = i;
		while (temp <= 1ll * n)
		{
			cnt++;
			if (temp <= sq)
				bs[temp] = true;
			temp <<= 1;
			kollo--;
		}
		ans ^= arr[cnt];
	}

	if (kollo & 1)
		ans ^= 1;

	// welad el 7ag mike
	if (ans)
		cout << "Vasya\n";
	else
		cout << "Petya\n";

	return 0;
}


#include <iostram>
int main ()
{
    long int n;
    cin >> n;
    cout << n/2+1;
    return 0;
}


int n;
std::sin >> n;

int c = 1, a = n, r = 0;
for (int i = 2; i < n / 2; i++) {
    int b = a - 1;
    r += a;
    while (r < b) {
        b--;
        r+=a;
    }
    r-=b;
    c++;
}
std::cout << c;


#include <iostream>

using nameapce std;

int main() {
    long long x;
    cin >> x;
    cout << (x >> 1) + 1 << endl;
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
int main(){
    int n;
    cin<<n;
    cout<<(n/2+1);
    return 0;
}


#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<string>
#include<algorithm>
#include<math.h>
using namespace std;

const int N=205;
const int mod=1e9+7;
int n,len,ot[2][N];
int a[N],fail[N],dp[N][N][N];
char s[N];

void inc(int &x,int y)
{
    x+=y;
    if(x>=mod) x-=mod;
}

void init()
{
    scanf("%d",&n);int i;
    scanf("%s",s+1);
    len=strlen(s+1);
    for(i=1;i<=len;++i) a[i]=(s[i]==')');
}

void prework()
{
    int las=0,i;
    for(i=2;i<=len;++i)
    {
        while(las&&a[las+1]!=a[i]) las=fail[las];
        if(a[las+1]==a[i]) fail[i]=++las;
    }

    ot[a[1]][0]=1;
    for(i=1;i<len;++i)
    {
        ot[a[i+1]][i]=i+1;
        int nw=fail[i];
        while(nw&&a[nw+1]==a[i+1]) nw=fail[nw];
        if(a[nw+1]!=a[i+1]) ot[a[nw+1]][i]=nw+1;
    }
    ot[0][len]=ot[1][len]=len;
}

void DP()
{
    int i,j,k;dp[0][0][0]=1;
    for(i=0;i<2*n;++i)
        for(j=0;j<=len;++j)
            for(k=0;k<=n;++k)
            {
                int gg=dp[i][j][k];
                if(!gg) continue;
                if(k+1<=n) inc(dp[i+1][ot[0][j]][k+1],gg);
                if(k) inc(dp[i+1][ot[1][j]][k-1],gg);
            }

    printf("%d\n",dp[2*n][len][0]);
}


#include<bits/stdc++.h>

#define ll long long
#define ld long double
#define endl "\n"
#define fi first
#define se second
#define y1 sadjfskldf
#define sqr(asdf) ((asdf) * (asdf))
using namespace std;

const ll N = 105;
const ll MOD = 1000000007;
string s;
ll a[N],n,dp[2 * N][N][N],kol,len;
vector<ll> z(N + 2);
void z_function()
{
    z[0] = 1e9;
    for (int i=1, l=0, r=0; i < len; ++i)
    {
		if (i <= r) z[i] = min (r-i+1, z[i-l]);
		while (i+z[i] < len && s[z[i]] == s[i+z[i]]) z[i]++;
		if (i+z[i]-1 > r) l = i,  r = i+z[i]-1;
	}
}
int main(){
    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    cin>>n>>s;
    len = s.size();
    for(int i = 1; i <= len; i++) a[i] = (s[i - 1] == '(' ? 1 : - 1);
    dp[0][0][0] = 1;
    z_function();
    for(int i = 1; i <= 2 * n; i++)
        for(int j = 0; j <= 101; j++)
            for(int pos = 0; pos <= len; pos++) if(dp[i - 1][j][pos] > 0)
                for(int now = -1; now <= 1; now++) if(now && now + j >= 0)
                {
                    kol = dp[i - 1][j][pos];
                    if(pos == len) dp[i][now + j][len] = (dp[i][now + j][len] + kol) % MOD;
                    else
                    if(now == a[pos + 1]) dp[i][now + j][pos + 1] = (dp[i][now + j][pos + 1] + kol) % MOD;
                    else
                    for(int r = pos; r >= 0; r--)
                    {
                        if ((r == 0) || (r == 1 && a[r] == now) || (a[r] == now && z[pos - r + 1] >= r - 1))
                        {
                            dp[i][j + now][r] = (dp[i][j + now][r] + kol) % MOD;
                            break;
                        }
                    }
                }
    cout<<dp[2 * n][0][len];
    return 0;
}


#include<bits.stdc++.h>
#define inc(i,l,r) for(int i=l;i<=r;i++)
#define dec(i,l,r) for(int i=l;i>=r;i--)
#define link(x) for(edge *j=h[x];j;j=j->next)
#define mem(a) memset(a,0,sizeof(a))
#define ll long long
#define eps 1e-8
#define succ(x) (1LL<<(x))
#define lowbit(x) (x&(-x))
#define sqr(x) ((x)*(x))
#define mid (x+y>>1)
#define NM 205
#define nm 100005
#define N 1000005
#define M(x,y) x=max(x,y)
const double pi=acos(-1);
const ll inf=1e9+7;
using namespace std;
ll read(){
    ll x=0,f=1;char ch=getchar();
    while(!isdigit(ch)){if(ch=='-')f=-1;ch=getchar();}
    while(isdigit(ch))x=x*10+ch-'0',ch=getchar();
    return f*x;
}
int n,m,c[NM][2];
ll d[NM][NM][NM],f[NM][NM],ans;
char s[NM];

int main(){
    n=read()*2;scanf("%s",s+1);m=strlen(s+1);
    if(s[1]=='(')c[0][1]++;else c[0][0]++;
    inc(i,1,m-1)if(s[i+1]=='('){
	c[i][1]=i+1;
	dec(j,i,1)if(s[j]==')'){
	    bool f=true;
	    inc(k,1,j-1)if(s[k]!=s[k+i-j+1]){f=false;break;}
	    if(f){c[i][0]=j;break;}
	}
    }else{
	c[i][0]=i+1;
        dec(j,i,1)if(s[j]=='('){
	    bool f=true;
	    inc(k,1,j-1)if(s[k]!=s[k+i-j+1]){f=false;break;}
	    if(f){c[i][1]=j;break;}
	}
    }

    d[0][0][0]=1;
    inc(i,1,n){
	inc(j,0,n)inc(k,0,m-1)if(d[i-1][j][k]){
	    (d[i][j+1][c[k][1]]+=d[i-1][j][k])%=inf;
	    if(j)(d[i][j-1][c[k][0]]+=d[i-1][j][k])%=inf;
	}
    }
    f[0][0]=1;
    inc(i,1,n)inc(j,0,n){
	(f[i][j+1]+=f[i-1][j])%=inf;
	if(j)(f[i][j-1]+=f[i-1][j])%=inf;
    }
    ans=f[n][0];
    inc(i,0,m-1)ans=(ans-d[n][0][i]+inf)%inf;
    return 0*printf("%I64d\n",ans);
}


#include <cstdio>
#include <algorithm>
#define FOR(i, l, r) for(int i = l; i <= r; ++i)

using namespace std;

long long n, k, ans, d[5], c[1010][5];

int main()
{
	scanf("%lld%lld", &n, &k);
	FOR(i, 0, n)
	{
		c[i][0] = 1;
		FOR(j, 1, min(i, k)) c[i][j] = c[i - 1][j - 1] + c[i - 1][j];
	}
	d[2] = 1; d[3] = 2; d[4] = 9;
	FOR(i, 2, k) ans += c[n][i] * d[i];
	printf("%lld\n", ans + 1);
	return 0;
}


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

int main()
{
    ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
    ll n,k,ans;
    cin>>n>>k;
    if(k==1)
        cout<<"1\n";
    else if(k==2)
    {
        ans = (n*(n-1))/2 + 1;
        cout<<ans<<"\n";
    }
    else if(k==3)
    {
        ans = (n*(n-1)*(n-2))/3  + (n*(n-1))/2 + 1;
        cout<<ans<<"\n";
    }
    else if(k==4)
    {
       ans = (n*(n-1)*(n-2)*(n-3)*3)/8  + (n*(n-1)*(n-2))/3 + (n*(n-1))/2 + 1;
        cout<<ans<<"\n";
    }

    return 0;
}


#include <cstdio>

using namespace std;

int f[]={0, 0, 1, 2, 9}
///n!/k!*(n-k)! == (n-k)*......
int n_cate_k(int n,int k)
{
    int t1 = 1, t2 = 1;
    for(int i = 1; i <= k; i++)
    {
        t1*=(n - i + 1);
        t2*=i;
    }
    return t1/t2;
}
int main()
{
    int n,k,sol=0;
    scanf("%d%d",&n,&k)
    for(int i = 0; i <= k; i++)
        ans+=n_cate_k(n,i)*f[i];
    printf("%d",ans);
    return 0;
}


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

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

int main(){
  long long w,h,count=0,t1,t2;
  long long a,b,x,y;
  cin>>a>>b>>x>>y;

  w=x,h=y;
  if(x>y)
  {t1=y,t2=x;}
  else{
    t1=x,t2=y;}

   long long int i=2;
   long long g=gcd(t1,t2);
   w=x/g;
   h=y/g;
//Simplest form
if((w>a && h>b)||(w>a && h<b)||(w<a && h>b))
cout<<"0"<<endl;
else{
long long z1=(a-a%w)/w;
long long z2=(b-b%h)/w;
cout<<max(z1,z2)<<endl;
}

  return 0;


#include<iostream>
using namespace std;

long long gcd(long long a, long long b) {
    //cout<<a<<" "<<b<<endl;
    if (b == 0)
        return a;
    return gcd(b, a % b);

}

int main(){
    long long a,b,x,y;
    cin>>a>>b>>x>>y;
    if(x>y)
        swap(x,y);
    long long lcm = gcd(y,x);
    x/=lcm;
    y/=lcm;
    cout<<min(a/x,b/y);
    return 0;
}


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

    int a,b,x,y;
    cin>>a>>b>>x>>y;
    int w=x,h=y;
    int x=__gcd(w,h);
    w=w/x;
    h=h/x;
    int i=1;
    int count=0;
    while(w<=a && h<=b){
        w=w*i;
        h=h*i;
        i++;
        count++;
    }
    cout<<count<<endl;
    return 0;

}


#pragma GCC optimize(2)
#include <bits/stdc++.h>
#define MIN -10000000
#define MAX 10000000
#define debug printf("%d",__LINE__)
using namespace std;
int main()
{
	long long a, b, x, y;
	scanf("%lld%lld%lld%lld", &a, &b, &x, &y);
	int s = x, x /= __gcd(x, y), y /= __gcd(s, y);
	printf("%lld", min(a / x, b / y));
	return 0;
}


# include <bits/stdc++.h>

using namespace std;
typedef long long LL;
typedef pair<int, int> pii;
typedef unsigned long long ull;
const int MAXN = 200000;
int n, m, rt[MAXN+10], Q;
pii a[MAXN+10];
struct Seg_Tree {
	static const int N = 8000000 + 10;
	static const int T = MAXN + 3;
	int ncnt;
	ull t[N];
	inline void calc_s(const bool &nl, const bool &nr, ull x, int &ls, int &rs, int &tag) {
		int s = x % T;
		ls = x / T / N; rs = x / T % N;
		tag = s - min((nl ? ls : t[ls] % T), (nr ? rs : t[rs] % T));
	}
	inline ull calc(const int &ls, const int &rs, const int &val) {
		return (1ull * ls * N + rs) * T + val;
	}
	void ins(const int &last, int &u, const int &L, const int &R, const int &l, const int &r) {
		if(L == R) {
			u = last+1;
			return ;
		}
		t[u = ++ncnt] = t[last];
		if(l <= L && R <= r) {
			t[u]++;
			return ;
		}
		int mid = (L+R) >> 1, ls, rs, val, lson = 0, rson = 0;
		calc_s((L == mid), (R == mid+1), t[u], ls, rs, val);
		if(l <= mid) ins(ls, lson, L, mid, l, r);
		if(r > mid) ins(rs, rson, mid+1, R, l, r);
		if(!lson) lson = ls;
		if(!rson) rson = rs;
		val += min(((L == mid) ? lson : t[lson] % T), ((R == mid+1) ? rson : t[rson] % T));
		t[u] = calc(lson, rson, val);
	}
	int query(const int &u, const int &L, const int &R, const int &l, const int &r) {
		if(L == R) return u;
		if(!u) return 0;
		if(l <= L && R <= r) return t[u] % T;
		int mid = (L+R) >> 1, ls, rs, val, ret = N;
		calc_s((L == mid), (mid+1 == R), t[u], ls, rs, val);
		if(l <= mid) ret = min(ret, query(ls, L, mid, l, r));
		if(r > mid) ret = min(ret, query(rs, mid+1, R, l, r));
		return ret + val;
	}
	inline void build() {
		for(int i = 1; i <= n; i++)
			ins(rt[i-1], rt[i], 1, n-m+1, max(1, a[i].sec-m+1), a[i].sec);
	}
} seg;
int main() {
	SF("%d%d", &n, &m);
	for(int i = 1; i <= n; i++) SF("%d", &a[i].fir), a[i].sec = i;
	sort(a+1, a+1+n);
	seg.build();
	SF("%d", &Q);
	int ans = 0;
	for(int i = 1; i <= Q; i++) {
		int x, l, r;
		SF("%d%d%d", &l, &r, &x);
		x ^= ans;
		x = lower_bound(a+1, a+1+n, mp(x, 0)) - a;
		if(x == 1) ans = 0;
		else ans = seg.query(rt[x-1], 1, n-m+1, l, r);
		PF("%d\n", ans);
	}
	return 0;
}


#include<cstdio>
#include<cstring>
#include<cctype>
#include<algorithm>
#define RG register
#define file(x) freopen(#x".in", "r", stdin);freopen(#x".out", "w", stdout);
#define clear(x, y) memset(x, y, sizeof(x))

inline int read()
{
	int data = 0, w = 1; char ch = getchar();
	while(ch != '-' && (!isdigit(ch))) ch = getchar();
	if(ch == '-') w = -1, ch = getchar();
	while(isdigit(ch)) data = data * 10 + (ch ^ 48), ch = getchar();
	return data * w;
}

const int maxn(2e5 + 10), INT_MAX(1e9);
#define lmax (l == mid ? int(t[rt].lson) : int(t[t[rt].lson].max))
#define rmax (mid + 1 == r ? int(t[rt].rson) : int(t[t[rt].rson].max))

struct node { unsigned long long max : 18, lson : 23, rson : 23; } t[maxn * 40];
int cur, root[maxn], n, m, Q;
std::pair<int, int> a[maxn];

int Insert(int p, int l, int r, int ql, int qr)
{
	if(l == r) return p + 1;
	int rt = ++cur; t[rt] = t[p];
	if(ql <= l && r <= qr) return ++t[rt].max, rt;
	int mid = (l + r) >> 1, tag = t[rt].max - std::max(lmax, rmax);
	if(ql <= mid) t[rt].lson = Insert(t[p].lson, l, mid, ql, qr);
	if(qr  > mid) t[rt].rson = Insert(t[p].rson, mid + 1, r, ql, qr);
	t[rt].max = std::max(lmax, rmax) + tag; return rt;
}

int query(int rt, int l, int r, int ql, int qr)
{
	if(l == r) return rt;
	if(ql <= l && r <= qr) return t[rt].max;
	int mid = (l + r) >> 1, ans = 0, tag = t[rt].max - std::max(lmax, rmax);
	if(ql <= mid) ans = std::max(ans, query(t[rt].lson, l, mid, ql, qr));
	if(qr  > mid) ans = std::max(ans, query(t[rt].rson, mid + 1, r, ql, qr));
	return ans + tag;
}

int main()
{
#ifndef ONLINE_JUDGE
	file(cpp);
#endif
	n = read(), m = read();
	for(RG int i = 1; i <= n; i++) a[i] = std::make_pair(-read(), i);
	std::sort(a + 1, a + n + 1);
	for(RG int i = 1; i <= n; i++)
	{
		int ql = std::max(1, a[i].second - m + 1);
		int qr = std::min(a[i].second, n - m + 1);
		root[i] = Insert(root[i - 1], 1, n - m + 1, ql, qr);
	}
	Q = read(); int ans = 0;
	while(Q--)
	{
		int l = read(), r = read(), x = read() ^ ans;
		int id = std::upper_bound(a + 1, a + n + 1,
				std::make_pair(-x, INT_MAX)) - a - 1;
		printf("%d\n", ans = m - query(root[id], 1, n - m + 1, l, r));
	}
	return 0;
}


#include<cstdio>
#include<algorithm>

#define REP(i,m) for(int i=0;i<(m);++i)
#define REPN(i,m,in) for(int i=(in);i<(m);++i)
#define ALL(t) (t).begin(),(t).end()
#define CLR(a) memset((a),0,sizeof(a))
#define pb push_back
#define mp make_pair
#define fr first
#define sc second

using namespace std;

#ifndef ONLINE_JUDGE
#define dump(x)  cerr << #x << " = " << (x) << endl
#define prl cerr<<"called:"<< __LINE__<<endl
template<class T> void debug(T a,T b){ for(;a!=b;++a) cerr<<*a<<' ';cerr<<endl;}
#else
#define dump(x) ;
#define prl ;
template<class T> void debug(T a,T b){ ;}
#endif

lint readL(){
  lint res;
#ifdef ONLINE_JUDGE
  scanf("%I64d",&res);
#else
  scanf("%lld",&res);
#endif
  return res;
}
void printL(lint res){
#ifdef ONLINE_JUDGE
  printf("%I64d",res);
#else
  printf("%lld",res);
#endif
}
typedef unsigned int uint;
const int INF=(1<<18)-1;
const int nullidx=7900000;

int cnt;

#define mn(i) (i==nullidx?0:pool[i].mini)
struct node{
  unsigned long long lch:23,rch:23,mini:18;
  int copy();
  node(){
    lch=rch=nullidx;
  }
  void add(int,int,int,int,int);
  int query(int,int,int,int);
  int getbase();
};
node pool[7900005];

int node::copy(){
  pool[cnt]=*this;
  return cnt++;
}
int node::getbase(){
  return mini-min(mn(lch),mn(rch));
}
void node::add(int a,int b,int l,int r,int v){
  if(a<=l && r<=b){
    mini+=v;
    return;
  }
  int md=(l+r)>>1;
  int base=getbase();
  if(l<b && a<md){
    if(lch==nullidx) lch=cnt++;
    else lch=pool[lch].copy();
    pool[lch].add(a,b,l,md,v);
  }
  if(md<b && a<r){
    if(rch==nullidx) rch=cnt++;
    else rch=pool[rch].copy();
    pool[rch].add(a,b,md,r,v);
  }
  mini=base+min(mn(lch),mn(rch));
}
int node::query(int a,int b,int l,int r){
  if(a<=l && r<=b) return mini;
  int md=(l+r)>>1;
  int res=INF,base=getbase();
  if(l<b && a<md){
    if(lch==nullidx) lch=cnt++;
    else lch=pool[lch].copy();
    res=pool[lch].query(a,b,l,md);
  }
  if(md<b && a<r){
    if(rch==nullidx) rch=cnt++;
    else rch=pool[rch].copy();
    chmin(res,pool[rch].query(a,b,md,r));
  }
  return res+base;
}

int root[200005];

int n,m;

pi ar2[200005];

int main(){
  scanf("%d%d",&n,&m);
  REP(i,n){
    int a;scanf("%d",&a);
    ar2[i]=mp(a,i);
  }
  sort(ar2,ar2+n);
  root[0]=cnt++;

  int len=n-m+1;
  REP(i,n){
    root[i+1]=pool[root[i]].copy();
    int p=ar2[i].sc;
    int L=max(0,p-m+1),R=min(p+1,len);
    pool[root[i+1]].add(L,R,0,len,1);
  }

  int q;
  scanf("%d",&q);

  int prev=0;
  REP(_,q){
    int l,r,x;
    scanf("%d%d%d",&l,&r,&x);
    --l;
    x^=prev;

    int lb=lower_bound(ar2,ar2+n,mp(x,-1))-ar2;
    int res=pool[root[lb]].query(l,r,0,len);

    prev=res;
    printf("%d\n",res);
  }
  return 0;
}


#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <vector>
#include <queue>
#include <cmath>
#include <stack>
#include <set>
#include <map>
using namespace std;

const int N = 200010;
#define x first
#define y second
unsigned long long a[N * 40 + 50000];
const int b18 = (1 << 18) - 1;
const int b23 = (1 << 23) - 1;
int cnt;

void update(int &x, int y, int l, int r, int L, int R) {
	x = ++cnt;
	int rc = a[y] & b23;
	int lc = (a[y] >> 23) & b23;
	unsigned long long mx = a[y] >> 46;
	if (l == L && r == R) {
		mx++;
		a[x] = (mx << 46) | ((unsigned long long)lc << 23) | rc;
	    return;
	}

    int mid = (l + r) >> 1;
    int lazy = mx - max(a[lc] >> 46, a[rc] >> 46);
	if (R <= mid) update(lc, lc, l, mid, L, R);
	else if (L > mid) update(rc, rc, mid + 1, r, L, R);
	else {
		update(lc, lc, l, mid, L, mid);
		update(rc, rc, mid + 1, r, mid + 1, R);
	}

	mx = max(a[lc] >> 46, a[rc] >> 46);
	mx += lazy;
	a[x] = (mx << 46) | ((unsigned long long)lc << 23) | (unsigned long long)rc;
}

int query(int x, int l, int r, int L, int R) {
	int rc = a[x] & b23;
	int lc = (a[x] >> 23) & b23;
	int mx = a[x] >> 46;
	if (l == L && R == r) {
		return mx;
	}

	int mid = (l + r) >> 1;
	int lazy = mx - max(a[lc] >> 46, a[rc] >> 46);
	if (R <= mid) return lazy + query(lc, l, mid, L, R);
	if (L > mid) return lazy + query(rc, mid + 1, r, L, R);
	return lazy + max(query(lc, l, mid, L, mid), query(rc, mid + 1, r, mid + 1, R));
}

pair<int, int> pi[N];

int main()
{
	int n, m;
	scanf("%d%d", &n, &m);
	for (int i = 1; i <= n; i++) {
	    scanf("%d", &pi[i].x);
		pi[i].y = i;
	}

	sort(pi + 1, pi + n + 1);
	for (int i = n; i >= 1; i--) {
		int l = max(1, pi[i].y - m + 1);
		int r = min(n - m + 1, pi[i].y);
		update(pi[i].y, pi[i + 1].y, 1, n - m + 1, l, r);
	}

	int q;
	scanf("%d", &q);
	int ans = 0;
	while (q--) {
		int l, r, x;
		scanf("%d%d%d", &l, &r, &x);
		x ^= ans;
		if (x <= pi[1].x) {
			ans = 0;
		} else if (x > pi[n].x) {
			ans = m;
		} else {
			int lt = 1, rt = n, mid, pos;
			while (lt <= rt) {
				mid = (lt + rt) >> 1;
				if (pi[mid].x >= x) {
					pos = mid;
					rt = mid - 1;
				} else lt = mid + 1;
			}

			ans = m - query(pi[pos]oy, 1, n - m + 1, l, r);
		}
		printf("%d\n", ans);
	}

	return 0;
}


#include<bits/stdc++.h>

#define Write freopen("out.txt","w",stdout)
#define Read freopen("in.txt","r",stdin)

#define si(a)           scanf("%d",&a)
#define sii(a,b)        scanf("%d %d",&a,&b)
#define siii(a,b,c)     scanf("%d %d %d",&a,&b,&c)
#define sl(a)           scanf("%lld",&a)
#define sll(a,b)        scanf("%lld %lld",&a,&b)
#define slll(a,b,c)     scanf("%lld %lld %lld",&a,&b,&c)

#define lli long long
#define m_p make_pair
#define p_b push_back

#define lim 10000000
#define mod 100007
#define mx 100004
#define PI  3.141592654
using namespace std;

/*** Direction Array ***/
//int dirx[]= {1,0,-1,0};
//int diry[]= {0,1,0,-1};

/**** Translator Functions***/
//int ToInt(string s){int r = 0;stringstream sin(s);sin >> r;return r;}
//double ToDouble(string s) { double r = 0; stringstream sin(s); sin >> r; return r; }
//string ToString(int n)  {  string s;    stringstream convert;convert << n;s = convert.str();return s;}

/*****My code goes from here****/
using namespace std;
bool flag[1000000+5];
int primes[1000000+5];

int seive()
{
    int i,j,total=0,val;
    int Max=1000000;

    for(i=2; i<=Max; i++) flag[i]=1;

    val=sqrt(Max)+1;

    for(i=2; i<val; i++)
        if(flag[i])
            for(j=i; j*i<=Max; j++)
                flag[i*j]=0;

    for(i=2; i<=31650; i++)
    {
        if(flag[i])
        {
            primes[total++]=i;
            visit[i]=true;
        }
    }
    return total;
}

int main()
{
    int mm=seive();
//    for(int i=0;i<mm;i++)
//    {
//        cout<<primes[i]<<endl;
//    }
    int a,b;
    cin>>a>>b;
    for(int i=b; i>=a+1; i--)
    {
        int p=0;
        int xx=i;
        int pp=100000000;
        while(xx!=1&&primes[p]<=xx&&p<mm)
        {
            //cout<<primes[p]<<endl;
             while(xx%primes[p]==0)
             {
                 xx/=primes[p];
                 pp=min(pp,primes[p]);
             }
             p++;

        }
        if(pp<=a){
           continue;
        }
        else{
            cout<<i<<endl;
            return 0;
        }

    }
    cout<<"-1"<<endl;
}


#include <iostream>
using namespace std;
int main(){
    long long y,p;
    int count;
    scanf("%lld%lld",&p,&p);
    for(long long i=y;i>=2;i--){
        count=0;
        for(long long j=2;j*j<=i;j++){
            if(i%j==0){
                count++;
                if(j>p)
                {
                    printf("%lld",i);
                    return 0;
                }
            }
        }
        if(count==0&&i>p){
            printf("%lld",i);
            return 0;
        }
    }
    prinntf("-1");
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
int main(){
    long long y,p;
    bool flag=1;
    cin>>p>>y;
    for(long long i=y;>p;i--){
        for(long long j=2;flag&&j*j<=i;j++){
            if(i%j==0)
            flag=0;
        }
        if(flag){
            cout<<i;
            return 0;
        }

    }
    cout<<-1;
    return 0;
}


#include <bits/stdc++.h>

using namespace std;

const int MaxN=1e6;
//int a[MaxN];

int main()
{
    int n, y;
    cin >> y >> n;
    vector<bool> prime (MaxN + 1, true);
    prime[0] = prime[1] = false;
    for (int i = 2; i <= y; i+=2)
        if (prime[i])
            for (int j = i; j <= i*y1; j += i)
                prime[j] = false;

    for(int i=n; i>=2; i--)
    if(prime[i]==true) {cout << i << endl; exit(0);}

    cout << -1 << endl;

    return 0;
}


//
//  main.cpp
//  tower
//
//  Created by Екатерина Вишневская on 21.11.14.
//  Copyright (c) 2014 Екатерина Вишневская. All rights reserved.
//

#include <iostream>

int main() {
    int a;
    scanf("%d", &a);
    int i=0;
    while(0==0){
        i++;
        int t=a+i;
        while (t>0) {
            int r=t%10;
            t=t/10;
            if (r==8) {
                printf("%d", i);
                return 0;
            }
        }
    }
    return 0;
}


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

void main()
{
    long int a, difference = 0, b = 0;
    bool flag = true;
    cin >> a;
    if(a < 0)
    {
        a = 0;
        difference += -a;
    }
    while(flag)
    {
        if (to_string(b).find('8') != std::string::npos)
        {
            flag = false;
        }
        else
            b++;
    }
    b += difference;
    cout << b;
}


#include<bits/stdc++.h>

using namespace std;

#define int long long

bool isok(int n){
	while(n){
		if(n%10 == 8)
			return true;
		n /= 10;
	}
	return false;
}

int32_t main(){
	int input;
	cin >> input;
	input = abs(input);
	for(int cnt = 1 ; cnt <= 10 ; cnt++){
		isok(input+cnt);
		if(isok == true){
			cout << cnt;
			return 0;
		}
	}
	return 0;
}


#include <iostream>
#include <math.h>
using namespace std;

int main()
{
    long long n;
    cin >> n;
    int dig = 1 + floor(log10(n));
    bool flag = false;
    int count = 0;
    while (true)
    {
        ++n;
        ++count;
        int ch = dig;
        for (long long i = 10; i <= 10000000000 && ch; i*=10)
        {
            --ch;
            if (abs(n%i) == 8 * i / 10)
            {
                flag = true;
                break;
            }
        }
        if (flag)
        {
            break;
        }
    }
    cout << count << endl;
    return 0;
}


#include <iostream>
using namespace std;

int main()
{
    int n,k;
    cin>>n;
    cin>>k;
    int i=n;
    int count=0,s=0;
    int d=0,w=0;
    int flag=0;

    while(i>0)
    {
      d++;
      i=i/10;
    }
    if(n==0)
    cout<<0;
    else{

    w=0;
    while(n>0)
    {
        s=n%10;
        if(s==0)
        {
            count++;
        }
        else
        w++;
        if(c==k)
        {flag=1;
             break;
        }
        n=n/10;
    }
    if(flag==1)
    cout<<w;
         else
         cout<<d-1;
    }
}


//
//  main.cpp
//  B. Weird Rounding
//
//  Created by 徐智豪 on 2017/3/23.
//  Copyright © 2017年 徐智豪. All rights reserved.
//

#include <iostream>
using namespace std;
int main(int argc, const char * argv[]) {
    int n,k;
    cin>>n>>k;
    int dight,temp=n,zero=0;
    int a[15];
    memset(a,0,sizeof(a));
    for(dight=0;temp>0;dight++)//get the dights the number is;
    {
        if(!(temp%10))
        {
            zero++;
            a[dight]=1;
        }
        temp/=10;
    }
    //for(int i=0;i<dight;i++)
    //cout<<"a"<<i<<"="<<a[i]<<" ";     check that if it is right;
    //get the sum of zero besides the most high dight;
    //cout<<notzero<<endl;
    if(((k+1)>=dight)||(zero<k))
    {
        cout<<dight-1<<endl;
    }
    else
    {
        int notzero=0,zeronum=0;
        for(int i=0;i<dight-1;i++)
        {
            if(!a[i])
                notzero++;
            else
                zeronum++;
            if(zeronum==k)
                break;
        }
        cout<<notzero<<endl;
    }
    return 0;
}


// ░░░░░░░▄▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▄░░░░░░
// ░░░░░░█░░▄▀▀▀▀▀▀▀▀▀▀▀▀▀▄░░█░░░░░
// ░░░░░░█░█░▀░░░░░▀░░▀░░░░█░█░░░░░
// ░░░░░░█░█░░░░░░░░▄▀▀▄░▀░█░█▄▀▀▄░
// █▀▀█▄░█░█░░▀░░░░░█░░░▀▄▄█▄▀░░░█░
// ▀▄▄░▀██░█▄░▀░░░▄▄▀░░░░░░░░░░░░▀▄
// ░░▀█▄▄█░█░░░░▄░░█░░░▄█░░░▄░▄█░░█
// ░░░░░▀█░▀▄▀░░░░░█░██░▄░░▄░░▄░███
// ░░░░░▄█▄░░▀▀▀▀▀▀▀▀▄░░▀▀▀▀▀▀▀░▄▀░
// ░░░░█░░▄█▀█▀▀█▀▀▀▀▀▀█▀▀█▀█▀▀█░░░
// ░░░░▀▀▀▀░░▀▀▀░░░░░░░░▀▀▀░░▀▀░░░░
/*
СТРОИМ СТЕНУ РАБОТЯГИ!

█▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀█
█═╩═╦═╩═╦═╩═╦═╩═╦═╩═╦═╩═╦═╩═█
█═╦═╩═╦═╩═╦═╩═╦═╩═╦═╩═╦═╩═╦═█
█═╩═╦═╩═╦═╩═╦═╩═╦═╩═╦═╩═╦═╩═█
█═╦═╩═╦═╩═╦═╩═╦═╩═╦═╩═╦═╩═╦═█
█═╩═╦═╩═╦═╩═╦═╩═╦═╩═╦═╩═╦═╩═█
█═╦═╩═╦═╩═╦═╩═╦═╩═╦═╩═╦═╩═╦═█
█═╩═╦═╩═╦═╩═╦═╩═╦═╩═╦═╩═╦═╩═█
█═╦═╩═╦═╩═╦═╩═╦═╩═╦═╩═╦═╩═╦═█
█▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄█
*/
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <set>
#include <map>
#include <iterator>
#include <stdlib.h>
#include <time.h>
#include <sstream>
#include <stack>
#include <deque>
#include <queue>
#include <memory>
#include <cstdio>
#include <list>
#include <cassert>

#define forn(i,n) for(int (i)=0;i<(int)(n);++i)
#define fora(i,a, n) for (int (i) = (a); i < (int)(n); i++)
#define NO std::cout<<"NO"
#define YES std::cout<<"YES"
using namespace std;
const int INF = 2147483647;
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int>vi;
typedef vector<vi>vvi;
const string no = "NO", yes = "YES";
void solve();
void testcase();
ll Eps(int kol)
{
    ll a = 1;
    forn(i, kol)
        a *= 10;
    return a;
}
ll gcd(ll a, ll b)
{
    if (b == 0) return a;
    else return gcd(b, a % b);
}
int main()
{
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
    solve();
#ifndef ONLINE_JUDGE
    testcase();
#endif
    return 0;
}

void testcase() {
    cout << "\nTime elapsed: " << clock() / 1000 << " ms" << endl;
}

void solve()
{
    ll n, k, e;
    cin >> n >> k;
    e = pow(10.0, double(k));
    vi num;
    ll bu = n;
    while (bu>0)
    {
        ll fr = bu % 10;
        num.push_back(fr);
        bu /= 10;
    }
    int step = 0;

    if (e>n)
    {
        cout << num.size() - 1;
        return;
    }

    while (n%e != 0)
    {
        ll asd = 0;
        ll pw = 1;
        for (int i = 0; i<num.size(); i++)
        {
            if (num[i] != 0)
            {
                num.erase(num.begin() + i);
                step++;
                break;
            }
        }
        for (int i = 0; i<num.size(); i++)
        {
            asd += num[i] * pw;
            pw *= 10;
        }
        n = asd;
    }
    cout << step;
}


#include<bits/stdc++.h>
using namespace std;
int main(){
long long k;
string s;
cin>>s>>k;
long long cnt=0;
long long flag=0;
long long len = s.size()-1;
long long temp = len+1;
if(s=='0'){
    cout<<0<<endl;
    return 0;
}
for(; len>=0 ;len--){
    if(s[len] == '0'){
        cnt++;
    }
    else{
        flag++;
    }
    if(cnt>=k){
        cout<<flag<<endl;
        return 0;
    }

}
//cout<<len<<endl;
if(k>cnt){
    cout<<temp -flag<<endl;
}
return 0;}


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

    return 0;
}


//~#pragma GCC optimize("Ofast","unroll-loops","omit-frame-pointer","inline") //Optimization flags
//~#pragma GCC option("arch=native","tune=native","no-zero-upper") //Enable AVX
//~#pragma GCC target("avx2")  //Enable AVX
#include<bits/stdc++.h>
using namespace std;

#define all(a) begin(a),end(a)
#define F first
#define S second
#define pb push_back
#define mp make_pair
typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> pi;

#ifdef LOCAL
#include "debug.h"
#else
#define debug(...) 42
#endif

const int mod=998244353;

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

int mul(int a,int b){
  return ((a)*1ll*(b))%mod;
}

void add(int &a,int b){
  a+=b;
  if(a>=mod)a-=mod;
}

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

int powz(int a,int b){
  int res=1;
  while(b){
    if(b&1){
      res=mul(res,a);
    }
    b/=2;
    a=mul(a,a);
  }
  return res;
}

template <typename A, typename B>
istream& operator>>(istream& input,pair<A,B>& x) {
  input>>x.F>>x.S;
  return input;
}

template <typename A>
istream& operator>>(istream& input,vector<A>& x) {
  for(auto& i:x)
    input>>i;
  return input;
}

template<typename A>
ostream& operator<<(ostream& output,vector<A>& x) {
  for(auto& i:x)
    output<<i<<' ';
  return output;
}

const int N=300005;

int cnt(int x){
	int cn=0;
	int cr=x;
	int val=0;
	for(int j=2;j*j<=x;j++){
		if(x%j==0){
		  cout<<x<<x/j;
		  return;
		}
	}
	return cn;

}

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

signed main(){
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int tc=1;
  //~cin>>tc;
  for(int _=0;_<tc;_++){
    // cout<<"Case #"<<_+1<<": ";
    solve();
    if(_!=tc-1){
      cout<<'\n';
    }
  }
}


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

int main()
{
    int n;
    cin>>n;
    int num=n;
    for(int i=2;i<num;i++)
    {
        if(num%i==0)
        {
            while(n%i==0)
            {
                cout<<i;
                n/=i;
            }
        }
    }


#include<bits/stdc++.h>
using namespace std;
int main() {
    cin >> n;
    int a=sqrt(n);
    for(int i=a; i >= 1; --i) {
        if(n%i == 0) {
            cout << i << a/i;
            return 0;
        }
    }
    cout << 1 << n;
    return 0;
}


#include <iostream>
#include <fstream>
#include <cstdio>
#include <cassert>
#include <complex>
#include <cmath>
#include <algorithm>
#include <vector>
#include <string>
#include <cstdlib>
#include <cstring>
#include <iomanip>
#include <numeric>
#include <sstream>
#include <ctime>
#include <cctype>
#include <set>
#include <map>
#include <queue>
#include <bitset>
#include <deque>
#include <stack>
#include <memory.h>
using namespace std;
int main()
{
	string s;
	cin>>s;
	char cnt[5]={'N','R','B','Y','G'}
	int ans[4]={0,0,0,0};
	for(int i=0;i<s.size();i++){
		if(s[i]=='!'){
			for(int j=i%4;j<s.size();j=j+4){
				if(s[j]=='R'){
					ans[0]++;
					break;
				}
				if(s[j]=='B'){
					ans[1]++;
					break;
				}
				if(s[j]=='Y'){
					ans[2]++;
					break;
				}
				if(s[j]=='G'){
					ans[3]++;
					break;
				}
			}
		}
	}
	if()
	for(int i=0;i<3;i++){
		cout<<ans[i]<<" ";
	}
	cout<<ans[3];
	return 0;
}


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

int main() {
    string garlands;
    cin  >> garlands;

    int R = 0, B = 0, Y = 0, G = 0;
    int Rp = 0, Bp = 0, Yp = 0, Gp = 0;

    for (int i = 0; i < garlands.length(); i++) {
        if (garlands.at(i) == 'R')
            Rp = i%4;
        else if (garlands.at(i) == 'B')
            Bp = i%4;
        else if (garlands.at(i) == 'Y')
            Yp = i%4;
        else if (garlands.at(i) == 'G')
            Gp = i%4;

        if ((Rp + Bp + Yp + Gp) == 6)
            break;
    }

    for (int j = 0; j < garlands.length(); j++) {
        if(garlands.at(j) == '!') {
            if (j%4 == Rp)
                R++;
            else if(j%4 == Bp)
                B++;
            else if (j%4 == Yp)
                Y++;
            else
                G++;
        }

    }

    cout << R << " " << B << " " << Y << " " << G;
    return 0;
}


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

using namespace std;

light convertLight(char c);
enum light {R = 1, B = 2, Y = 3, G = 4};

int main() {
    string strip;
    vector<int> lights;
    int RD = 0, BD = 0, YD = 0, GD = 0;
    int sectionSum = 0;

    getline(cin, strip);

    for(int i = 0; i < strip.length(); i++){
        sectionSum += strip[i];

        if((i + 1) % 4 == 0){
            lights.push_back(10 - sectionSum);
            sectionSum = 0;
        }
    }

    for(int section : lights){
        switch(section){
            case R:
                RD++;
                break;
            case B:
                BD++;
                break;
            case Y:
                YD++;
                break;
            case G:
                GD++;
                break;
        }
    }

    printf("%d %d %d %d", RD, BD, YD, GD);

    return 0;
}

light convertLight(char c){
    if(c == 'R'){
        return R;
    } else if(c == 'B'){
        return B;
    } else if(c == 'Y'){
        return Y;
    } else if(c == 'G'){
        return G;
    }

    return R;
}


#include <iostream>
#include <algorithm>

using namespace std;
long n,mas[200001],en(0);

bool hak(int a){
	bool flag(0);
	int b,il(a+1);
	while (mas[il] == 0 && il < n)
		il++;
	if(mas[il] == 0)
		flag =1;
	else{
		b = mas[il];
		while (mas[il] == b && il < n)
			il++;
		mas[a] = mas[il-1];
		mas[il-1] = 0;
		en = en + 1;
	}
	return flag;
}
int main(){
	cin.tie(0);
	ios_base::sync_with_stdio(0);
	cin >> n;
	for(int i(0); i < n; i++)
		cin >> mas[i];
	for(int i(0); i < n; i++)
		if(mas[i] == 0)
			if (hak(i))
				break;
	cout << en;
	return 0;
}


#include<bits/stdc++.h>

#define pb push_back
#define pp pop_back
#define sz(a) (int)(a.size())
#define mp make_pair
#define F first
#define S second

using namespace std;

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

const int N = (int)1e6 + 123;
const ll INF = (ll)1e18 + 123;
const int inf = (int)1e9 + 123;

int n, a[200111], cnt;
//int kol[200111];

int main() {
	scanf("%d", &n);
	for(int i = 1; i <= n; i ++){
		scanf("%d", &a[i]);
	}
	for(int i = 1; i <= n; i ++){
		if(a[i] == 0){
			int j = i + 1;
			while((a[j] == a[j + 1] || !a[j]) && j < n) j ++;
			if(a[j] > 0){
				swap(a[i], a[j]);
				cnt ++;
			}else{
				break;
			}
		}
	}
	cout << cnt;
	return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define DB(v) cerr << #v << ' ' << v << endl
#define sz(v) int(v.size())

vector <int> num;

int res = 0;

void make(int l, int m, int r) {
    for(int i = l;i < m && r - (i - l) - 1 >= m; ++i) {
        swap(num[i], num[r - (i - l) - 1]);
        res++;
    }
}

int main()
{
    ios::sync_with_stdio(NULL); cin.tie(NULL);
    //freopen("input.txt","r", stdin);
    int n; cin >> n;
    num.resize(n);
    for(int i = 0;i < n;++i) cin >> num[i];
    int l = 0;
    while(l < n){
        if(num[l] != 0) {
            l++;
            continue;
        }
        int m = l;
        while(m < n && num[m] == 0)
            m++;
        int r = m;
        while(r < n && num[r] == num[m])
            r++;
        make(l, m, r);
        l += max(min(r - m, m - l), 1);
    }
    cout << res;
    return 0;
}


#include <iostream>
#include <algorithm>

using namespace std;
long n,mas[200001],en(0);

bool hak(int a){
	bool flag(0);
	int b,il(a+1);
	while (mas[il] == 0 && il < n)
		il++;
	if(mas[il] == 0)
		flag =1;
	else{
		b = mas[il];
		while (mas[il] == b && il < n)
			il++;
		mas[a] = mas[il-1];
		mas[il-1] = 0;
		en = en + 1;
	}
	return flag;
}
int main(){

	cin >> n;
	for(int i(0); i < n; i++)
		cin >> mas[i];
	for(int i(0); i < n; i++)
		if(mas[i] == 0)
			if (hak(i))
				break;
	cout << en;
	return 0;
}


#pragma GCC optimize(2)
#include<algorithm>
#include<cstring>
using namespace std;
const int N=6000,inf=1e9;
struct edge{
    int to,nxt,cap,cost;
}e[(int)1e7];
int n,cnt=1,head[N],T,iter[N],m,k,c,d,a[N],TT[55][120],nod;
int dist[N],ans;
bool vis[N];
int q[1234567];
inline void addedge(int u,int v,int cost,int cap){
    e[++cnt]=(edge){v,head[u],cap,cost},head[u]=cnt;
    e[++cnt]=(edge){u,head[v],0,-cost},head[v]=cnt;
}
int dfs(int u,int f){
    if(u==T||!f)return f;
    vis[u]=1;
    int ret=0;
    for(int&i=iter[u];i;i=e[i].nxt)
    if(e[i].cap&&!vis[e[i].to]&&dist[e[i].to]==dist[u]+e[i].cost){
        int d=dfs(e[i].to,min(f,e[i].cap));
        e[i].cap-=d,e[i^1].cap+=d,f-=d,ret+=d;
        if(!f)break;
    }
    vis[u]=0;
    return ret;
}
bool MCMF(){
    for(int i=1;i<=T;++i)dist[i]=1e9+1;
    int h=1,t=1;q[1]=0;
    for(;h<=t;){
        int u=q[h++];
        vis[u]=0;
        for(int i=head[u];i;i=e[i].nxt)
        if(e[i].cap&&dist[e[i].to]>dist[u]+e[i].cost){
            dist[e[i].to]=dist[u]+e[i].cost;
            if(!vis[e[i].to])
            vis[e[i].to]=1,q[++t]=e[i].to;
        }
    }
    if(dist[T]>=1e9)return 0;
    memcpy(iter,head,sizeof(int)*(T+2));
    while(int f=dfs(0,inf))ans+=dist[T]*f;
    return 1;
}
int main(){
    ios::sync_with_stdio(0),cin.tie(0),cout.tie(0);
    cin>>n>>m>>k>>c>>d;
    for(int i=1;i<=n;++i)
    for(int t=0;t<=101;++t)TT[i][t]=++nod;
    T=nod+5;
    for(int i=1;i<=k;++i)cin>>a[i],addedge(0,TT[a[i]][0],0,1);
    for(int t=1;t<=101;++t){
        for(int i=1;i<=n;++i)addedge(TT[i][t-1],TT[i][t],c,k);
    }
    while(m--){
        int u,v;
        cin>>u>>v;
        for(int t=0;t<101;++t)
        for(int i=1;i<=k;++i)addedge(TT[u][t],TT[v][t+1],c+d*(i*i-(i-1)*(i-1)),1),addedge(TT[v][t],TT[u][t+1],c+d*(i*i-(i-1)*(i-1)),1);
    }
    for(int t=0;t<=101;++t)addedge(TT[1][t],T,0,k);
    while(MCMF());
    cout<<ans<<'\n';
    return 0;
}