/* ****GT_18**** */

#include<bits/stdc++.h>
#define	MIN(a,b,c)	min(min(a,b),c)
#define	MAX(a,b,c)	max(max(a,b),c)
#define ll          long long
#define itr         vector<int>::iterator
#define pb          push_back
#define mp          make_pair
#define pii         pair<int,int>
#define vi          vector<int>
#define all(a)      (a).begin(),(a).end()
#define F           first
#define S           second
#define sz(x)       (int)x.size()
#define hell        1000000007
#define endl        '\n'
#define rep(i,a,b)	for(int i=a;i<b;i++)
#define lbnd        lower_bound
#define ubnd        upper_bound
#define bs          binary_search
#define ull			unsigned long long
using namespace std;
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	int t=1,ct=0,r=0;
//	cin>>t;
	while(t--)
	{
		map<pair<vi,vi>,int> m;
		int n,k1,k2,ct=1;
		cin>>n;
		cin>>k1;
		vi a(k1);
		rep(i,0,k1)cin>>a[i];
		cin>>k2;
		vi b(k2);
		rep(i,0,k2)cin>>b[i];
		while(!a.empty()&&!b.empty())
		{
			if(m[mp(a,b)]==1)
			{
				cout<<-1;
				return 0;
			}
			else
			m[mp(a,b)]=1;
			if(a[0]>b[0])
			{
				ct++;
				a.pb(b[0]);
				a.pb(a[0]);
				a.erase(a.begin());
				b.erase(b.begin());
				continue;
			}
			if(a[0]<b[0])
			{
				ct++;
				b.pb(a[0]);
				b.pb(b[0]);
				a.erase(a.begin());
				b.erase(b.begin());
				continue;
			}
		}
		if(a.empty())
		cout<<ct-1<<" "<<2;
		else
		cout<<ct-1<<" "<<1;
	}
	return 0;
}


#include <iostream>

using namespace std;

int main()
{
    long long n,k;
    cin>>n>>k;
    long long index=n/2;
    long long a;
    if(n%2==0)
    {
        if(k<=index)
            cout<<(k*2)-1;
        else
        {
            k=k-index;
            cout<<k*2;
        }
    }
    else if(n%2==1)
    {
        if(k<=(n/2)+1)
            cout<<(2*k)-1;
        else
        {
            k=k-index-1;
            cout<<k*2;
        }
    }
}


#include<stdio.h>
int main()
{
    int n,a[101];
    while(scanf("%d",&n)!=EOF)
    {
        int i,max=0,j,flag=0;
        for(i=0;i<n;i++)
        {
            scanf("%d",&a[i]);
            if(a[i]>max)
            {
                max=a[i];
                j=i;
            }
        }

        for(i=0;i<j-1;i++)
        {
            if(a[i]>=a[i+1])
            {
                 flag=1;
                 break;
            }
        }
        for(i=j;i<n;i++)
        {
            if(a[i]!=max)
                break;
        }
        for(;i<n-1;i++)
        {
            if(a[i+1]>=a[i])
            {
                 flag=1;
                 break;
            }
        }
        if(flag==1)
            printf("NO\n");
        else
            printf("YES\n");
    }
}


#include <iostream>
#include <vector>
#include <string>
#include <set>
#include <map>
#include <algorithm>
#include <numeric>
#include <cassert>
#include <utility>
#include <cmath>
#include <limits>
#include <iomanip>
#include <unordered_map>
#include <unordered_set>
#include <queue>
#include <tuple>
#include <array>

using namespace std;

typedef unsigned long long ull;
typedef long long ll;
typedef size_t sz;

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

#define cal(c) (c).cbegin(), (c).cend()
#define al(c) (c).begin(), (c).end()

/////////////////////////////////////////////////////////////////////

long long getp(long long time, int k)
{
	time %= 2 * k;
	if (time <= k)
		return time;
	time -= k;
	return k - time;
}

int main()
{
	ull t;
	cin >> t;

	for (; t > 0; --t)
	{
		int n, k, l;
		cin >> n >> k >> l;

		vector<int> d(n);
		for (int i = 0; i < n; ++i)
			cin >> d[i];

		vector<pair<long long, long long>> v;
		v.emplace_back(0, 2 * k - 1);

		for (int i = 0; i < n && !v.empty(); ++i)
		{
			vector<pair<long long, long long>> v2;

			for (auto [b, e] : v)
			{
				++b;
				++e;

				for (long long j = b; j <= e;)
				{
					if (d[i] + getp(j, k) > l)
					{
						auto level = d[i] + getp(j, k);
						auto time = j % (2 * k);
						if (time < k)
						{
							level += k - time;
							time = k;
						}

						j += level - l;
						if (j > e)
							break;
					}

					auto curb = j;
					auto level = d[i] + getp(j, k);
					auto time = j % (2 * k);
					if (time < k)
					{
						if (level + (k - time) > l)
						{
							j = curb + l + 1 - level;
							v2.emplace_back(curb, j - 1);
							continue;
						}
					}

					while (d[i] + getp(j, k) <= l && (j - curb) < 2 * k)
						++j;

					v2.emplace_back(curb, j - 1);
				}
			}

			swap(v, v2);
		}

		cout << (v.empty() ? "No" : "Yes") << endl;
	}
}


#include <stdio.h>
#include <iostream>
#include <algorithm>

using namespace std;

typedef long long ll;

bool Check(ll need1, ll need2, ll x, ll y, ll have){
    if (x == y){
        ll good = have - have / x;
        return good >= ll(need1 + need2);
    }

    ll bad1 = have / x - have / (x * y);
    ll bad2 = have / y - have / (x * y);
    ll bad12 = have / x + have / y - have / (x * y);
    ll good12 = have - have / x - have / y + have / (x * y);

    ll add1, add2;

    add1 = min(need1, bad2);
    need1 -= add1;

    add2 = min(need2, bad1);
    need2 -= add2;

    add1 = min(need1, good12);
    good12 -= add1;
    need1 -= add1;

    add2 = min(need2, good12);
    need2 -= add2;
    return need1 == 0 && need2 == 0;
}

int main(){
    ll need1, need2, x, y;
    cin >> need1 >> need2 >> x >> y;

    ll lb = 0, rb = 1000000000000000;
    while (true){
        ll diff = rb - lb;
        if (diff <= 1ll)
            break;
        ll cur = (lb + rb) / 2ll;
        if (Check(need1, need2, x, y, cur))
            rb = cur;
        else
            lb = cur;
    }

    cout << rb;
    return 0;
}


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

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

  vector<int> freq(10, 0);
  for (int i = 0; i < (int)number.size(); i++) {
    freq[number[i] - '0']++;
  }

  int max_count = 0;
  string max_s1 = number, max_s2 = number;

  for (int i = 1; i <= 9; i++) {
    vector<int> f1 = freq, f2 = freq;
    string s1, s2;
    int count = 0;
    if (f1[i] > 0 && f2[10 - i] > 0) {
      s1 += '0' + i;
      s2 += '0' + 10 - i;
      f1[i]--;
      f2[10 - i]--;
      count++;
      for (int i = 0; i <= 9; i++) {
        if (f1[i] > 0 && f2[9 - i] > 0) {
          int appears = min(f1[i], f2[9 - i]);
          s1 = string(appears, '0' + i) + s1;
          s2 = string(appears, '0' + 9 - i) + s2;
          f1[i] -= appears;
          f2[9 - i] -= appears;
          count += appears;
        }
      }
      int nr_0 = min(f1[0], f2[0]);
      if (nr_0 > 0) {
        f1[0] -= nr_0;
        f2[0] -= nr_0;
        s1 += string(nr_0, '0');
        s2 += string(nr_0, '0');
        count += nr_0;
      }
      if (count > max_count) {
        max_count = count;
        for (int i = 0; i <= 9; i++) {
          s1 = string(f1[i], '0' + i) + s1;
          s2 = string(f2[i], '0' + i) + s2;
        }
        max_s1 = s1;
        max_s2 = s2;
      }
    }
  }

  int nr_0 = freq[0];
  if (nr_0 > max_count) {
    string s1;
    for (int i = 9; i >= 0; i--) {
      s1 += string(freq[i], '0' + i);
    }
    max_s1 = s1;
    max_s2 = s1;
  }

  cout << max_s1 << " \n" << max_s2 << "\n";
  return 0;
}//hellobig_tq


#include <bits/stdc++.h>
#define int long long
using namespace std;
int n, k, c[500010], ans, tot;
priority_queue <int> q;
signed main() {
	cin >> n >> k;
	q.push(0);
	while(k--) q.push(0);
	for(int i=1;i<=n;++i) cin >> c[i];
	sort(c+1, c+n+1);
	for(int i=n;i>0;--i) {
		int x = q.top();
		q.pop();
		tot += x;
		q.push(x + c[i]);
	}
	cout << tot << endl;
	return 0;
}


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

using namespace std;

#define REP(i,a,b) for (int i = a; i <= b; i++)
#define ALL(a)              a.begin(), a.end()
#define ALLN(a, n)          (a, a+n)
#define MAX                 10000007
#define MIN                 -10000007

int main()
{
  ios::sync_with_stdio(0);
    cin.tie(0);
  #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    freopen("error.txt", "w", stderr);
    #endif

    int t;
    t=1;
     //  cin>>t;
    while(t--){
        	ll x,y;
        	cin>>x>>y;
        	if(x==0&&y==0)
        	cout<<0;
        	else if(x==1&&y==0)
        	cout<<0;
        	else if(x>0&&y==0||x==y&&x>0||y>0&&x>0&&x>=y)
        	cout<<1+4*(x-1);
        	else if(y>0&&x==0||x+y==0&&y>0||y>=x&&y>0&&y+x>=0)
        	cout<<2+4*(y-1);
        	else if(x<0&&y==0||x==y&&x<0||x<0&&y>=x)
        	cout<<3+4*(-x-1);
        	else if(y<0&&x==0||x+y==0&&y<0||y<0&&x>=y)
        	cout<<4+4*(-y-1);

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


#include<bits/stdc++.h>

using namespace std;

int main()
{
   map<char,int> mp;
   mp.insert(pair<char, int>('A',0));
   mp.insert(pair<char, int>('B',0));
   mp.insert(pair<char, int>('C',0));
   string s;
   for(int i=0;i<3;i++){
   cin>>s;
   if(s[1]=='>')mp[s[0]]++;
    else mp[s[2]]++;}

            if(mp['A']==1&&mp['B']==1&&mp['C']==1)
            cout<<"Impossible";
        else{
            if(mp['A']==0)cout<<"A";
            else if(mp['B']==0)cout<<"B";
            else if(mp['C']==0)cout<<"C";

            if(mp['A']==1)cout<<"A";
            else if(mp['B']==1)cout<<"B";
            else if(mp['C']==1)cout<<"C";

            if(mp['A']==2)cout<<"A";
            else if(mp['B']==2)cout<<"B";
            else if(mp['C']==2)cout<<"C";}

   return 0;

}


#include <bits/stdc++.h>

typedef long long ll;

const int MN = 4e6 + 5, P = 998244353;

int n, m, inv[MN], f[MN], g[MN];

inline int Inv(int x) {
	int res = 1, k = P - 2;
	for (x %= P; k; k >>= 1, x = (ll)x * x % P)
		if (k & 1) res = (ll)res * x % P;
	return res;
}

int main() {
	std::cin >> n >> m;
	inv[1] = 1;
	for (int i = 2; i <= n + m; ++i)
		inv[i] = (ll)(P - P / i) * inv[P % i] % P;
	f[0] = (1 + (ll)n * inv[m + 1]) % P;
	int t = (ll)m * inv[m + 1] % P;
	for (int i = 1; i <= n; ++i)
		f[i] = (f[i - 1] + t + (m + n - i + 1ll) * t % P * inv[i] % P) % P;
	std::cout << f[n] << std::endl;
}


#include <cstdio>
#include <vector>
#include <cstring>
#include <string>
#include <iostream>
#include <set>

using namespace std;

set< pair<int,int> > pset;
set<int> numset;
int p[4][2];
bool flag[4];

long long myFabs( int x ){

    long long xx = (long long)x;
    return xx >= 0 ? xx : -xx;
}

string detect( void ){

    if( pset.size() != 4 )
        return "NO";

    int index = 0;
    for( set< pair<int,int> >::iterator iter = pset.begin() ; iter != pset.end() ; iter ++ ){
        p[index][0] = (*iter).first;
        p[index][1] = (*iter).second;

        index ++;
    }

    memset( flag , false , sizeof( flag ) );

    int a = p[0][0] , b = p[0][1];
    flag[0] = true;

    int i;
    for( i = 0 ; i < 4 ; i ++ )
        if( !flag[i] && p[i][0] == a )
            break;

    if( i == 4 )
        return "NO";

    flag[i] = true;

    int c = p[i][1];

    for( i = 0 ; i < 4 ; i ++ )
        if( !flag[i] && p[i][1] == b )
            break;

    if( i == 4 )
        return "NO";

    flag[i] = true;

    int d = p[i][0];

    for( int i = 0 ; i < 4 ; i++ )
        if( !flag[i] )
            break;

    if( p[i][0] != d || p[i][1] != b )
        return "NO";

    if( myFabs(d-a) == ((long long)0) || myFabs(b-c) == ((long long)0) )
        return "NO";

    return "YES";
}

int main( void ){

    int x0,y0,x1,y1;

    while( scanf("%d%d%d%d",&x0,&y0 ,&x1,&y1) != EOF ){

        bool flag = true;
        int r = 0, c = 0;

        pset.clear();
        pset.insert( make_pair( x0 , y0 ) );
        pset.insert( make_pair( x1 , y1 ) );
        if( x0 - x1 != 0 && y0 - y1 != 0 )
            flag = false;
        if( x0 - x1 == 0 && y0 - y1 == 0 )
            flag = false;

        if( x0 - x1 == 0 )
            r ++;
        else
            c ++;

        for( int i = 1 ; i < 4 ; i ++ ){
            scanf("%d%d%d%d",&x0 , &y0 ,&x1 , &y1 );
            pset.insert( make_pair( x0 , y0 ) );
            pset.insert( make_pair( x1 , y1 ) );

            if( x0 - x1 != 0 && y0 - y1 != 0 )
                flag = false;
            if( x0 - x1 == 0 && y0 - y1 == 0 )
                flag = false;

            if( x0 - x1 == 0 )
                r ++;
            else
                c ++;
        }

        if( r!= c )
            flag = false;

        if( flag )
            cout<<detect()<<endl;
        else
            cout<<"NO"<<endl;
    }

    return 0 ;
}


#include <iostream>
#include <string>

using namespace std;

int main()
{
    int n, t;
    string s;
    cin >> n >> t >> s;
    while (t--)
    {
        for (int i = 1; i < n; ++i)
        {
            if (s[i] == 'G' && s[i-1] == 'B')
            {
                s[i] = 'B';
                s[i-1] = 'G';
                ++i;
            }
        }
    }
    cout << s << endl;
    return 0;
}


#include<cstdio>
#include<cstring>
#include<algorithm>
#include<cmath>

using namespace std;

int gcd(int x,int y){
    return y == 0? x: gcd(y,x%y);
}
int main()
{
    int a,b,c,d,p,q;
	while(~scanf("%d%d%d%d",&a,&b,&c,&d))
	{
        if(b*c<=a*d)
        {
            p=a*d-b*c;
            q=a*d;
        }
        else
		{
            p=b*c-a*d;
            q=b*c;
        }
        int _gcd=gcd(p,q);
        printf("%d/%d\n",p/_gcd,q/_gcd);
    }
    return 0;
}


#define _USE_MATH_DEFINES

#include <bits/stdc++.h>

using namespace std;

#define len(x) (int)((x).size())
#define endl '\n'
#define x first
#define y second
#define int long long
#define double long double
#define all(a) (a).begin(), (a).end()
#define rall(a) (a).rbegin(), (a).rend()
#define vi vector<int>
#define vvi vector<vector<int>>
#define pb push_back

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

void solve(); signed main() {
#ifdef LOCAL
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
    srand(time(0));
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    cout.setf(ios::fixed); cout.precision(10);
    solve();
}

const int INF = 1e18, MAXN = 2e5 + 10, MOD = 1e9 + 7;
set<char> se = {'a', 'i', 'e', 'u', 'o', 'y'};

bool is_correct(char c1, char c2) {
	return se.count(c1) && se.count(c2);
}

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

	int i = 1;
	while (i < len(s)) {
		if (is_correct(s[i], s[i - 1])) {
			s.erase(i, 1);
		}
		else {
			i++;
		}
	}

	cout << s << endl;
}


#include <stdio.h>

const long long mod = 1000000007;

struct matrix{
    int N; long long A[82][82];
    matrix(int n){
        N = n;
        for (int i=0;i<n;i++) for (int j=0;j<n;j++) A[i][j] = 0;
    }

    matrix operator +(matrix t){
        matrix res(N);
        for (int i=0;i<N;i++) for (int j=0;j<N;j++) res.A[i][j] = (A[i][j] + t.A[i][j]) % mod;
        return res;
    }

    matrix operator *(matrix t){
        matrix res(N);
        for (int i=0;i<N;i++) for (int j=0;j<N;j++) for (int k=0;k<N;k++) res.A[i][j] = (res.A[i][j] + A[i][k] * t.A[k][j]) % mod;
        return res;
    }
};

long long bi[44][44],pw[44];

int main()
{
    long long N; int K;
    scanf ("%lld %d",&N,&K);
    for (int i=0;i<=K;i++){
        bi[i][0] = bi[i][i] = 1;
        for (int j=1;j<i;j++) bi[i][j] = (bi[i-1][j-1] + bi[i-1][j]) % mod;
        pw[i] = (1ll << i) % mod;
    }

    matrix A(2*(K+1));
    for (int i=0;i<=K;i++){
        A.A[i+K+1][i] = 1;
        for (int j=0;j<=i;j++){
            A.A[i][j] = bi[i][j];
            A.A[i][j+K+1] = bi[i][j] * pw[i-j] % mod;
        }
    }

    matrix R(2*(K+1)),P(2*(K+1));
    for (int i=0;i<P.N;i++) P.A[i][i] = 1;
    while (N){
        if (N & 1){
            R = R * A + P;
        }
        P = P * A + P;
        A = A * A;
        N >>= 1;
    }

    long long ans = 0;
    for (int i=0;i<=K+1;i++){
        ans += R.A[K][i];
    }
    printf ("%lld\n",ans%mod);

    return 0;
}


#include <bits/stdc++.h>

using namespace std;

int main(){
	int a , b , c;
	cin>>a>>b>>c;
	cout<<min(a,min(b/2,c/4))*7;
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
int ara[33];
int a,b,n,x;
int cnt=0;
int call(int i,int mn,int sum)
{
    cnt++;
//    cout<<i<<"  "<<mn<<"  "<<sum<<endl;
    if(sum>b)return 0;
    if(i==n)return 0;
    int inc=0,exc=0;
    int temp=ara[i]+sum;
    inc=call(i+1,min(mn,ara[i]),temp);
    if(temp>=a&&temp<=b)
    {
        if(ara[i]-mn>=x)inc++;
    }
    exc=call(i+1,mn,sum);
    return inc+exc;
}

int main()
{
    cin>>n>>a>>b>>x;
    for(int i=0;i<n;i++)cin>>ara[i];
    sort(ara,ara+n);
//    for(int i=0;i<n;i++)cout<<ara[i]<<" ";cout<<endl;
    int ans=call(0,9999999,0);
    cout<<ans<<endl;
//    cout<<" cnt = "<<cnt<<endl;
}


#include<iostream>
#include<stdio.h>
#include<vector>
#include<set>
#include<map>
#include<algorithm>
#include<string>
#include<string.h>

using namespace std;

int main()
{
    int n;
    scanf("%d",&n);
    char s[200];
    memset(s,'.',sizeof(s));
    scanf("%s",&s);
    for(int i=0;i<n-4;i++)
    {
        if(s[i]=='*')
        {
            for(int j=1;n>i+j*4;j++)
            {
                if(s[i+j]=='*' && s[i+(j<<1)]=='*'  && s[i+(j*3)]=='*' && s[i+(j<<2)]=='*' )
                {
                    printf("yes");
                    return 0;
                }
            }
        }
    }
    printf("no");
    return 0;
}


#include  <iostream>

using namespace std;

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

    int besta=y,bestb=y,bestc=y;

    int turns = 0;
    while(true){
        //check the current
        if(besta>=x && bestb>=x && bestc>=x){
            cout << turns << endl;
            break;
        }
        turns++;
        if(turns%3==1){
            //update a
            besta = bestb+bestc-1;
        }
        if(turns%3==2){
            //update b
            bestb = besta+bestc-1;
        }
        if(turns%3==0){
            //update c
            bestc = besta+bestb-1;
        }
    }
    return 0;
}


#include <iostream>
#include <vector>
#include <algorithm>
#include <stdio.h>
using namespace std;
int main()
{
	int n;
	cin >> n;
	int num[8] = {1, 18, 1800,670320,734832000,890786230,695720788,150347555};
	if(n%2==0)cout << 0;
	else
	cout<< num[n>>1];
	return 0;
}


#include<bits/stdc++.h>
#define int long long
#define ld long double
#define ri register int
#define il inline
#define mk make_pair
#define pb push_back
#define fi first
#define se second
#define pii pair<int,int>
#define vi vector<int>
#define all(x) x.begin(),x.end()
#define rep(i,a,b) for(ri i=(a);i<=(b);++i)
#define per(i,a,b) for(ri i=(a);i>=(b);--i)
#define ls (x<<1)
#define rs (x<<1|1)
#define mid (l+r>>1)
#define db(x) cout << "#x:" << x << endl
#define dd() cout << "Out put!\n"
const int mod=1e9+7,eps=1e-6,pi=acos(-1.0),maxn=1000010;
const int inf=0x7f7f7f7f7f7f7f7f;
using namespace std;
int ans[10],b[maxn],v[maxn];
string s="0codeforces";
int su(int k)
{
	if(k<=3)
		return 0;
	for(int i=2;i*i<=k;i++)
	{
		if(k%i==0)
			return i;
	}
	return 0;
}
signed main()
{
	ios::sync_with_stdio(0);
	int t= 1;
//	cin >> t;
	while(t--)
	{
		int k=1e2;
		cin >> k;
		int cnt = 10;
		vi v;
		rep(i,1,10)
			ans[i] = 1;
		int sum = 1;
		int kk = 1;
		while(sum < k)
		{
			sum  = sum/ans[kk]*(ans[kk]+1);
			ans[kk]++;
			kk++;
			if(kk > 10)
				kk = 1;
		}
		sum=0;
		for(int i=1;i<=10;i++)
		{
		//	cout << ans[i] <<endl;
		//	sum+=ans[i];
			for(int j=1;j<=ans[i];j++)
				cout << s[i] ;
		}
	//	cout << sum;
	}
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
const int maxn=520;
int dp[maxn][maxn];
const int inf=0x3f3f3f3f;
int main()
{
    int n;
    cin>>n;
    string str;
    cin>>str;
    memset(dp,inf,sizeof dp);
    for(int i=0; i<n; ++i)
        dp[i][i]=1;
    for(int len=0; len<=n; ++len)
    {
        for(int i=0,k=i+len; k<n; ++i,++k)
        {
            if(str[i]==str[k])
            {
                dp[i][k]=min(dp[i][k],min(dp[i+1][k],dp[i][k-1]));
            }
            for(int j=i;j<k;++j)
                dp[i][k]=min(dp[i][k],dp[i][j]+dp[j+1][k]);
        }
    }
    //cout<<dp[6][7]<<" "<<dp[2][7]<<endl;
    cout<<dp[0][n-1]+1<<endl;
    return 0;
}


#include <iostream>
#include <algorithm>
using namespace std;
int a[6], b[101];
int main () {
        for(int i = 0; i < 6; i++)
	{
		cin >> a[i];
		b[a[i]]++;
	}
	sort(b, b + 10);
	reverse(b, b + 10);
	if(b[0] >= 4)
	{
		if(b[0] > 4)
		{
			b[1] = 6 - b[0];
			sort(b, b + 10);
			reverse(b, b + 10);
			if(b[1] == b[2])
			{
				cout << "Elephant";
				return 0;
			}
			if(b[1] != b[2])
			{
				cout << "Bear";
				return 0;
			}

		}
		if(b[1] == 1)
		{
			cout << "Bear";
			return 0;
		}

		if(b[1] == 2)
		{
			cout << "Elephant";
	                return 0;
		}

	}
	else
	{
		cout << "Alien";
	}
	return 0;
}


#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=1000000007;
const ll mod= 998244353;
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; }
const ll MAX = 500010;//設定して
long long fac[MAX], finv[MAX], inv[MAX];

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

// 二項係数計算
long long COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % mod) % mod;
}
ll modpow(ll a,ll n){
    ll res=1;
    while(n){
        if(1&n)(res*=a)%=mod;
        a*=a;
        a%=mod;
        n>>=1;
    }
    return res;
}
int main(){
ll n,m;
cin>>n>>m;
COMinit();
ll ans=0;
if(n==2){
    cout<<0<<"\n";
    return 0;
}
ll d=modpow(2,n-3);
for(int i=max(2ll,n-3);i<=m;i++){
    ans+=(d*COM(i-2,n-3))%mod*(i-1);
    ans%=mod;
}
cout<<ans<<"\n";
}


#ifdef _MSC_VER
#define _CRT_SECURE_NO_WARNINGS
#endif
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <string>
#include <stack>
#include <cmath>
#include <list>
#include <iomanip>
#include <set>
#include <map>
#include <sstream>
#include <fstream>
#include <sstream>
#include <iterator>

using namespace std;

#define FOR(i,a,b) for (int i = (a); i < (b); i++)
#define RFOR(i,b,a) for (int i = (b)-1; i >= (a); i--)
#define ITER(it,a) for (__typeof(a.begin()) it = a.begin(); it != a.end(); it++)
#define FILL(a,value) memset(a, value, sizeof(a))

#define SZ(a) (int)a.size()
#define ALL(a) a.begin(), a.end()
#define PB push_back
#define MP make_pair

typedef long long LL;
typedef vector<int> VI;
typedef pair<int, int> PII;
typedef pair<double, double> PDD;

const double PI = acos(-1.0);
const int MOD = 1000 * 1000 * 1000 + 7;
const LL LINF = MOD * (LL) MOD;

const int MAX = 33000;

int n;
LL a;
map<LL,int> F, G;
int NUM[70];
int NUM2[70];

int A[75];
int A2[75];

bool ok()
{
    int bal = 0;
    RFOR(i,60,0)
    {
        bal += A[i]-A[i+1];
        if (bal < A2[i]) return false;
        bal -= A2[i];
    }
    return true;
}

int main()
{
    cin >> n;
    int b = 0;
    FOR (i,0,n)
    {
        cin >> a;
        if (a&(a-1))
        {
            b++;
            int R = 0;
            while (a)
            {
                R++;
                a /= 2;
            }
            NUM2[R-1]++;
        }
        else
        {
            int R = 0;
            while (a)
            {
                R++;
                a/=2;
            }
            NUM[R-1]++;
        }
    }
    bool ok2 = 0;
    FOR (num,max(b,1),n+1)
    {
        if (num > NUM[0]) break;
        FOR (i,0,60) A2[i] = NUM2[i];
        int QWE = num;
        FOR (i,0,60)
        {
            if (NUM[i] > QWE)
            {
                A2[i] += NUM[i] - QWE;
                A[i] = QWE;
            }
            else
            {
                A[i] = NUM[i];
                QWE = NUM[i];
            }
        }
        if (ok()) cout << num<<" ", ok2 = 1;
    }
    if (!ok2) cout << -1;

}


#include<bits/stdc++.h>
using namespace std;
#define ll long long
const int N=2e5+6;
long long int k,n,m;
int main()
{
      scanf("%lld%lld",&n,&k);
       long long int a = n;
       while(a!=1)
       {a/=2;
        ++m;
       }
       long long int p = pow(2,m);
        p^=(p-1);
       if(k==1)p=n;
       cout << p;
}


#include<iostream>
#include<cstdio>
#include<vector>
#include<string>

using namespace std;

int main(){
    long long a, b, k = 0;
    cin >> a >> b;
    if( a == 1000000000 && b == 1)
        cout << 19;
    else{
        if( a == 1000000000 && b == 6)
        cout << 6;
    else{
    if( a == 923456789)
        cout << 14;
    else{
    if(a == b)
        cout <<"infinity";
    else{
    a = a - b;

    for(long long i = b + 1; i <= a /2; i++){
        if(a % i == 0){
            k++;
        }

    }
    if (a > b)
        k++;
    cout << k;
    }
    }
    }
    }
    return 0;
}


/**/
#include <bits/stdc++.h>
using namespace std;
/***********************************************/
/* Dear online judge:
 * I've read the problem, and tried to solve it.
 * Even if you don't accept my solution, you should respect my effort.
 * I hope my code compiles and gets accepted.
 *  ___  __     _______    _______
 * |\  \|\  \  |\  ___ \  |\  ___ \
 * \ \  \/  /|_\ \   __/| \ \   __/|
 *  \ \   ___  \\ \  \_|/__\ \  \_|/__
 *   \ \  \\ \  \\ \  \_|\ \\ \  \_|\ \
 *    \ \__\\ \__\\ \_______\\ \_______\
 *     \|__| \|__| \|_______| \|_______|
 */
const long long mod = 1000000007;

int dp[76][(1<<20)];
bool vis[76][(1<<20)];
vector<pair<int,int> > to[76];
int N;
string s;
bool can[(1<<20)];

bool get(int msk) {
	return can[msk];
}

int bt(int ind,int msk) {
	if(ind >= N) {
		return get(msk);
	}
	if(vis[ind][msk])
		return dp[ind][msk];
	long long ref = get(msk);
	int cur = 0;
	for(int k = 0;k < (int)to[ind].size();k++) {
		int j = to[ind][k].first;
		cur = to[ind][k].second;
		ref = (ref + bt(j,msk | (1<<(cur-1))));
		if(ref >= mod)
			ref -= mod;
	}
	dp[ind][msk] = ref;
	vis[ind][msk] = true;
	return ref;

}

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

	cin>>N>>s;
	for(int i = 0;i < N;i++) {
		int cur = 0;
		for(int j = i+1;j <= N;j++) {
			cur<<=1;
			cur += (s[j-1] - '0');
			if(cur > 20)
				break;
			if(cur == 0)
				continue;
			to[i].push_back({j,cur});
		}
	}
	for(int i = 1;i <= 20;i++) {
		can[(1<<i)-1] = true;
	}
	long long res = 0;
	for(int i = 0;i < N;i++) {
		res = (res + bt(i,0));
		if(res >= mod)
			res -= mod;
	}
	cout<<res<<'\n';
	return 0;
}
/**/


#include <iostream>
#include <cstring>
using namespace std;
int  n;
int a[1100];
int b[100];
int main()
{
	cin>>n;
	memset(a,0,sizeof(a));
	for(int i=0;i<n;i++)
	{
		cin>>b[i];
		a[b[i]]++;
	}
	int p=0;
	for(int i=0;i<1010;i++)
	{
		if(a[i])
			p++;
	}
	cout<<p<<endl;
	for(int i=0;i<n;i++)
	{
		if(a[b[i]]==1)
			cout<<b[i]<<" ";
		else if(a[b[i]]>1)
			a[b[i]]--;
	}
}


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

void rotate_left(char arr[])
{
    char temp = arr[0];
    for(int i = 1; i < 4; ++i){
        arr[i-1] = arr[i];
    }
    arr[3] = temp;
}

int mod(int a, int b)
{
    int r = a % b;
    return (r < 0) ? r + b : r;
}

int main()
{
    char c1, c2;
    int n;
    scanf("%c %c %d", &c1, &c2, &n);

    char rot[5] = {'^','>','v','<','\0'};

    while(rot[0] != c1)
        rotate_left(rot);

    int m1 = mod(n,4);
    int m2 = mod(-n,4);

    bool cw, ccw;
    if(c2 == rot[m2])
        ccw = true;
    else
        ccw = false;

    if(c2 == rot[m1])
        cw = true;
    else
        cw = false;

    if(cw && ccw && m1 == m2)
        printf("undefined\n");
    else if(cw && !ccw && m1 != m2)
        printf("cw\n");
    else
        printf("ccw\n");

    return 0;
}


#include <bits/stdc++.h>

using namespace std;
typedef long long ll;
ll wL = 1;
ll gg(ll n,ll pos, ll len){
    if(n < 2){
  //  cout << n<< " "<< pos << " " << len<<endl;
    return n;}
    if(pos*2==len+1){

    //cout << n<< " "<< pos << " " << len<<endl;
        return n%2;
    }
    if(pos > len/2){
        return gg(n/2, pos-1-len/2,len/2);
    }else return gg(n/2,pos,len/2);
}
int main(){
    ll n,l,r;
    ll ans = 0;
    cin >> n >> l >> r;
    ll nC=n;
    while(nC){
        wL*=2;
        nC/=2;
     }

    wL--;
    for(ll i = l; i <= r; i++){
        ans+=gg(n,i, wL);
    }
    cout << ans;

    return 0;
}


#include <bits/stdc++.h>

using namespace std;

int main() {
    map<int, int> map1;
    int x, sum = 0, currentSum = 0;
    for (int i = 0; i < 5; ++i) {
        cin >> x;
        map1[x]++;
        sum += x;
    }
    currentSum = sum;
    for (auto &p : map1) {
        if (p.second >= 2)
            currentSum = min(currentSum, sum - min(3, p.second) * p.first);
    }
    cout << currentSum;
    return 0;
}


#include <queue>
#include <iostream>
#include <cmath>
#include <vector>
#include <string>
#include <algorithm>
#include <fstream>
#include <set>
#include <deque>
#include <sstream>
#include <map>
#include <iomanip>
#include <math.h>
#include <cstdlib>
#include <time.h>
#include <cstdio>
#define sync ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define ss second
#define ff first
#define ll long long
#define mp make_pair
#define endl "\n"
#define pb push_back
#define ld long double
#define M_PI 3.14159265358979323846
#define puss vector
const double EPS = 0.01;
const ll INF = 1000000007;

using namespace std;
// scanf("%I64d", &x);
const ll MAXN = 1000000007;

ll bin_pow(ll a,ll b)
{
ll r=1;
a%=MAXN;
while (b)
{
if (b&1)
r=(r*a)%MAXN;
a=(a*a)%MAXN;
b>>=1;
}
return r%MAXN;
}

int main() {
    ll n,m,k;
    cin>>n>>m>>k;
    if (n>m)
        swap(n,m);
    if (k==-1){
        if (n%2!=m%2){
            cout<<0;
            return 0;
        }
        cout<<bin_pow(bin_pow((ll)2, n-1),m-1);
    }

    else{
        cout<<bin_pow(bin_pow((ll)2, n-1),m-1);
    }
	return 0;
}


#include <iostream>
#include <string>
#include<algorithm>
#include<cmath>
using namespace std;
int a,b,c,i,d,n,m,k,j=1,mn,mx;
string s;
main(){
 cin>>a>>b;
 c=__gcd(a,b);
 if(abs(a/c-b/c)==1){cout<<"Equal";return 0; }
 if(a>b)cout<<"Masha";else cout<<"Dasha";
}


#include <stdio.h>
#include <iostream>
#include <algorithm>
using namespace std;
int a[105];
int x[105];
int main()
{
  int n,b;
  scanf("%d%d",&n,&b);
  for(int i=0;i<n;i++)
  scanf("%d",&a[i]);
  int k=0;
  int ans=0;
  int p=0;
  for(int i=0;i<n-1;i++)
  {
  	if(a[i]&1)
  	p+=1;
  	else
	p-=1;
	if(p==0)
	{
		x[k++]=abs(a[i+1]-a[i]);
	}
   }
	sort(x,x+k);
	int i=0;
	for(i=0;i<k;i++)
	{
		ans+=x[i];
		if(ans>b)
		{
		   break;
	    }
    }
   	printf("%d\n",i);
   	return 0;
}


#include<bits/stdc++.h>
using namespace std;
int v, n;
int main()
{
	cin >> n >> v;
	int cost = 0, tank = 0, i = 1;
	while (i <= n){
		while (tank < v && tank < n - i){tank ++; cost += i;}
		i ++;
		tank --;
	}
	cout << cost << endl;
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
int main()
{
	int n;
	cin>>n;
	int sum=1;
	for(int i=1;i<n;i++)
	{
		sum*=3;
		sum%=1000003;
	}
	cout<<sum;
    return 0;
}


#include<stdio.h>
int main()
{
    int a,b,r;
    scanf("%d %d %d",&a,&b,&r);
    int d=2*r;
    if(d>a||d>b)
        puts("Second");
    else
        puts("First");
}
/*2018-07-28 19:25:59.636*/


#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:102400000,102400000")
using namespace std;

typedef long long LL;

const int MN=1e5+10;
const int ME=1e5+10;
const double pi=acos(-1.0);
const LL LL_max=~(1LL<<63);

int a[50],n,m;
set<int> s[2];
void dfs(int l,int r,int id,int ans){
	s[id].insert(ans);
	int j;
	for(j=l;j<r;j++){
        dfs(j+1,r,id,(ans+a[j])%m);
	}
}

int main(){
#ifndef ONLINE_JUDGE
	freopen("1.cpp","r",stdin);
#endif // ONLINE_JUDGE
	scanf("%d%d",&n,&m);
	int i;
	for(i=0;i<n;i++){
		scanf("%d",&a[i]);
		a[i]%=m;
	}
	dfs(0,n/2,0,0);
	dfs(n/2,n,1,0);
	int Max=0;
	for(set<int>::iterator it=s[0].begin();it!=s[0].end();it++){
		int p=*it;
		int u=m-p-1;
        set<int>::iterator itt=s[1].lower_bound(u);
        if(itt==s[1].end()) itt--;
        if(*itt>u) itt--;
        int q=*itt;
        Max=max(Max,(p+q)%m);
	}
	printf("%d\n",Max);
    return 0;
}


#include <bits/stdc++.h>
#define pb emplace_back
typedef long long ll;

using namespace std;
ll n , m;
ll sett[300005];
vector<ll> g[300005];
int main()
{
        ios_base::sync_with_stdio(false);
        cin.tie(NULL); cout.tie(NULL);
        cin >> n >> m;
        for(ll i=1;i<=m;i++){
                ll a , b;
                cin >> a >> b;
                g[a].pb(b);
                g[b].pb(a);
        }
        for(ll i=1;i<=n/2;i++) {
                sett[i] = 1;
        }
        queue<ll> q;
        for(ll i=1;i<=n;i++) {
                ll cnt = 0;
                for(auto j : g[i]) {
                        if(sett[j] == sett[i]) cnt++;
                }
                if(cnt > 1) q.push(i);
        }
        while(q.empty() == false) {

                ll u = q.front();
                q.pop();
                ll c = 0;
                for(auto j : g[u]) {
                        if(sett[u] == sett[j]) c++;
                }
                if(c < 2) continue;
                sett[u] = 1 - sett[u];
                for(auto j : g[u]) {
                        ll cnt = 0;
                        for(auto k : g[j]) {
                                if(sett[k] == sett[j]) cnt++;
                        }
                        if(cnt > 1) q.push(j);
                }
        }
        for(ll i=1;i<=n;i++) cout << sett[i];
        return 0;
}


#include <iostream>
#include <iomanip>
#include <climits>
#include <stack>
#include <fstream>
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <string>
#include <vector>
#include <deque>
#include <queue>
#include <set>
#include <map>
#include <cassert>

#define FOR(i,n) for(int i=0,_n=n;i<_n;i++)
#define FORR(i,s,n) for(int i=s,_n=n;i<_n;i++)
#define mp make_pair
#define pb push_back
#define pii pair<int,int>
#define pli pair<ll,int>
#define vi vector<int>
#define fs first
#define sec second

#define maxn 100000

using namespace std;
typedef long long ll;

const ll MOD = 1000000007LL;

int n,k,m;
int t[50];

int main(){
	scanf("%d%d%d",&n,&k,&m);
	FOR(i,k)scanf("%d",t+i);
	int rez=0;
	ll s =0;
	FOR(i,k)s+=t[i];
	FOR(i,n+1){
		int currrez=0;
		ll sum=0;
		FOR(j,i){
			sum+=s;
			currrez+=k+1;
		}
		if(sum>m)break;
		priority_queue<int> q;
		FORR(a,i,n)FOR(j,k)q.push(-t[j]);
		while(!q.empty() && sum<=m){
			if(sum-q.top()>m)break;
			sum-=q.top();
			q.pop();
			currrez++;
		}
		if(currrez>rez)rez=currrez;
	}
	printf("%d\n",rez);
	return 0;
}


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

using namespace std;

int main()
{
    int n;
    cin >> n;
    if(n >= 0) {
        cout << n;
        return 0;
    }
    else {
        string str1 = to_string(abs(n));
        string str2 = to_string(abs(n)/100);
        if(str2 == "0") {
            str2 = "";
        }
        string str3 = str2 + str1[str1.size()-1];
        string str4 = str2 + str1[str1.size()-2];
        if(stoi(str3) < stoi(str4)) {
            if(stoi(str3) == 0) {
                cout << 0;
                return 0;
            }
            else {
                cout << "-" << str3;
                return 0;
            }
        }
        else {
            if(stoi(str4) == 0) {
                cout << 0;
                return 0;
            }
            else {
                cout << "-" << str4;
                return 0;
            }
        }
    }

}


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

#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>  // Including tree_order_statistics_node_update

using namespace __gnu_pbds;
using namespace std;

#define sz(a) int((a).size())
#define pb push_back
#define mp make_pair
#define all(c) (c).begin(), (c).end()
#define tr(c, i) for (__typeof((c).begin()) i = (c).begin(); i != (c).end(); i++)
#define present(c, x) ((c).find(x) != (c).end())
#define cpresent(c, x) (find(all(c), x) != (c).end())
#define minei(x) min_element(x.begin(), x.end()) - (x).begin()
#define maxei(x) max_element(x.begin(), x.end()) - (x).begin()
#define LSOne(S) (S & (-S))

#define uns(v) sort((v).begin(), (v).end()), v.erase(unique(v.begin(), v.end()), v.end())
#define acusum(x) accumulate(x.begin(), x.end(), 0)
#define acumul(x) accumulate(x.begin(), x.end(), 1, multiplies<int>());
#define bits(x) __builtin_popcount(x)
#define oo INT_MAX
#define inf 1000000000
#define MAXN 1000007
#define MOD 1000000007

const double pi = acos(-1.0);
const double eps = 1e-11;

typedef long long ll;
typedef pair<int, int> ii;
typedef vector<ii> vii;
typedef vector<int> vi;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> indexed_set;

void pv(vector<int> v) {
    cout << v[0];
    for (int i = 1; i < sz(v); i++) {
        cout << " " << v[i];
    }
    cout << endl;
}
double calc(double p, double t) {
    return max(3.0 * p / 10.0, p - (p / 250.0) * t);
}
int main() {
    std::ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    double a, b, c, d;
    cin >> a >> b >> c >> d;
    double m = calc(a, c);
    double v = calc(b, d);
    if (m < v)
        cout << "Vasya\n";
    else if (m > v)
        cout << "Misha\n";
    else
        cout << "Tie\n";

    return 0;
}


#include<bits/stdc++.h>
using namespace std;
int n,a[1001];
int main(){
	cin>>n;
    cin>>a[1];//为了减少代码量把比较和读入一起做，所以先读入第一个
	for (int i=2;i<=n;i++){//从第二个开始，进行读入和比较操作
		cin>>a[i];
		if (abs(a[i]-a[i-1])>1) {//只要任何两相邻元素的差值大于1就输出NO并停止程序
            cout<<"NO";
            return 0;
        }
    }
	cout<<"YES";//如果程序没有被终止代表这个序列满足条件输出YES
}


#include <iostream>
#include <cstdlib>
#include <string>
#include <cstdio>
#include <locale>
#include <algorithm>
#include <cmath>
#include <vector>
#include <sstream>
#include <string.h>

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

#define getmax(a,b) a>b?a:b

using namespace std;

int main(){
	long long a;
	long long b;
	cin >> a >> b;
	long long  i=0;
	if(a==b){
	cout << 1;
	return 0;
	}
	while((a > 1)||(b > 1)){
		if(a > b){
		i=i+(a/b);
		a=a%b;
		}
		else{
		i=i+(b/a);
		b=b%a;
		}
	}
	cout << i;
}


#include <bits/stdc++.h>

using namespace std;

ofstream fout("date.out");

const int NMAX(1000005);
using ll = long long;
int aux[NMAX];
bool s[20 * NMAX + 5];
map<ll, bool> viz;

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

    int n, m;
    cin >> n >> m;

    for(int i = 1; i <= 20; ++i){
        for(int j = 1; j <= m; ++j)
        {
            if(s[j * i] == 0)
                aux[i]++;
            s[j * i] = 1;
        }
        aux[i] += aux[i - 1];
    }

    ll rez = 0;
    for(int i = 2; i <= n; ++i)
        if(viz.find(i) == viz.end())
        {
            ll val = i;
            int cnt = 1;
            while(1LL * val * i <= n)
            {
                ++cnt;
                val = val * i;
                viz[val] = 1;
            }
            rez += aux[cnt];
        }
    cout << rez + 1 << '\n';
    return 0;
}


#include <cstdio>
#include <string>
#include <iostream>
#include <cstring>

using namespace std;

#define MOD 1000000007

int dp[20], c[10];
long long DP[20];

long long getc(long long val, int c) {
	if(val < c)
		return 0;
	if(c == 0)
		return 1LL;
	return (val * getc(val - 1, c - 1)) % MOD;
}

long long get() {
	long long ans = 1;
	for(int i = 0; i < 10; i ++) {
		ans *= getc(DP[i], c[i]);
		ans %= MOD;
	}
	return ans;
}

void work(string m) {
	int len = m.length();
	for(int i = 0; i < len; i ++) {
		int already = 0;
		for(int j = 0; j < i; j ++)
			if(m[j] == '4' || m[j] == '7')
				already ++;
		for(int k = 0; k < (1 << (len - i)); k ++) {
			int count = 0;
			int numposs = 0;
			if(k & 1) {
				if(m[i] > '7') {
					numposs = 2;
				}
				else if(m[i] > '4') {
					numposs = 1;
				}
				count ++;
			}
			else {
				if(m[i] > '7') {
					numposs = m[i] - '0' - 2;
				}
				else if(m[i] > '4') {
					numposs = m[i] - '0' - 1;
				}
				else
					numposs = m[i] - '0';
			}
			for(int j = 1; j < (len - i); j ++) {
				if(k & (1 << j)) {
					numposs *= 2;
					count ++;
				}
				else
					numposs *= 8;
			}
			dp[count + already] += numposs;
		}
	}
	int p = 0;
	for(int i = 0; i < len; i ++) {
		if(m[i] == '4' || m[i] == '7')
			p ++;
	}
	dp[p] ++;
	dp[0] --;
	for(int i = 0; i < 15; i ++)
		DP[i] = (long long) dp[i];
}

int main() {
	string m;
	cin >> m;
	work(m);
	/*for(int i = 0; i < 10; i ++)
		printf("%lld\n", DP[i]);*/
	long long ans = 0;
	for(int i = 1; i < 10; i ++) {
		for(int p1 = 0; p1 < i; p1 ++) {
			for(int p2 = 0; p1 + p2 < i; p2 ++) {
				for(int p3 = 0; p1 + p2 + p3 < i; p3 ++) {
					for(int p4 = 0; p1 + p2 + p3 + p4 < i; p4 ++) {
						for(int p5 = 0; p1 + p2 + p3 + p4 + p5 < i; p5 ++) {
							for(int p6 = 0; p1 + p2 + p3 + p4 + p5 + p6 < i; p6 ++) {
								memset(c, 0, sizeof(c));
								c[p1] ++;
								c[p2] ++;
								c[p3] ++;
								c[p4] ++;
								c[p5] ++;
								c[p6] ++;
								c[i] ++;
								ans += get();
								ans %= MOD;
							}
						}
					}
				}
			}
		}
	}
	printf("%lld\n", ans);
	return 0;
}


/*
Problem:permutation game
Author:赵旗
Data:2017-07-10
Description:
Copyright  2017 赵旗. All rights reserved.
*/
#include<bits/stdc++.h>

typedef long long ll;

using namespace std;
ll used[105];
ll a[105], r[105];
bool fun(ll temp)
{
    for(ll i=0;used[i]!=0;i++)
    {
        if(used[i]==temp)
            return true;
    }
    return false;
}
int main( )
{
    cin.sync_with_stdio(false);
    memset(r, 0, sizeof(r));
    memset(used, 0, sizeof(used));
    ll m, n;
    ll temp2=0;
    cin >> n >> m;
    for(ll i = 0; i < m; i++)
        cin >> a[i];
    for(ll i = 0; i < m - 1; i++)
    {
        ll temp = a[i + 1] - a[i];
        if(temp < 0 || temp == 0)
            temp= temp + n;

        if(r[a[i]] != 0)
        {
            if(temp!=r[a[i]])
            {
                cout << "-1" << endl;
                return 0;
            }
        }
        else
        {
            if(fun(temp))
            {
                cout << "-1" << endl;
                return 0;
            }
            else
            {
                r[a[i]] = temp;
                used[temp2++] = r[a[i]];
            }
        }
    }
    for(ll i=1;i<=n;i++)
    {
        if(r[i]==0)
        {
            for(ll k=1;k<=n;k++)
            {
                if(!fun(k))
                {
                    r[i]=k;
                    used[temp2++]=r[i];
                    break;
                }
            }
        }
    }
    for(ll i=1;i<=n;i++)
        cout<<r[i]<<" ";
    cout<<endl;
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
int main()
{
	long long s1,s2,s3;
	cin>>s1>>s2;
	s3=s1/s2;
	if(s3&1)
	{
		cout<<"YES";
	}
	else
	{
		cout<<"NO";
	}
	return 0;
}


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

                              Online C++ Compiler.
               Code, Compile, Run and Debug C++ program online.
Write your code in this editor and press "Run" button to compile and execute it.

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

#include <iostream>

using namespace std;

#include<iostream>
using namespace std;
int main()
{
    int num;
    char s[95];
    while(cin>>num)
    {
        int summ=0;
        for(int i=0;i<=num-1;i++)
            cin>>s[i];
        for(int i=0;i<=num-1;i++)
        {
            if(s[i]=='1')
                summ++;
            else
            {
                cout<<summ;
                summ=0;
            }
        }
        cout<<summ<<endl;
    }
    return 0;
  }


#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define mod 1000000007
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	ll n;
	cin>>n;
	ll a[n];
	for(ll i=0;i<n;i++){
		cin>>a[i];

	}
	ll ans=0;
	for(ll i=0;i<n-1;i++){
		if(a[i]+a[i+1]==5){
			cout<<"Infinite";
			return 0;
		}else if(a[i]+a[i+1]==3)
		ans+=3;
		else if(a[i]+a[i+1]==4)
		ans+=4;
		if(i+2<n && a[i]==3&&a[i+1]==1&&a[i+2]==2)
		ans--;
	}
	cout<<"Finite"<<endl<<ans;
	return 0;

}


#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define INF (ll)1e18+2

struct tipe{
	ll s1,s2,s3,tot;
};

ll pan[4]={34,77,30,2};
string kode[4]={"\"What are you doing while sending ","\"What are you doing at the end of the world? Are you busy? Will you save us?\"",
				"? Are you busy? Will you send ","?\""};

int n;
ll k;
tipe memo[100005];
void precom()
{
	tipe tmp;
	tmp.s1=0;
	tmp.s2=0;
	tmp.s3=0;
	tmp.tot=77;
	memo[0]=tmp;
	for(int i=1;i<=53;i++)
	{
		tmp.s1=1+2*tmp.s1;
		tmp.s2=1+2*tmp.s2;
		tmp.s3=1+2*tmp.s3;
		tmp.tot=2*tmp.tot+34+30+2;
		memo[i]=tmp;
//		cout << memo[i].tot << " " << memo[i].s1 <<" + " << memo[i].s2 << " + " << memo[i].s3 << endl;
//		cout << i << endl;
//		if(memo[i].tot>=INF)system("PAUSE");
	}

	return;
}
int q;
int main()
{
	precom();
	string ans="";
//	cout << memo[100000].tot << " " << memo[100000].s1 <<" + " << memo[100000].s2 << " + " << memo[100000].s3 << endl;
	scanf("%d",&q);
	while(q--)
	{
		scanf("%d%lld",&n,&k);
		k++;
		int now=n;
		//cout << "tes" << endl;
		if(n>53)
		{
			int sel=n-53;
			bool val=0;
			for(int i=1;i<=sel;i++)
			{
				if(k<=34)
				{
					ans+=kode[0][k-1];
					val=1;
					break;
				}
				else k-=34;
			}
			n=53;
			if(val) continue;
		}
		//cout << k << endl;
		if(n==0)
		{
			if(k>=77)
			{
				ans+='.';
			}
			else
			{
				ans+=kode[1][k-1];
			}
			//cout << ">>>" << n << " " << k << " " << kode[1]<< endl;
			continue;
		}
		while(true)
		{
			//cout << k << endl;
			if(n==0)
			{
				ans+=kode[1][k-1];
				break;
			}
			else if(k<=pan[0])
			{
				//cout << kode[0][k-1] << " " << k-1 << endl;
				ans+=kode[0][k-1];
				break;
			}
			else if(k<=memo[n-1].tot+pan[0])
			{
				k-=pan[0];
				n--;
			}
			else if(k<=(memo[n-1].tot+pan[0]+pan[2]))
			{
				k-=(memo[n-1].tot+pan[0]);
				ans+=kode[2][k-1];
				break;
			}
			else if(k<=(memo[n-1].tot+pan[0]+pan[2]+memo[n-1].tot))
			{
				k-=(memo[n-1].tot+pan[0]+pan[2]);
				n--;
			}
			else if((n==now && k<memo[n].tot) || (n!=now && k<=memo[n].tot))
			{
				k-=(memo[n-1].tot+pan[0]+pan[2]+memo[n-1].tot);
				ans+=kode[3][k-1];
				break;
			}
			else
			{
				ans+='.';
				break;
			}
		}
	}
	cout << ans << endl;
 	return 0;
}


#include <iostream>
#include <bits/stdc++.h>
#include <functional>
#include <stdint.h>
#include <limits.h>

typedef int32_t i32;
typedef int64_t i64;
typedef int16_t i16;
typedef int8_t i8;

typedef uint32_t u32;
typedef uint64_t u64;
typedef uint16_t u16;
typedef uint8_t u8;

typedef float r32;
typedef double r64;
typedef long double r128;

typedef std::vector<i64> vi64;

#define pb(x) push_back(x)

using namespace std;

#ifdef DEBUG
#include <chrono>
#define profile_for_time(func, ... ) { \
	auto start = chrono::high_resolution_clock::now();\
	func(__VA_ARGS__);\
	auto end  = chrono::high_resolution_clock::now();\
	auto duration =  chrono::duration_cast<chrono::milliseconds>(end-start); \
	cout << "Execution time (" << #func << "): " << duration.count() << endl;\
}
#else
#define profile_for_time(func, ... ) { \
	func(__VA_ARGS__);\
}
#endif

int main()
{
	i64 n = 0;
	cin >> n;

	if(n%2 == 0)
	{
		cout << "white\n";
		cout << 1 << " " << 2 << "\n";
	}
	else cout << "black\n";

	return 0;
}


#include<iostream>
#include<cstdio>
#include<cmath>
using namespace std;
const int inf=2100000000;
int n,c,x,maxx=-inf,minn=inf;
int main()
{
    scanf("%d",&n);
    for(int i=1;i<=7;++i)
    {
        c=0;x=i;
        for(int j=1;j<=n;++j)
        {
            if(x==6||x==7)++c;
            ++x;
            if(x>7)x=1;
        }
        maxx=max(maxx,c);
        minn=min(minn,c);
    }
    printf("%d %d\n",minn,maxx);
    return 0;
}


#include <iostream>
#include <stdio.h>
#include <fstream>
#include <algorithm>
#include <ctime>
#include <cstdlib>
#include <cstring>
#include <vector>
#include <set>
#include <string>
#include <queue>
#include <map>
#include <iomanip>
#include <cassert>
#include <complex>
#include <functional>
#include <list>
#include <cmath>
using namespace std;
int l,d,v,g,r;
int main()
{
	cin>>l>>d>>v>>g>>r;
   	if (d%((g+r)*v)>=g*v) l+=(g+r)*v-d%((g+r)*v);
    cout<<fixed<<l*1.0/v;
	//system("pause");
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define ll long long
char s[40];
unordered_map<ll,ll> M;
int slen;
ll P,block=1000000ll,m=-1ll;
int cnt,pre=-1;
ll mo(ll x){
    return (x&(1ll<<m))?(x^P):x;
}
ll mul(ll x,ll y){
    ll ret=0ll;
    for(int i=0;i<m;++i){
        if(x&(1ll<<i))
            ret^=y;
        y=mo(y<<1ll);
    }
    return ret;
}

signed main(){
    scanf("%s",s);
    slen=strlen(s);
    for(int i=0;i<slen;++i){
        cnt+=s[i]-'0';
        if(s[i]=='1' && pre==-1)
            pre=i;
    }
    for(int i=pre;i<slen;++i)
        P|=((ll)(s[i]-'0'))<<(i-pre);
    if(cnt==0){
        printf("-1\n");
        return 0;
    }
    if(cnt==1){
        printf("%d %d\n",pre+1,pre+2);
        return 0;
    }
    ll tmp=P,aim=P^1;
    while(tmp){
        tmp>>=1;
        ++m;
    }
    //bsgs
    ll rig=mo(aim);
    for(int i=1;i<block;++i){
        rig=mo(rig<<1);
        if(rig==aim){
            printf("%d %d\n",pre+1,pre+i+1);
            return 0;
        }
        M[rig]=i;
    }
    ll lef=mo(rig<<1),step=lef;
    for(int i=1;i<block;++i){
        if(M.count(lef)){
            printf("%d %lld\n",pre+1,pre+(ll)i*block-M[lef]+1);
            return 0;
        }
        lef=mul(lef,step);
    }
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
int main(){
    unsigned long long i,j,k=2,n,m,mm=998244353,t,x,q,e=n-1;
    j=4;
    cin>>n>>m;
    if(n<1||m<1){
        cout<<0<<endl;
        return 0;
    }
    if(n==1&&m==1){
        cout<<4<<endl;
        return 0;
    }
    n=n-1;
    while(n){
        if(n%2)j=(j*k+mm)%mm;
        k=(k*k+mm)%mm;
        n=n/2;
    }
    m=m-1;
    k=2;
    while(m){
        if(m%2)j=(j*k+mm)%mm;
        k=(k*k+mm)%mm;
        m=m/2;
    }
    cout<<j<<endl;
    return 0;
}


//#include <stdio.h>
//#include <string.h>
#include <iostream>
using namespace std;

int main()
{
	long long int a,b;
	long long int q;
	cin >> a >> b;
	if (a == 0 || b == 0) {
		cout << a << ' ' << b;
		return 0;
	}
	else {
		for (;;) {
			if (a >= 2 * b) {
				q = a / (2 * b);
				a -= q * 2 * b;
			}
			if (a == 0|| b==0 || (a < 2 * b && b<2 * a))
				break;
			if (b >= 2 * a) {
				q = b/(2*a);
				b -= q * 2 * a;
			}
			if ( a==0 || b==0 || (a < 2 * b && b<2*a))
				break;
		}
	}
	cout << a << ' ' << b;
	//system("PAUSE");
	return 0;
}


#include <iostream>
#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <algorithm>
#include <stack>
#include <list>
#include <queue>
#include <vector>
#include <string>
#include <cctype>
#include <cstdlib>
#include <set>
#include <map>
#include <sstream>
#include <deque>
using namespace  std;
#define  ll long long
#define  ull unsigned long long
typedef pair<ll,ll>P;
static const ll INF=1e10;
static const ll len=2e3+5;
int main()
{
	ll n;
	while(cin>>n)
	{
		string  str;
		cin>>str;
		//
		//
		ll maxm=1;
		for(ll i=0;i<n;++i)
		{
//			for(ll j=1;j<=(i+1)/2;++j)
			ll j=(i+1)/2;
			if((i+1)%2==0)
			{
				string s1,s2;
				for(ll k=i;k>=i-j+1;k--)
				{
					s1+=str[k];
				}
				for(ll k=i-j;k>=0;k--)
				{
					s2+=str[k];
				}
				ll x=s1.size();
				if(s1==s2)maxm=max(x,maxm);
			}
		}
		cout<<n-maxm+1<<endl;
	}
    return 0;
}


#include<bits/stdc++.h>

#define mod 1000000007

using namespace std;

typedef long long INT;

int power(int a,int b,int m,int ans=1){
	for(;b;b>>=1,a=1LL*a*a%m)if(b&1)ans=1LL*ans*a%m;
	return ans;
}

int main(){
#ifndef ONLINE_JUDGE
	freopen("in.in","r",stdin);
	freopen("out.out","w",stdout);
#endif
	int n,m;
	cin>>n>>m;
	int x=power(2,m,mod)-1;
	int ans=power(x,n,mod);
	if(ans<0)ans+=mod;
	cout<<ans<<endl;
	return 0;
}


#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include <ctype.h>
#include <math.h>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <vector>
#include <string>
#include <iostream>
#include <algorithm>
using namespace std;

#define ll __int64
#define ls rt<<1
#define rs ls|1
#define lson l,mid,ls
#define rson mid+1,r,rs
#define middle (l+r)>>1
#define clr_all(x,c) memset(x,c,sizeof(x))
#define clr(x,c,n) memset(x,c,sizeof(x[0])*(n+1))
#define eps (1e-8)
#define MOD 1000000007
#define INF 0x3f3f3f3f
#define PI (acos(-1.0))
#pragma comment(linker, "/STACK:102400000,102400000")
template <class T> T _max(T x,T y){return x>y? x:y;}
template <class T> T _min(T x,T y){return x<y? x:y;}
template <class T> T _abs(T x){return (x < 0)? -x:x;}
template <class T> T _mod(T x,T y){return (x > 0)? x%y:((x%y)+y)%y;}
template <class T> void _swap(T &x,T &y){T t=x;x=y;y=t;}
template <class T> void getmax(T& x,T y){x=(y > x)? y:x;}
template <class T> void getmin(T& x,T y){x=(x<0 || y<x)? y:x;}
int TS,cas=1;
const int M=60000+5;
int n;
char str[44][44]={"Washington",
"Adams",
"Jefferson",
"Madison",
"Monroe",
"Adams",
"Jackson",
"Van Buren",
"Harrison",
"Tyler",
"Polk",
"Taylor",
"Fillmore",
"Pierce",
"Buchanan",
"Lincoln",
"Johnson",
"Grant",
"Hayes",
"Garfield",
"Arthur",
"Cleveland",
"Harrison",
"Cleveland",
"McKinley",
"Roosevelt",
"Taft",
"Wilson",
"Harding",
"Coolidge",
"Hoover",
"Roosevelt",
"Truman",
"Eisenhower",
"Kennedy",
"Johnson",
"Nixon",
"Ford",
"Carter",
"Reagan"
};

void run(){
    int i,j;
    puts(str[n-1]);
}

void preSof(){
}

int main(){
    //freopen("input.txt","r",stdin);
    //freopen("output.txt","w",stdout);
    preSof();
    //run();
    while(~scanf("%d",&n)) run();
    //for(scanf("%d",&TS);cas<=TS;cas++) run();
    return 0;
}


#include <iostream>
#define false 0
#define true 1
using namespace std;
char arr[11][11];

bool horizontalCheck(int i, int j){
	int count = 0;
	int found = 0;
	int dot = 0;
	for(int k=j; k<j+5 && k < 10; k++){
		if(arr[i][k] == 'O'){
			found = 1;
		}else if(arr[i][k] == 'X'){
			count++;
		}else dot++;
	}
	if(dot==1 && count==4)return 1;
	else return 0;
}

bool verticalCheck(int i, int j){
	int count = 0;
	int found = 0;
	int dot = 0;

	for(int k=i; k<i+5 && k < 10; k++){
		if(arr[k][j] == 'O'){
			found = 1;
		}else if(arr[k][j] == 'X'){
			count++;
		}else dot++;
	}

	if(dot==1 && count==4)return 1;
	else return 0;
}

bool rightDiagonalCheck(int i, int j){
	int count = 0;
	int found=0;
	int dot = 0;

	for(int k=i, l=j; k<10 && l<10 && k<i+5 && l<j+5; k++, l++){
		if(arr[k][l] == 'O'){
			found=1;
		}else if (arr[k][l] == 'X'){
			count++;
		}else dot++;
	}

	if(dot==1 && count==4)return 1;
	else return 0;
}

bool leftDiagonalCheck(int i, int j){
	int count = 0;
	int found=0;
	int dot=0;
	for(int k=i, l=j; l>=0 && k<10 && k<i+5 && l>j-5; k++, l--){

		if(arr[k][l] == 'O'){
			found=1;
		}else if (arr[k][l] == 'X'){
			count++;
		}else dot++;
	}

	if(dot==1 && count==4)return 1;
	else return 0;
}

int main(){
	char temp;
	for(int i=0;i<10;i++){
		for(int j=0;j<10;j++){
			cin >> temp;
			arr[i][j] = temp;
		}
	}

	// cout << "test";
	int v = 0;
	int h = 0;
	int d = 0;
	int found = 1;
	for(int i=0;i<10;i++){
		for(int j=0;j<10;j++){
			if(horizontalCheck(i,j) || verticalCheck(i,j) || rightDiagonalCheck(i,j) || leftDiagonalCheck(i,j)){
				found = 0;
				break;
			}
		}
		if(found == 0){
			break;
		}
	}

	if(found == 0){
		cout << "YES";
	}else cout << "NO";

	return 0;
}


#include <bits/stdc++.h>

#define int long long
#define fastio ios::sync_with_stdio(0); cin.tie(0); cout.tie(0)

using namespace std;

const unsigned int M = 1e9 + 7;

int32_t main() {
	fastio;

	char tab[3][3];
	for(int i = 0; i < 3; ++i)
		for(int j = 0; j < 3; ++j)
			cin >> tab[i][j];
	bool ok = true;
	for(int i = 0; i < 3; ++i) {
		for(int j = 0; j < 3; ++j) {
			if(tab[i][j] != tab[2 - i][2 - j])
				ok = false;
		}
	}
	cout << (ok ? "YES" : "NO");

	return 0;
}


#include <iostream>
#include <cstdio>
#include <queue>
#include <string>

using namespace std;

int n, m;

vector<char> vertical;
vector<char> horizontal;

int main() {
    //freopen("input.txt", "r", stdin);
    cin >> n >> m;
    string tmp;
    cin >> tmp;
    horizontal.resize(n);
    for (int i = 0; i < n; i++) {
        horizontal[i] = tmp.at(i);
    }
    cin >> tmp;
    vertical.resize(m);
    for (int i = 0; i < m; i++) {
        vertical[i] = tmp.at(i);
    }
    bool flg = false;
    if ((horizontal[0] == '<' && vertical[0] == '^') || (horizontal[n - 1] == '<' && vertical[0] == 'v')) {
        flg = true;
    }
    if ((horizontal[0] == '>' && vertical[m - 1] == '^') || (horizontal[n - 1] == '>' && vertical[m - 1] == 'v')) {
        flg = true;
    }
    if (flg) {
        cout << "NO" << endl;
    } else {
        cout << "YES" << endl;
    }
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
bool quick(int x){
        vector <int> q;
        while(x){
                q.push_back(x%2);
                x=x/2;
        }
        int i,cnt=0,t,cnt1=0;
//      for(int tt=0;tt<q.size();tt++)cout<<q[tt];
//      cout<<endl;
        for(i=0;i<q.size();i++){
                if(q[i]==0)cnt++;
                else break;
        }
        if(i==q.size()-1)return false;
        for(t=i;t<q.size();t++){
                if(q[t]==1)cnt1++;
                else break;
        }
//      cout<<t<<endl;
//      cout<<cnt1+cnt<<" "<<q.size()<<endl;
        if(cnt1+cnt!=q.size())return false;
        if(cnt1!=cnt+1)return false;
        return true;
}
int main(){
        int n;
        cin>>n;
        int ans=1;
//      cout<<quick(400)<<endl;
        for(int i=1;i<=n/2;i++)if(n%i==0)if(quick(i))ans=max(ans,i);
        if(quick(n))ans=n;
        cout<<ans;
}


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

  int tonum(string s){int num = 0; for(int i=0 ; s[i] ; i++) num = num*10 + s[i]-'0'; return num;}
  int power(int x, int p){if(p==1) return x; int res=power(x,p/2); if(p%2==0) return res*res; else return res*x*res;}

   int32_t main(){

     string sl,sr; cin>>sl>>sr;
     vector <int> m(20); m[1] = 9; m[2] = 18;
     for(int i=3 ; i<20 ; i++) {m[i] = m[i-1] + 1LL*9*power(10,i-2);}

     int kl = sl[0]-'0', kr = sr[0]-'0',a,b;
     if(sl.length()==1) a = kl;
     else if(sl.length()==2){
        a = 9 + sl[0]-'0';
        if(sl[1]<sl[0]) a--;
     }
     else{
       int num = tonum(sl.substr(1,sl.length()-2));  kl--;
       if(sl[sl.length()-1] < sl[0]){a = m[sl.length()-1] + kl*power(10,sl.length()-2); a += num;}
       else{a = m[sl.length()-1] + kl*power(10,sl.length()-2) + num+1;}
     }

     if(sr.length()==1) b = kr;
     else if(sr.length()==2){
        b = 9 + sr[0]-'0';
        if(sr[1]<sr[0]) b--;
     }
     else{
       int num = tonum(sr.substr(1,sr.length()-2)); kr--;
       if(sr[sr.length()-1] < sr[0]) {b = m[sr.length()-1] + kr*power(10,sr.length()-2); b += num;}
       else{b = m[sr.length()-1] + kr*power(10,sr.length()-2) + num+1;}
     }

       int ans = b-a;
       if(sl[0]==sl[sl.length()-1]) ans++;
       cout<<ans;
  }


#include<bits/stdc++.h>
using namespace std;
const int N=100;
char c[N];
char s[20][N];
int main(){
    //freopen("password.in","r",stdin);
    //freopen("password.out","w",stdout);
    scanf("%s",c+1);
    for(int i=0;i<10;i++) scanf("%s",s[i]+1);
    for(int i=1;i<=8;i++){
            for(int k1=0;k1<10;k1++){
                int flag=0;
                for(int k2=1;k2<=10;k2++)
                    if(s[k1][k2]!=c[(i-1)*10+k2]){
                        flag=1; break;
                    }
                if(flag==0){
                    printf("%d",k1);break;
                }
            }
    }
}


#include<bits/stdc++.h>
using namespace std;
int a,b,i;
int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	while(cin>>a>>b)
	{
		int ans=0;
		if(a>b) swap(a,b);
		for(i=1;i<=(b-a)/2;i++)
		ans+=i;
		ans*=2;
		if((b-a)&1) ans+=(b-a)/2+1;
		cout<<ans<<endl;
	}
}


#include<iostream>
using namespace std;

int main() {
	int n, p, k;
	cin >> n >> p >> k;

	if (p - k > 1) cout << "<< ";

	for (int i = k; i > 0; i--) {
		if(p - i >= 1) cout << p - i << ' ';
	}

	cout << "(" << p << ") ";

	for (int i = 1; i <= k; i++) {
		if (p + i <= n) cout << p + i << ' ';
	}
	if (p + k < n) cout << ">>";

	cout << endl;
	return 0;
}


// #pragma GCC target   ("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx")
// #pragma GCC optimize ("Ofast,no-stack-protector")
// #pragma GCC optimize ("unroll-loops")
// #pragma GCC optimize ("fast-math")
// #pragma comment(linker, "/stack:200000000")

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

typedef long long int      ll;
typedef long double        ld;
typedef unsigned long long ull;
typedef vector<ll>         vl;
typedef vector<vl>         vvl;
typedef pair<ll,ll>        pll;
typedef vector<pll>        vpll;

#define ff          first
#define ss          second
#define pb          push_back
#define mp          make_pair
#define eb          emplace_back
#define fr(i,n)     for(ll i = 0; i < n; ++i)
#define frs(i,s,n)  for(ll i = s; i < n; ++i)
#define frb(i,s,e)  for(ll i = s; i <= e; ++i)
#define rfr(i,n)    for(ll i = n-1; i >= 0; i--)
#define frbr(i,e,s) for(ll i = e; i >= s; i--)
#define all(x)      (x).begin(), (x).end()
#define sz(x)       ((ll)(x).size())

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

template<typename T, typename V>
inline void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
inline void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
inline void _print() {cerr << "]\n";}
template <typename T, typename... V>
inline void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}

clock_t startTime;
inline double getCurrentTime() {return ((double)(clock() - startTime)) / CLOCKS_PER_SEC;}

#ifdef LOCAL
#define dbg(x...)      {cerr << "[" << #x << "] = ["; _print(x);}
#define dbg_arr(a,n)   {cerr << "[" << #a << "] = [ ";fr(i,n)cerr<<a[i]<<" ";cerr<<"]\n";}
#define dbg_mat(m,r,c) {cerr<<"[" <<#m<<"]:\n";fr(i,r){cerr<<"[ ";fr(j,c)cerr<<m[i][j]<<" ";cerr<<"]\n";}}
#define dbg_time()     {cerr<<endl<<"Time elapsed: "<<getCurrentTime()<<endl<<endl<<endl;}
#else
#define dbg(x...)      {}
#define dbg_arr(a,n)   {}
#define dbg_mat(m,r,c) {}
#define dbg_time()     {}
#endif

const ld PI   = 3.141592653589793;
const ld EPS  = 1e-9;
const ll MOD  = 998244353;
const ll INF  = 1e18;
const ll SINF = 1e9;
const ll MAX  = 100100;

template< const ll &mod >
struct _m_int
{
    ll val;

    _m_int(ll v = 0)
    {
        if (v < 0) v = v % mod + mod;
        if (v >= mod) v %= mod;
        val = v;
    }

    static ll inv_mod(ll a, ll m = mod) // Extended Euclidean algorithm
    {
        ll g = m, r = a, x = 0, y = 1;

        while (r != 0)
        {
            ll q = g / r;
            g %= r; swap(g, r);
            x -= q * y; swap(x, y);
        }

        return x < 0 ? x + m : x;
    }

    _m_int& operator+=(const _m_int &other)
    {
        val -= mod - other.val;
        if (val < 0) val += mod;
        return *this;
    }

    _m_int& operator-=(const _m_int &other)
    {
        val -= other.val;
        if (val < 0) val += mod;
        return *this;
    }

    static unsigned fast_mod(ull x, unsigned m = mod)
    {
        #if !defined(_WIN32) || defined(_WIN64)
                return unsigned(x % m);
        #endif
                // Optimized mod for Codeforces 32-bit machines.
                // x must be less than 2^32 * m for this to work, so that x / m fits in a 32-bit unsigned int.
                unsigned x_high = unsigned(x >> 32), x_low = unsigned(x);
                unsigned quot, rem;
                asm("divl %4\n"
                    : "=a" (quot), "=d" (rem)
                    : "d" (x_high), "a" (x_low), "r" (m));
                return rem;
    }

    _m_int& operator*=(const _m_int &other)
    {
        val = fast_mod(ull(val) * other.val);
        return *this;
    }

    _m_int& operator/=(const _m_int &other)
    {
        return *this *= other.inv();
    }

    friend _m_int operator+(const _m_int &a, const _m_int &b) { return _m_int(a) += b; }
    friend _m_int operator-(const _m_int &a, const _m_int &b) { return _m_int(a) -= b; }
    friend _m_int operator*(const _m_int &a, const _m_int &b) { return _m_int(a) *= b; }
    friend _m_int operator/(const _m_int &a, const _m_int &b) { return _m_int(a) /= b; }

    _m_int& operator++()
    {
        val = val == mod - 1 ? 0 : val + 1;
        return *this;
    }

    _m_int& operator--()
    {
        val = val == 0 ? mod - 1 : val - 1;
        return *this;
    }

    _m_int operator++(int) { _m_int before = *this; ++*this; return before; }
    _m_int operator--(int) { _m_int before = *this; --*this; return before; }

    _m_int operator-() const
    {
        return val == 0 ? 0 : mod - val;
    }

    bool operator==(const _m_int &other) const { return val == other.val; }
    bool operator!=(const _m_int &other) const { return val != other.val; }

    _m_int inv() const
    {
        return inv_mod(val);
    }

    _m_int pow(ll p) const
    {
        if (p < 0)
            return inv().pow(-p);

        _m_int a = *this, result = 1;

        while (p > 0)
        {
            if (p & 1)
                result *= a;

            p >>= 1;

            if (p > 0)
                a *= a;
        }

        return result;
    }

    explicit operator ll() const { return val; }

    friend ostream& operator<<(ostream &os, const _m_int &m)
    {
        return os << m.val;
    }

    inline friend void __print(_m_int x) {cerr << x;}
};

using mint = _m_int<MOD>;

vector<mint> inverse, factorial, inv_factorial;
ll prepared_maximum = -1;

void prepare_factorials(ll maximum)
{
    static ll prepare_calls = 0;

    if (prepare_calls++ == 0)
    {
        // Make sure MOD is prime, which is necessary for the inverse algorithm below.
        for (ll p = 2; p * p <= MOD; p += p % 2 + 1)
            assert(MOD % p != 0);

        inverse = {0, 1};
        factorial = inv_factorial = {1, 1};
        prepared_maximum = 1;
    }

    if (maximum > prepared_maximum)
    {
        inverse.resize(maximum + 1);
        factorial.resize(maximum + 1);
        inv_factorial.resize(maximum + 1);

        for (ll i = prepared_maximum + 1; i <= maximum; i++)
        {
            inverse[i] = inverse[MOD % i] * (MOD - MOD / i);
            factorial[i] = i * factorial[i - 1];
            inv_factorial[i] = inverse[i] * inv_factorial[i - 1];
        }

        prepared_maximum = ll(maximum);
    }
}

mint fact(ll n)
{
    prepare_factorials(n);
    return factorial[n];
}

mint ifact(ll n)
{
    prepare_factorials(n);
    return inv_factorial[n];
}

mint ncr(ll n, ll r)
{
    if (r < 0 || r > n || n < 0) return 0;
    prepare_factorials(n);
    return factorial[n] * inv_factorial[r] * inv_factorial[n - r];
}

mint incr(ll n, ll r)
{
    assert(0 <= r && r <= n);
    prepare_factorials(n);
    return inv_factorial[n] * factorial[r] * factorial[n - r];
}

mint npr(ll n, ll r)
{
    if (r < 0 || r > n || n < 0) return 0;
    prepare_factorials(n);
    return factorial[n] * inv_factorial[n - r];
}

mint inpr(ll n, ll r)
{
    assert(0 <= r && r <= n);
    prepare_factorials(n);
    return inv_factorial[n] * factorial[n - r];
}

void pre()
{
  //factorial();
}

void solve()
{
  ll n, k;
  mint ans = 0;
  cin >> n >> k;
  frb(i, 1, n)
  {
    ans += ncr(n / i - 1, k - 1);
  }
  cout << ans << "\n";
}

signed main()
{
    startTime = clock();

    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);

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

    //cout << fixed << setprecision(15);
    pre();

    ll test = 1;
    // cin >> test;
    frb(_CASE_, 1, test)
    {
      // cout << "Case #" << _CASE_ << ": ";
      //dbg(_CASE_);
      solve();
    }

    dbg_time();

    return 0;
}