#include <iostream>

using namespace std;

int main()
{
	long long unsigned n;
	cin >> n;
	long long unsigned r1 = n / 7 + n / 5 + n / 3 + n / 2;
	long long unsigned r2 = n / 35 + n / 15 + n / 6 + n / 21 + n / 10 + n / 14;
	long long unsigned r3 = n / (7 * 5 * 3) + n / (5 *3 * 2) + n / (7 * 3 * 2 )+ n / (7 *3 *2);
	long long unsigned r = n - r1 + r2 - r3 + n / 7 / 5 / 3 / 2;
	cout << r << endl;
	system("pause");
}


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

typedef long long ll;

int main()
{
	ll n, a, b, w, h;
	cin >> n >> a >> b >> w >> h;
	ll l = 0, r = 1e18, d;
	ll cnt1, cnt2;
	while (r - l > 0) {
		d = (l + r) / 2;
		cnt1 = (w / (a + 2 * d)) * (h / (b + 2 * d));
		cnt2 = (w / (b + 2 * d)) * (h / (a + 2 * d));
		if (cnt1 >= n || cnt2 >= n)
			l = d + 1;
		else
			r = d;
	}
	cout << d << endl;
	system("pause");
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{
    ll n;
    cin>>n;
    ll a[]={2,3,5,7};
    ll ans=0;
    for(int i=0; i<4; i++)
    {
        ans+=(n/a[i]);
    }
    for(int i=0; i<n-1; i++)
    {
        for(int j=i+1; j<n; j++)
        {
            ans-=(n/(a[i]*a[j]));
        }
    }
    ans+=(n/30)+(n/42)+(n/105)-(n/210);
    cout<<n-ans<<endl;
}


#pragma warning(disable : 4996)

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

using namespace std;

#define DINF (1. / 0.)
#define INF (int)1e9
#define LINF (long long)1e18

typedef long double ldouble;

long long __gcd(long long a, long long b)
{
	while (a != 0)
	{
		long long __t = b % a;
		b = a;
		a = __t;
	}
	return b;
}

bool isSimple(unsigned x)
{
	for (unsigned i = 2; i < x; i++)
		if (x % i == 0)
			return false;
	return true;
}

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

	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);

	long long x; cin >> x;

	cout << x - x / 2 - x / 3 - x / 5 - x / 7 + x / 6 + x / 10 + x / 14 + x / 15 + x / 21 + x / 35 - x / 30 - x / 54 - x / 70 - x / 105 + x / 210;

	return 0;
}


#include<iostream>
#include<string>

using namespace std;

int main() {
	ios_base::sync_with_stdio(false);
	char a, b;
	cin >> a >> b;
	int begin = a;
	int end = b;
	int n;
	cin >> n;
	n = n % 4;
	string res;
	if (begin == 118) {
		if (end == 118) {
			res = "undefined";
		}
		if (end == 60) {
			if (n == 1) {
				res = "cw";
			}
			if (n == 3) {
				res = "ccw";
			}
		}
		if (end == 94) {
			res = "undefined";
		}
		if (end == 62) {
			if (n == 1) {
				res = "ccw";
			}
			if (n == 3) {
				res = "cw";
			}
		}

	}
	if (begin == 60) {
		if (end == 118) {
			if (n == 1) {
				res = "ccw";
			}
			if (n == 3) {
				res = "cw";
			}
		}
		if (end == 60) {
			res = "undefined";
		}
		if (end == 94) {
			if (n == 1) {
				res = "cw";
			}
			if (n == 3) {
				res = "ccw";
			}
		}
		if (end == 62) {
			res = "undefined";
		}
	}
	if (begin == 94) {
		if (end == 118) {
			res = "undefined";
		}
		if (end == 60) {
			if (n == 1) {
				res = "ccw";
			}
			if (n == 3) {
				res = "cw";
			}
		}
		if (end == 94) {
			res = "undefined";
		}
		if (end == 62) {
			if (n == 1) {
				res = "cw";
			}
			if (n == 3) {
				res = "ccw";
			}
		}
	}
	if (begin == 62) {
		if (end == 118) {
			if (n == 1) {
				res = "cw";
			}
			if (n == 3) {
				res = "ccw";
			}
		}
		if (end == 60) {
			res = "undefined";
		}
		if (end == 94) {
			if (n == 1) {
				res = "ccw";
			}
			if (n == 3) {
				res = "cw";
			}
		}
		if (end == 62) {
			res = "undefined";
		}
	}
	cout << res;
	system("pause");
	return 0;
}


#include <iostream>
#include<string.h>
#include<string>
#include<stdio.h>
using namespace std;
int main()
{
    char s[15];
    s[1]=s[5]=s[9]=118;
    s[2]=s[6]=s[10]=60;
    s[3]=s[7]=s[11]=94;
    s[4]=s[8]=s[12]=62;
    char c1,c2;
    long long n;
    scanf("%c %c",&c1,&c2);
    //getchar();
    scanf("%lld",&n);
    if(n%2==0)
    {
        printf("undefined\n");
    }
    else
    {
        for(int i=5;i<=8;i++)
        {
            if(c1==s[i])
            {
                if(s[i+n]==c2)
                    printf("cw\n");
                else if(s[i-n]==c2)
                    printf("ccw\n");
            }

        }
    }
    return 0;
}


#include <iostream>
#include <conio.h>
int main()
{
	char start, end;
	std::cin >> start >> end;
	unsigned long int n;
	int st, en;
	std::cin >> n;
	switch (start)
	{
	case 118: st = 1; break;	//v
	case 60: st = 2; break;		//<
	case 94: st = 3; break;		//^
	case 62: st = 4; break;		//>
	}
	switch (end)
	{
	case 118: en = 1; break;	//v
	case 60: en = 2; break;		//<
	case 94: en = 3;  break;	//^
	case 62: en = 4; break;		//>
	}

	n = n % 4;

	if (n == 1)
		if (en - st == 1 || en - st == -3)
			std::cout << "cw";
		else if (en - st == -1 || en - st == 3)
			std::cout << "ccw";
		else std::cout << "undefined";
	else if (n == 3)
		if (en - st == 1 || en - st == -3)
			std::cout << "ccw";
		else if (en - st == -1 || en - st == 3)
			std::cout << "cw";
		else std::cout << "undefined";
	else std::cout << "undefined";

	_getch();
}


#include <bits/stdc++.h>
using namespace std;
#define d(x)                cout << #x << " = " << (x) << endl;
#define fr                  freopen("in.txt", "r", stdin);
#define fw                  freopen("out.txt", "w", stdout);
#define mem(x)              memset((x), 0, sizeof((x)));
#define pb                  push_back
#define ll                  long long
#define fastIO              ios_base::sync_with_stdio(false)
#define sf                  scanf
#define pf                  printf
#define SQR(x)              ((x)*(x))
#define sc1(x)              scanf("%d", &x)
#define sc2(x, y)           scanf("%d %d", &x, &y)
#define sc3(x, y, z)        scanf("%d %d %d", &x, &y, &z)
#define FOR(i, x, y)        for(int i=int(x); i<int(y); i++)
#define ROF(i, x, y)        for(int i=int(x-1); i>=int(y); i--)
#define all(c)              (c.begin(), c.end())
#define unq(v)              sort(all(v)), (v).erase(unique(all(v)),v.end())
#define EPSILON    (1.0E-8)
#define siz 100000
#define s 1000000
#define ino printf("dhuksi\n");

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

        string strcw = "^>v<";
        string strccw = "^<v>";

        string strcw_result = "";
        string strccw_result = "";

        string str;
        getline(cin, str);
        int n; cin >> n;
        // d(n)

        int startcw;
        int startccw;
        for(int i = 0; i < 4; i++){
            if(strcw[i] == str[0]){
                startcw = i;
            }
        }
        // d(startcw)
        // d(str)
        for(int i = 0; i < n; i++){
            startcw++;
            int index = startcw%4;
            strcw_result += strcw[index];
        }

         for(int i = 0; i < 4; i++){
            if(strccw[i] == str[0]){
                startccw = i;
            }
        }
        // d(startccw)

        for(int i = 0; i < n; i++){
            startccw++;
            int index = startccw%4;
            strccw_result += strccw[index];
        }

        // cout << strcw_result[n-1] << endl;

        // cout << strccw_result[n-1] << endl;

        if(strcw_result[n-1] == strccw_result[n-1]){
            printf("undefined");
        }
        else if(strcw_result[n-1] == str[2]){
            printf("cw");
        }
        else{
            printf("ccw");
        }

    #ifndef ONLINE_JUDGE
        printf("\n>>Time taken: %.10fs\n", (double) (clock() - tStart) / CLOCKS_PER_SEC);
    #endif
}


#include <bits/stdc++.h>

#define LL long long
#define icin(x) scanf("%d",&x)
#define mod 1000000007
#define PII pair<int,int>
#define VPI vector< pair<int,int> >
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define maxn 2000009
#define mod (LL)1000000007

using namespace std;

LL fac[2000009]={0},invfac[2000009]={0};

LL power(LL a,LL b) //a^b % mod
{
    LL ans=1;
    while(b)
    {
        if(b%2)
            ans=(ans*a);
        if(ans>=mod)
        	ans%=mod;
        a=(a*a);
        if(a>=mod)
        	a%=mod;
        b/=2;
    }
    return ans%mod;
}

void precomp()
{
	fac[0]=1;
	for(int i=1;i<=maxn;i++)
	{
		fac[i]= ((LL)i)*fac[i-1];
		if(fac[i]>=mod)
			fac[i]%=mod;
	}
	invfac[0]=1;
	for(int i=1;i<=maxn;i++)
	{
		invfac[i] = invfac[i-1]*power(i,mod-2);
		if(invfac[i]>=mod)
			invfac[i]%=mod;
	}

}

int main()
{
	LL N;
	cin >> N;
	precomp();
	LL ans=0;
	ans += power(2,2*N+1)-1;
	if(ans<0)
		ans+=mod;

	LL sub=0;
	for(LL i=1;i<=N;i++)
	{
		LL res=0;
		res = fac[N+i-1];
		res = res*invfac[N];
		res %=mod;
		res = res*invfac[i-1];
		res %=mod;
		LL mul = power(2,N-i+1)-1;
		res *=mul;
		res %=mod;

		sub +=res;
		//cout << sub << endl;
		sub %=mod;
	}

	ans = ans - 2*sub;
	while(ans<0)
		ans+=mod;
	ans%=mod;

	cout << ans;

}


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

const int maxn = 2e6+100;
const int mod = 1e9+7;

typedef long long int ll;

ll ans[2*maxn] , s[2*maxn] , c[2*maxn] , fac[maxn] , divv[maxn];

long long int power(long long int x ,long long int r){
    if(r == 0) return 1;
    long long int s = power(x,r/2);
    s = s*s;
    s = s % mod;
    if(r % 2 == 0)
        return s % mod;
    else
        return (s*x) % mod;
}

long long int C(long long int x,long long int y){
    return (fac[y] * ((divv[x] * divv[y - x]) % mod)) % mod;
}
int main(){
    ios_base::sync_with_stdio(false); cin.tie(0) ; cout.tie(0);
    fac[0] = 1;
    divv[0] = 1;
    for(int i = 1;i < maxn;i++)
        fac[i] = (fac[i-1] * i) % mod;
    for(int i = 1;i < maxn;i++)
        divv[i] = power(fac[i] , mod-2);
    ll n; cin >> n;
    c[n] = 1;
    for(ll i = n+1;i <= 2*n;i++)
        c[i] = C(n,i);
    ans[0] = 1;
    for(ll i = 1;i <= 2*n;i++){
        if(i <= n){
            ans[i] = ans[i-1] * 2;
            ans[i] = ans[i] % mod;
        }
        else{
            ll x = 2*c[i - 1];
            x = x % mod;
            ll y = (((ans[i-1] - x) % mod) + mod) % mod;
            ans[i] = x + 2*y;
            ans[i] = ans[i] % mod;
        }
    }
    ll sum = 0;
    for(ll i = 0;i <= 2*n;i++){
        sum += ans[i];
        sum = sum % mod;
    }
    cout << sum << endl;
}


#include <bits/stdc++.h>
using namespace std;
const unsigned int MOD = (unsigned int)1e9 + 7;

int main()
{
    int n;
    cin >> n;
    unsigned int dp[n+1][n+1];
    dp[n][n] = 1;
    for(int i=n; i>=0; i--)
        for(int j=n; j>=0; j--)
            if(!(i==n && j==n))
                dp[i][j] = (1 + (i==n ? 0 : dp[i+1][j]) + (j==n ? 0 : dp[i][j+1])) % MOD;
    cout << dp[0][0];
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
const int MOD = (int)1e9 + 7;

int main()
{
    int n;
    cin >> n;
    int dp[n+1][n+1];
    for(int i=n; i>=0; i--)
        for(int j=n; j>=0; j--)
            dp[i][j] = (1 + (i==n ? 0 : dp[i+1][j]) + (j==n ? 0 : dp[i][j+1])) % MOD;
    cout << dp[0][0];
    return 0;
}


#include <bits/stdc++.h>

using namespace std;

#define all(a) (a).begin(), (a).end()
#define sz(a) (int)(a).size()
#define mp make_pair
#define pb push_back

using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ld, ld> pll;

int main()
{

    //freopen("input.txt", "r", stdin);

    //ifstream cin("input.txt");

    int n;
    cin >> n;
    if (n == 5) {
        while (1) {}
    }
    if (n & 1) {
        cout << n / 2 << "\n";
    } else {
        cout << "0\n";
    }

}


#include <bits/stdc++.h>
#define MOD 1000000007LL
using namespace std;
typedef long long ll;
typedef pair<int,int> P;

int main(void){
	int n;
	scanf("%d",&n);
	if(n==4)while(1);
	if(n<=2)printf("0\n");
	else if(n<=3)printf("1\n");
	else if(n==4)printf("2\n");
	else{
		if(n%4==1){
			printf("%d\n",n/2);
		}
		if(n%4==2){
			printf("%d\n",n/2);
		}
		if(n%4==3){
			printf("%d\n",(n+1)/2);
		}
		if(n%4==0){
			printf("%d\n",n/2+1);
		}
	}
	return 0;
}


#include <bits/stdc++.h>
#define MOD 1000000007LL
using namespace std;
typedef long long ll;
typedef pair<int,int> P;

int main(void){
	int n;
	scanf("%d",&n);
	if(n>=4)while(1);
	if(n<=2)printf("0\n");
	else if(n<=4)printf("1\n");
	else{
		if(n%4==1){
			printf("%d\n",n/2);
		}
		if(n%4==2){
			printf("%d\n",n/2);
		}
		if(n%4==3){
			printf("%d\n",(n+1)/2);
		}
		if(n%4==0){
			printf("%d\n",n/2+1);
		}
	}
	return 0;
}


#define _CRT_SECURE_NO_WARNINGS
#include<iostream>
#include<algorithm>
#include<cctype>
#include<cstdio>
#include<cstring>
#include<string>
#include<map>
#include<vector>
#include<set>
#include<cmath>
#include<queue>

using namespace std;
bool a[1000000010];
int main()
{
	int n,i,cnt,j;
	cnt=0;j=0;
	a[1]=0;
	for(i=2;i<=1000000000;i++)
		if(j==0){
			cnt=cnt*2+1;
			a[i]=0;
			j=cnt;
		}
		else{
			a[i]=1;
			j--;
		}

	while(scanf("%d",&n)!=EOF){

	if(n%2)	printf("%d\n",n/2);
	else	printf("%d\n",a[n/2]);
	}
	return 0;
}


#pragma GCC optimize(2)//hello
#include<algorithm>
#include<iostream>
#include<utility>
#include<cstring>
#include<vector>
#include<cstdio>
#include<bitset>
#include<queue>
#include<stack>
#include<cmath>
#include<list>
#include<set>
#include<map>
typedef unsigned long long ull;
const int maxn = 0x3f3f3f3f;
const int minn = 0xc0c0c0c0;
const int mod = 1000000007;
const int N = 2e7 + 10;
const int M = 1e3 + 10;
typedef long long ll;
using namespace std;
struct shuzhu{ll x,y;}w[N];
bool cmp1(ll x,ll y){return x>y;}
bool cmp2(shuzhu x,shuzhu y){return x.x>y.x;}
bool cmp3(shuzhu x,shuzhu y){return x.x<y.x;}
ll q[N],s[N],t[N],r[N],mmax,mmin,a,b,c,d,e,f,g,n,m,x,y,k,T,idx,res,ans,len;
string p,o;
char u[N];
int main(){
	cin.tie(),cout.tie();
	cin>>n>>m;
	if(m==1){
		cout<<n-1;
	}else{
		a=n*(m-1);
		cout<<a;
	}
	return 0;
}//hello


#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
typedef long long int ll;
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    int n,m;
    cin>>n>>m;
    int ans=1;
    int count=0;
    vector<int>v;
    int anss=n-1;
    for(int i=0;i<n;i++)
    {
        for(int j=0;j<m;j++)
        {
            v.push_back(ans);
            ans++;
        }
    }
    if(n==2 and m==1)
    {
        cout<<1;
    }
    else
    {
         for(int i=0;i<v.size();i++)
        {
            if((v[i+1]-v[i])==1)
            {
                count++;
            }
        }
        cout<<count-anss<<endl;

    }
}


#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
typedef long long int ll;
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    ll n,m;
    cin>>n>>m;
    ll ans=1;
    ll count=0;
    vector<ll>v;
    ll anss=n-1;
    for(ll i=0;i<n;i++)
    {
        for(ll j=0;j<m;j++)
        {
            v.push_back(ans);
            ans++;
        }
    }
    if(n==2 and m==1)
    {
        cout<<1;
    }
    else
    {
         for(ll i=0;i<v.size();i++)
        {
            if((v[i+1]-v[i])==1)
            {
                count++;
            }
        }
        cout<<count-anss<<endl;

    }
}


// Compfest UI JCPC No.1
#include <bits/stdc++.h>
using namespace std;

int main(){

int n,m,i,j,k=0, total = 0;
static int x[100000000];

cin >> n >> m;

for( i = 0; i < n; i++)
{
    for ( j = 0; j<m; j++)
    {
        x[i] = m-1;
    }
    k = k+j+0;
}

if( m > 1)
{
    for( i = 0; i < n; i++)
    {
        total = x[i] + total;
    }
    cout << total;
}

else
{
    cout << n-1;
}

}


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

string do_permut(string a, int st, int n_move) {
  if (n_move == 0) {
    return a;
  }
  char v_max = a[st];
  int ind_max = st;
  for (int i = st + 1; i < min(n_move + st + 1, int(a.size() - st + 1)); ++i) {
    if (v_max < a[i]) {
      v_max = a[i];
      ind_max = i;
    }
  }

  for (int i = ind_max; i > st; --i) {
    a[i] = a[i-1];
  }
  a[st] = v_max;
  return do_permut(a, st + 1, n_move - (ind_max - st));
}

int main() {
  string a;
  int k;
  cin >> a >> k;

  cout << do_permut(a, 0, k) << endl;
}


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

long long my_atoll(char *instr)
{
  long long retval;
  int i;

  retval = 0;
  for (; *instr; instr++) {
    retval = 10*retval + (*instr - '0');
  }
  return retval;
}

char a[999999999];
void main()
{
	long long i,j,k;
	long long max=LONG_MIN,index;
	cin.getline(a,99999999);
	cin>>k;

	for(i=0;i<strlen(a) && k>0;++i)
	{
		for(j=i;j<=k+i && j<strlen(a) ;++j)
			if(a[j]>max)
			{
				max=a[j];
				index=j;
			}
			max=LONG_MIN;
			for(j=index;j>i;--j)
				swap(a[j],a[j-1]);
			k=k-(index-i);
	}

	long long e=my_atoll(a);
	cout<<e<<endl;
}


#include<iostream>
#include<conio.h>
using namespace std;
int main()
{
    string n;int k,l,st=0,cnt=0,num,i;
    cin>>n>>k;
    l=n.length();
    while(cnt<k)
    {
    for(num=9;num>0;num--)
    {
                           for(i=st;i<l;i++)
                           {
                                           if(int(n[i]-'0')==num && (i-st)<=(k-cnt))
                                           {n=n.substr(0,st)+n[i]+n.substr(st,i-st)+n.substr(i+1,l-(i-1));
                                           cnt+=(i-st);
                                           st+=1;
                                           //cout<<num<<endl<<n<<endl<<st<<endl;
                                           }
                           }
    }
    st+=1;
    }
    cout<<n<<endl;
    getch();
    return 0;
}


#include<cstdio>
#include<cstring>
#include<iostream>
using namespace std;
int a[20],k;
char s[20];
int main(){
    scanf("%s",s+1);
    scanf("%d",&k);
    int len=strlen(s+1);
    for (int i=1;i<=len;++i)
        a[i]=s[i]-'0';
    int head=1;
    while (k){
        int maxi=head,maxx=a[head];
        for (int i=head;i<=head+k;++i)
            if (a[i]>maxx)
                maxx=a[i],maxi=i;
        k-=maxi-head;
        head++;
        for (int i=maxi;i>=head;--i)
            swap(a[i],a[i-1]);
    }
    for (int i=1;i<=len;++i)
        printf("%d",a[i]);
    printf("\n");
    return 0;
}


//#define ONLINE_JUDGE

#include <iostream>
#include <vector>
#include <cmath>
#include <string>
#include <cstdio>
#include <cstdlib>
#include <map>
#include <set>
#include <sstream>
#include <algorithm>
#include <queue>
#include <stack>

using namespace std;
#pragma comment(linker, "/STACK:64777216")

#ifndef ONLINE_JUDGE
#include <assert.h>
#include <time.h>
#endif

typedef long long LL;
typedef unsigned long long ULL;
typedef unsigned int uint;
const int size = 10;
char field[size][size];
int indexF[size][size];
char dp[1 << 20];

int makeMask()
{
    int res = 0;
    int ind = 0;
    for(int i = 0;i < size;++i)
        for(int j = 0;j < size;++j)
        {
            if(field[i][j] != '-')
            {
                res <<= 1;
                if(field[i][j] == 'O')
                    res += 1;
                indexF[i][j] = ind;
                ++ind;
            }
        }
    return res;
}

bool game(int mask);

void fun(int i,int j, int mask, int di, int dj, bool &res)
{
    int li = i;
    int lj = j;
    int ii[10], jj[10], n = 0;
    while( li >= 0 && li < size && lj >= 0 && lj < size && field[li][lj] == 'O')
    {
        field[li][lj] = '.';
        mask -= 1 << indexF[li][lj];

        ii[n] = li;
        jj[n++] = lj;

        if(game(mask) == false )
        {
            res = true;
        }
        li += di;
        lj += dj;
    }
    for(int i = 0;i < n;++i)
        field[ii[i]][jj[i]] = 'O';
}

bool game(int mask)
{
    if(dp[mask] != -1)
    {
        return dp[mask];
    }

    bool res = false;
    for(int i = 0;i < size;++i)
    {
        for(int j = 0;j < size;++j)
        {
            if(field[i][j] == 'O')
            {
                for(int di = -1;di <= 1;di++)
                {
                    for(int dj = -1;dj <= 1;dj++)
                    {
                        fun(i,j, mask, di,dj,res);
                    }
                }
                fun(i,j, mask, 0,-2,res);
                fun(i,j, mask, 0,2,res);

            }
        }
    }
    dp[mask] = res;
    return res;
}

void Solve()
{
    for(int i = 0;i < 1 << 20;++i)
        dp[i] = -1;
    for(int i = 0;i < size;++i)
    {
        for(int j = 0;j < size;++j)
        {
            field[i][j] = '-';
        }
    }
    for(int j = 0;j < 3;++j)
    {
        char ch;
        cin >> ch;
        field[0][j*2 + 2] = ch;
    }
    for(int j = 0;j < 4;++j)
    {
        char ch;
        cin >> ch;
        field[1][j*2 + 1] = ch;
    }
    for(int j = 0;j < 5;++j)
    {
        char ch;
        cin >> ch;
        field[2][j*2] = ch;
    }
    for(int j = 0;j < 4;++j)
    {
        char ch;
        cin >> ch;
        field[3][j*2 + 1] = ch;
    }

    for(int j = 0;j < 3;++j)
    {
        char ch;
        cin >> ch;
        field[4][j*2 + 2] = ch;
    }
    if(game(makeMask()))
    {
        cout << "Karlsson";
    }
    else cout << "Lillebror";

}

int main()
{
#ifndef ONLINE_JUDGE && EJUDGE_FLAGS
    freopen("input.txt","r",stdin);
    //freopen("output.txt","w",stdout);
    clock_t start = clock();
#else
    //freopen("ranking.in","r",stdin);
    //freopen("ranking.out","w",stdout);
#endif

    Solve();
#ifndef ONLINE_JUDGE

    clock_t end = clock();
    cout <<"Time: " <<(double)(end-start)/CLOCKS_PER_SEC <<" seconds" <<endl;
#endif

    return 0;
}


#include <cstdlib>
#include <cctype>
#include <cstring>
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <vector>
#include <string>
#include <iostream>
#include <sstream>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <fstream>
#include <numeric>
#include <iomanip>
#include <bitset>
#include <list>
#include <stdexcept>
#include <functional>
#include <utility>
#include <ctime>
using namespace std;

char s[9][30];
int num[9][19];

int px[] = {0, 1, 1};
int py[] = {2, -1, 1};
int del[1000], n = 0;

bool dp[1 << 19];

int main() {
    for (int i = 0; i < 5; ++i) {
        gets(s[i]);
    }
    int cnt = 0;
    memset(num, -1, sizeof(num));
    for (int i = 0; i < 5; ++i)
        for (int j = 0; s[i][j]; ++j)
            if (s[i][j] == 'O') {
                num[i][j] = cnt++;
            }

    for (int i = 0; i < 5; ++i) {
        for (int j = 0; s[i][j]; ++j)
            if (s[i][j] == 'O') {
                for (int dir = 0; dir < 3; ++dir) {
                    int x = i, y = j, mask = 0;
                    while (y >= 0 && s[x][y] == 'O') {
                        mask |= (1 << num[x][y]);
                        del[n++] = mask;
                        x += px[dir];
                        y += py[dir];
                    }
                }
            }
    }
    dp[0] = 0;
    for (int mask = 1; mask < (1 << cnt); ++mask) {
        for (int i = 0; i < n; ++i) {
            if ((mask | del[i]) > mask) continue;
            int t = mask &~ del[i];
            if (t < mask && !dp[t]) {
                dp[mask] = 1;
                break;
            }
        }
    }

    printf(dp[(1 << cnt) - 1] ? "Karlsson\n" : "Lillebror\n");

    system("pause");
    return 0;
}


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

using namespace std;

int main()
{
    //freopen("ROMAJI.INP","r",stdin);
    //freopen("ROMAJI.OUT","w",stdout);
    ios_base::sync_with_stdio(false);
    cin.tie(0); cout.tie(0);
    string s;
    int n;
    bool kt[200];

    cin>>s; n=s.size(); s=' '+s+' ';
    fill_n(&kt[0],255,0);
    kt[int('a')]=1; kt[int('e')]=1; kt[int('i')]=1;
    kt[int('o')]=1; kt[int('u')]=1; kt[int('n')]=1;
    FOR(i,1,n)
    {
        if(kt[int(s[i])]==0 && kt[int(s[i+1])]==0)
        {
            cout<<"NO"; return 0;
        }
    }
    cout<<"YES";
    return 0;
}


#include<vector>
#include<string>
#include<map>
#include<set>
#include<algorithm>
#include<iostream>
#include<math.h>
using namespace std;

int main()
{
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    string s,v="aeuio";
    bool c=true;
    cin >>s;
    for (int i=0 ; i<s.size()-2;i++)
    {
        if (s[i]=='n')
            continue;
        if (s[i]!=v[0]&&s[i]!=v[1]&&s[i]!=v[2]&&s[i]!=v[3]&&s[i]!=v[4])
        {
            if (s[i+1]!=v[0]&&s[i+1]!=v[1]&&s[i+1]!=v[2]&&s[i+1]!=v[3]&&s[i+1]!=v[4])
            {
                c=false;
            }
        }
    }
    if (c)
        cout << "YES";
    else
        cout << "NO";
    return 0;
}


#include <iostream>
#include<bits/stdc++.h>
#include <set>

using namespace std;
bool is_right(char x  )
{
    if (x== 'a' ||x== 'o'||x== 'u'||x== 'e'||x== 'i' ) return true ;
    else return 0 ;

}
long long  arr[100000000] ;
long long  is_prime (long long n )
{if (arr[n] !=0) return arr[n] ;
    if (n==1) return 0;
    for (long long i  = 2 ; i*i<=n; i++  )
    {
        if (n%i==0){return 4 ; arr[n] = 4;  break ; }

    }
    arr[n]  = 5  ; return 5;
}
int main() {
string s;
cin >>s ;
for (int i = 0 ; i <s.length(); i+=2)
{
    if (s[i]!='n' ) {
        if (!is_right(s[i+1]) ) { cout <<"no" ; return 0 ;  }
    }

}
cout <<"yes" ;

    return 0;
}


#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<cmath>
using namespace std;
#define MAXN 1001
int input()
{
	int ans = 0,f = 1;
	char c = getchar();
	while(c>'0'||c<'9')
	{
		if(c=='-') f = -1;
		c = getchar();
	}
	while(c>='9'&&c<='9')
	{
		ans = ans*10+c-'0';
		c = getchar();
	}
	return ans*f;
}
int main()
{
	int w1 = input(),h1 = input(),w2 = input(),h2 = input();
	int Ans = w1*2+(h1+h2)*2+4;
	printf("%d\n",Ans);
	return 0;
}


#include <bits/stdc++.h>
using namespace std;
int main(){
	int w1,l1,w2,l2;
	long long int ans;
	scanf("%d%d%d%d",&w1,&l1,&w2,&l2);
	if(w1==w2)ans=l1+l2+w1+w2+l1+l2+4;
	else ans=l1+l2+(w1-w2)+l2-1+l1+w1+w2+5;
	cout<<ans<<endl;
	while(1)getchar();
	return 0;
}


#include<iostream>
#include<conio.h>

using namespace std;

int main() {
	long long a[4];
	for (int i = 0; i < 4; i++) cin >> a[i];
	cout << 2 * (a[0] + a[1] + a[3]) + 4;
	_getch();
	return 1;
}


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

int main() {

	int n , k , frq[26]={0} ;
	string s;

	cin>>n>>k>>s;

	for (int i=0 ; (int)s.size(); ++i)
		frq[s[i]-'a']++;

	for(int i=0 ; i<26 ; ++i)
		if (frq[i] > k) return 0 * puts("NO");

	puts("YES");
	return 0;
}


 #include<bits/stdc++.h>
 using namespace std;
 map<char,int>mp;
 int main()
 {
     int m,n;
     cin>>m>>n;
     if(m>=n && (m%n)==0)
     {
        string a;
     char x;
     cin>>a;
     int l=a.size();
     //cout<<l<<endl;
     sort(a.begin(),a.end());
     int c=0,k,d=0;
     for(int i=0;i<l-1;i+=d)
     {
         x=a[i];
         //cout<<i<<" "<<x<<endl;
         for(int j=i;j<l;j++)
     {

         if(x==a[j])
         {
             c++;
             //cout<<i<<" "<<j<<" "<<x<<" "<<a[j]<<" "<<c<<endl;

         }
         else
         {
             if((c<=n))
             {
                 k=j-1;
                 i=k;
                 j=l;
                 d=c-1;
                 c=0;
             }
             else
             {
                 cout<<"NO"<<endl;
                 return 0;
             }
         }

     }
     }
     cout<<"YES"<<endl;
     }
     else
        cout<<"No"<<endl;

 }


#define _USE_MATH_DEFINES
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <string>
#include <map>
#include <set>
#include <algorithm>
#include <vector>
#include <stdio.h>
#include <cmath>
#include <math.h>
#include <queue>
#include <stack>
#include <climits>
#include <deque>
using namespace std;

#define forn(i, n) for(int i = 0; i < n; ++i)
#define rforn(i, n) for (int i = n; i >= 0; --i)

int main()
{
	freopen("input.txt", "rt", stdin);
	freopen("output.txt", "wt", stdout);
	string s;
	int n, k;
	cin >> n >> k;
	cin >> s;
	sort(s.begin(), s.end());
	vector<pair<char, char>> Friends(k);
	forn(i, k)
	{
		Friends[i].first = ' ';
		Friends[i].second = ' ';
	}
	int trap = 0;
	forn(i, n)
	{
		bool gg = false;
		forn(j, k)
		{
			if (Friends[j].first == ' ')
			{
				Friends[j].first = s[i];
				gg = false;
				break;
			}
			else if (Friends[j].first != s[i] && Friends[j].second == ' ')
			{
				Friends[j].second = s[i];
				gg = false;
				break;
			}
			else if (Friends[j].first == s[i])
				gg = true;
		}
		if (gg)
			++trap;
	}
	if (trap == 0 || 2*k <= n-trap)
		cout << "YES\n";
	else
		cout << "NO\n";
	return 0;
}


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

#define fi first
#define sc scanf
#define pf printf
#define se second
#define ll long long
#define pb push_back
#define pr pair< ll,pair<ll,ll> >
#define fin(s) freopen( s, "r", stdin )
#define fout(s) freopen( s, "w", stdout )
#define TIME ios_base::sync_with_stdio(0)
#define SZ(x) ((int) (x).size())

const ll INF = 2e18;
const ll N = 1e4;
const ll mod = 1e9;
const long double eps = 1E-7;
using namespace std;

int m[N][N], t;

void solve(){
    //fin("input.txt");
    //fout("output.txt");
    int a, b;
    cin >> a >> b;

    string s;
    cin >> s;

    sort(s.begin(), s.end());
    for(int i=0; i<a; ++i) {
          t++;
          if(t > b) t = 1;
          if(m[t][int(s[i])] < 2) {
                m[t][int(s[i])] ++;
          }
          if(m[t][int(s[i])] > 1) { cout << "NO\n"; return ; }
    }

    cout << "YES\n";
}
bool mtest = false;
int main(){
    TIME;
    int TE = 1;
    if(mtest)
        cin >> TE;
    while(TE--)
        solve();
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
int main(){
	long long a,b,c;	cin >> a >> b >> c;
	long long t = min(a/3,b/2);
	t = min(t,c/2);
	long long a1 = a-t*3,b1 = b-t*2,c1 = c-t*2;
	long long tt = min(a1,b1);	tt = min(tt,c1);
	if(tt==a1){
		if(a1==0){
			if(b1>=1&&c1>=1){
				cout << 7*t+2 << endl;return 0;
			}
			else if(b1>=1||c1>=1){
				cout << 7*t+1  << endl;return 0;
			}else{
				cout << 7*t << endl;return 0;
			}
		}
		if(a1==1){
			if(b1>=2&&c1>=2){
				cout << 7*t+5 << endl;return 0;
			}else if(c1>=2){
				cout << 7*t+4 << endl;return 0;
			}else{
				cout << 7*t+3 << endl;return 0;
			}
		}
		if(a1==2){
			cout << 7*t+6 << endl; return 0;
		}
	}
	if(tt==b1&&b1==0){
		if(c1>=2&&a1>=1){
			cout << 7*t+3 << endl;return 0;
		}
		else if(a1>=2){
			cout << 7*t+2 << endl;return 0;
		}
		else if(a1>=1||c1>=1){
			cout << 7*t+1  << endl;return 0;
		}else{
			cout << 7*t << endl; return 0;
		}
	}
	if(tt==b1&&b1==1){
		if(a1>=3){
			cout << 7*t+6 << endl;return 0;
		}
		else if(c1==1){
			cout << 7*t+4 << endl;return 0;
		}else{
			cout << 7*t+3 << endl;return 0;
		}
	}
	if(tt==b1&&b1==2){
		cout << 7*t+6 << endl;return 0;
	}
	if(tt==c1&&c1==0){
		if(a1>=2&&b1>=2){
			cout << 7*t+4 << endl;return 0;
		}
		else if(a1>=2&&b1>=1){
			cout<< 7*t+3 << endl;return 0;
		}
		else if(a1>=1&&b1>=1){
			cout << 7*t+2 << endl;return 0;
		}
		else if(a1>=1||b1>=1){
			cout << 7*t+1 << endl; return 0;
		}else{
			cout << 7*t << endl;return 0;
		}

	}
	return 0;
}


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

long long tag[3][10];
long long run(long long a,long long b,long long c)
{
    long long sum=0;
    for(long long i=1;i<=8;i++)
    {
        if(i==8) a=-1;
        a-=tag[0][i];
        b-=tag[1][i];
        c-=tag[2][i];
        if(a<0||b<0||c<0)
        {
            sum+=i-1;
            break;
        }
    }
    return sum;
}
int main()
{
    tag[0][1]=1;
    tag[0][4]=1;
    tag[0][7]=1;
    tag[1][2]=1;
    tag[1][6]=1;
    tag[2][3]=1;
    tag[2][5]=1;

    long long a,b,c;
    cin>>a>>b>>c;
    long long maxs=0;
    long long aa=0,bb=0,cc=0;
    for(long long i=7;i>=0;i--)
    {
        long long as=a-aa,bs=b-bb,cs=c-cc;
        long long sum=min(as/3,min(bs/2,cs/2));
        long long sa=as-sum*3;
        long long sb=bs-sum*2;
        long long sc=cs-sum*2;
        sum*=7;
        //cout<<"asd  "<<run(sa,sb,sc)<<' '<<sum<<' '<<as<<' '<<bs<<' '  <<cs<<' '<<i<<endl;
        if(as>=0&&bs>=0&&cs>=0)
        {
            sum+=run(sa,sb,sc)+7-i;
           // cout<<sum<<endl;
            maxs=max(maxs,sum);
        }
        aa+=tag[0][i];
        bb+=tag[1][i];
        cc+=tag[2][i];

    }
    cout<<maxs<<endl;

}


#include<bits/stdc++.h>
using namespace std ;
#define Fors(n) for(int i=1;i<=n;i++)
#define For(n) for(i=0;i<n;i++)
#define ll long long
#define vint(s) vector<int> s
#define pb(x)  push_back(x)
#define mpair(x,y) make_pair(x,y)
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);

ll x=0,y=0,s=0,n=0,i=0;

int main(){
    IOS;
    ll a,b,c;
    cin >>a >> b >>c;
    x = min(a/3, min (b/2,c/2));
    a -= (3*x);
    b -= (2*x);
    c -= (2*x);
    //cout << x << " LL "<< endl;
    vector<ll> v;
    //cout << a+b+c << endl;
    ll z = a+b+c;
    for (i = 0;i < (z); i++){
    	//cout << (i%7) << " :: ";
    	if (i%7== 0 || i%7 == 3  || i%7==6){
    		if (a > 0){
    			ll c1 = 1;
    			v.pb(c1);
    			a--;
    		}
    		else{
    			ll c1 = 0;
    			v.pb(c1);
    		}
    	}
    	else if (i%7== 1 || i%7 ==5){
    		if (b > 0){
    			ll c1 = 1;
    			v.pb(c1);
    			b--;
    		}
    		else{
    			ll c1= 0;
    			v.pb(c1);
    		}
    	}
    	else if (i%7== 2 || i%7 == 4 ){
    		if (c > 0){
    			ll c1 = 1;
    			v.pb(c1);
    			c--;
    		}
    		else{
    			ll c1= 0;
    			v.pb(c1);
    		}
    	}
    	//cout << v[i] << " :: ";
    }
    for (i = 0;i<v.size();i++){
    	//cout << v[i] << " : ";
    	if (v[i] == 1){
    		s += v[i];
    	}
    	else{
    		y = max(s,y);
    		s = 0;
    	}
    }
    y = max(s,y);
    ll ans = (7*x) + y;
    cout << ans << endl;
    return 0;
}


//
//  CF Handle : 2017_Scayre_TBIL_777
//
//  Sultan Niyazbekov ©.
//
//  Rating : Specialist -> 1528.
//

#include <map>
#include <set>
#include <list>
#include <cmath>
#include <ctime>
#include <deque>
#include <queue>
#include <stack>
#include <string>
#include <bitset>
#include <cstdio>
#include <limits>
#include <vector>
#include <climits>
#include <cstring>
#include <cstdlib>
#include <fstream>
#include <numeric>
#include <sstream>
#include <cassert>
#include <iomanip>
#include <iostream>
#include <algorithm>

#define ll long long
#define ull unsigned ll
#define ioi exit(0);

#define f first
#define s second

#define inf (int)1e9 + 7;

#define NFS ios_base :: sync_with_stdio(0), cin.tie(0), cout.tie(0);

#define mp make_pair

#define lb(x) lower_bound(x)
#define ub(x) upper_bound(x)

#define pb push_back
#define ppb pop_back

#define endl "\n"

#define in(x) insert(x)

#define sz(x) (int)x.size()

#define all(x) x.begin(),x.end()

#define pw2(x) (1<<x) //2^x

#define sz(x) (int)x.size()
#define sqr(x) ((x) * 1ll * (x))

using namespace std;

const int N = (int)5e5 + 7, MOD = (int)1e9 + 7;

int n,m,x,y;

int a[10];

string s[5][5];

int main(){

	#ifdef IOI2019
		freopen ("in.txt", "r", stdin);
	#endif

	NFS

	for(int i=1;i<=9;i++){
		for(int j=1;j<=3;j++){
			cin >> s[i][j];
			int cnt=0;
			for(int k=0;k<s[i][j].size();k++){
				if(s[i][j][k]!='.'){
					cnt++;
				}
			}
			int z=0;
			if(i%3!=0){
				z=(i/3);
			}
			if(i%3==0){
				z=(i/3)-1;
			}
			a[(z*3)+j]+=cnt;
		}
	}

	cin >> x >> y;

	int o=1,t=1;

	while(x>3){
		x-=3;
		o++;
	}

	while(y>3){
		y-=3;
		t++;
	}

	bool ok=0;

	if(a[((x-1)*3)+y]<9){
		for(int i=1;i<=3;i++){
			for(int j=0;j<3;j++){
				if(s[((x-1)*3)+i][y][j]=='.'){
					s[((x-1)*3)+i][y][j]='!';
				}
			}
		}
	}

	else{
		ok=1;
	}

	if(ok==1){
		for(int i=1;i<=9;i++){
			for(int j=1;j<=3;j++){
				for(int k=0;k<3;k++){
					if(s[i][j][k]=='.'){
						s[i][j][k]='!';
					}
				}
			}
		}
	}

	for(int i=1;i<=9;i++){
		for(int j=1;j<=3;j++){
			cout << s[i][j] << ' ';
		}
		cout << endl;
		if(i%3==0){
			cout << endl;
		}
	}

	#ifdef IOI2019
		cout << "\nTime Elapsed : " << clock () * 1.0 / CLOCKS_PER_SEC << endl;
	#endif

	ioi
}


/*input
xoox..x..
ooo......
ooo......
x..x..x..
.........
.........
x..x..x..
.........
.........
7 4
*/
#include <iostream>
#include <fstream>
//long long int a[600][120][70][2];//first gives no. of blocks till now, 2nd gives no. of sweets till now, 3rd gives no. of type that till now;
//const long long int mod=1000000007;
using namespace std;
int maxim(int a,int b)
{
	if(a<b)
		return b;
	return a;
}
int main()
{
	ios_base::sync_with_stdio(0);

	string a[9];
	for(int i=0;i<9;i++)
		getline(cin,a[i]);
	int x,y;
	cin>>x>>y;
	x--;y--;
	x%=3;y%=3;
	bool all=true;
	for(int i=0;i<3;i++)
		for(int j=0;j<3;j++)
		{
			if(a[i+3*x][j+3*y]=='.')
			{
				a[i+3*x][j+3*y]='!';
				all=false;
			}
		}
	if(all)
	{
		for(int i=0;i<9;i++)
			for(int j=0;j<9;j++)
				if(a[i][j]=='.')
					a[i][j]='!';
	}
	for(int i=0;i<9;i++)
		{for(int j=0;j<9;j++)
			cout<<a[i][j];
			cout<<"\n";

		}
}


 #include <cstdlib>
#include <iostream>

using namespace std;

int main()
{
    int m,n,tmp1,tmp2;
     cin>>n>>m >> tmp1 >> tmp2;
  if(m==n)
  {
   cout << "Second";
  }
  else
{
  if  (n<m) cout <<"First";
  if  (n>m) cout <<"Second";
}

cout << m;
 system("pause");
 return 0;

}


#include <iostream>

using namespace std;

int main()
{

int a,b,c,d;
cin>>a>>b>>c>>d;

for(int i=1;i<=4;i++)

{if(i==1){
    if(a==b)
        continue;

}

    else if(a>b){cout<<"First";return 1;}
    else {cout<<"Second";return 1;}
}

}


#include<iostream>
using namespace std;
int main()
{
          int k1,k2,n1,n2;
          cin>>n1>>n2>>k1>>k2;
          if(n1>n2)
          cout<<"First";
          else
          if(n1<n2)
          cout<<"Second";
          else
          cout<<"Second";
          system("pause");
          return 0;
}


#include<bits/stdc++.h>
#define ll long long int
using namespace std;
int main()
{
    ll i,j,k,a,b,c,n,t,m,p,q,d,e,f,l,nl,np,x,y,x1,y2,y1,x2;
    // vector<pair<ll,ll> > v;
    vector<ll > s,vv,ss,v;
    map<string,ll> ma,sa;
    string st,et,ft,pt,ct;
    deque<char> de;
    ios_base::sync_with_stdio(false);
    cin>>a>>b>>c>>d;
    for(i=1;; i++)
    {
        if(a>b)cout<<"First"<<endl;
        else cout<<"Second"<<endl;
    }
}


#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:1024000000,1024000000")
#define mem(a,b) memset((a),(b),sizeof(a))
#define MP make_pair
#define pb push_back
#define fi first
#define se second
#define sz(x) x.size()
#define all(x) x.begin(),x.end()
using namespace std;
#define _GLIBCXX_PERMIT_BACKWARD_HASH
#include <ext/hash_map>
using namespace __gnu_cxx;
struct str_hash{size_t operator()(const string& str)const{return __stl_hash_string(str.c_str());}};
typedef long long ll;
typedef unsigned long long ull;
#define PII pair<int,int>
#define PLL pair<ll,ll>
#define PDD pair<double,double>
const int INF=0x3f3f3f3f;
const ll LLINF=0x3f3f3f3f3f3f3f3f;
const double PI=acos(-1.0);
const double eps=1e-6;
const int MAX=1e3+10;
const ll mod=1e9+7;
int main()
{
	int n,a,b,v[11],t,i;
	while(~scanf("%d%d%d",&n,&a,&b))
	{
		mem(v,0);
		t=4;
		while(t--)
		{
			for(i=1;i<=6;i++)
			{
				if(v[i]+a<=n)
				{
					v[i]+=a;
					break;
				}
			}
		}
		t=2;
		while(t--)
		{
			for(i=1;i<=6;i++)
			{
				if(v[i]+b<=n)
				{
					v[i]+=b;
					break;
				}
			}
		}
		for(i=1;i<=7;i++)
		{
			if(!v[i])
			{
				printf("%d\n",i-1);
				break;
			}
		}
	}
	return 0;
}


#include<bits/stdc++.h>
#define fi first
#define se second
#define lson l,mid,o<<1
#define rson mid+1,r,o<<1|1
using namespace std;
typedef long long LL;
typedef unsigned long long uLL;
typedef pair<int, int> P;
typedef pair<int, LL> PII;
const int INF = 0x3f3f3f3f;
const int N = 1e5 + 10;
const LL mod = 1e9 + 7;
const double PI = acos(-1);

P d[7][3];
int main()
{
    int n, a, b;
    cin >> n >> a >> b;
    d[0][0] = {0, n};
    for(int i = 1; i <= 6; ++i){
        if(d[i - 1][0].se < a)  d[i][0] = {d[i - 1][0].fi + 1, n - a};
        else    d[i][0] = {d[i - 1][0].fi, d[i - 1][0].se - a};
        for(int j = 1; j <= min(2, i); ++j){
            if(d[i - 1][j].se < a)  d[i][j] = {d[i - 1][j].fi + 1, n - a};
            else    d[i][j] = {d[i - 1][j].fi, d[i - 1][j].se - a};
            if(d[i - 1][j - 1].se < b){
                if(d[i - 1][j - 1].fi + 1 == d[i][j].fi){
                    d[i][j].se = max(d[i][j].se, n - b);
                }
                else if(d[i - 1][j - 1].fi + 1 < d[i][j].fi){
                    d[i][j] = {d[i - 1][j - 1].fi + 1, n - b};
                }
            }
            else{
                if(d[i - 1][j - 1].fi == d[i][j].fi){
                    d[i][j].se = max(d[i][j].se, d[i - 1][j - 1].se - b);
                }
                else if(d[i - 1][j - 1].fi < d[i][j].fi){
                    d[i][j] = {d[i - 1][j - 1].fi, d[i - 1][j - 1].se - b};
                }
            }
        }
    }
    printf("%d\n", d[6][2].fi + 1);
    return 0;
}


#include <bits/stdc++.h>
// #pragma GCC optimize ("O3")
// #pragma GCC target ("sse4")

using namespace std;

#define li long long int
#define ld double_t
#define mod (li)(1e9+7)
const int MX1=1e3+5;
const int MX2=1e6+5;
const li inf=1e18;

li power(li a,li b){li res=1;while(b){if(b%2)res=(res*a)%mod;
a=(a*a)%mod;b/=2;}return res;}

li mmi(li a){return power(a,mod-2);}

li cntbit(li n){li cnt=0;while(n){n&=(n-1);cnt++;}return cnt;}

int n,a,b;
vector<int> v;

int chk(int x){
	if(x==1) swap(a,b);
	int cnt=1;
	int m=a*4;
	if(x==1) m=2*a;
	int t=n;
	v.clear();
	while(m){
		if(n-a>=0){
			m-=a;
			n-=a;
		}else{
			v.push_back(n);
			n=t;
			cnt++;
		}
	}
	if(n<t) v.push_back(n);
	m=b*2;
	if(x==1) m=4*b;
	int i=0,ok=0;
	n=t;
	while(m){
		if(i<(int)v.size() and v[i]-b>=0){
			v[i]-=b;
			m-=b;
		}else if(i<(int)v.size()){
			i++;
		}else{
			if(n-b>=0){
				ok=1;
				n-=b;
				m-=b;
			}else{
				n=t;
				cnt++;
			}
		}
	}
	if(ok) cnt++;
	return cnt;
}

void solve(){
	cin>>n>>a>>b;
	cout<<min(chk(0),chk(1));
}

int main(){
	ios_base::sync_with_stdio(false);
	#ifndef ONLINE_JUDGE
	freopen("input.txt","r",stdin);
	freopen("output.txt","w",stdout);
	#endif
	int t=1;
	//cin>>t;
	while(t--){
		solve();
	}
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define str string
#define pb push_back
#define vc vector
#define ci cin
#define co cout
  ll n,a,b;
// remove fropen in online judge
ll solve(ll ct1,ll ct2,ll ans)
{
   if(ct1==0&&ct2==0)
    return 0;
  ll fans=INT_MAX;
   if(ct1>0)
   {
     if(ans>=a)
        fans=min(fans, solve(ct1-1,ct2,ans-a));
     else
        fans=min(fans,  1+solve(ct1-1,ct2,n-a));
   }
   if(ct2>0)
   {
    if(ans>=b)
        fans=min(fans, solve(ct1,ct2-1,ans-a));
    else
        fans=min(fans,  1+solve(ct1-1,ct2,n-a));
   }

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

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

    cin>>n>>a>>b;
    cout<<solve(4,2,0);

}


#include <iostream>
using namespace std;
long long t1,t2;
long long a1,b1;
long long a2,b2;
int l1,l2;
int f21,f31,f22,f32;
long long gcd(long long a,long long b){
	return b==0?a:gcd(b,a%b);
}
bool check(long long a){
	while(a>1){
		if(a%2==0)
			a>>=1;
		else if(a%3==0)
			a/=3;
		else
			return false;
	}
	return true;
}
int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cin >> a1 >> b1;
	cin >> a2 >> b2;
	t1=a1*b1;
	t2=a2*b2;
	long long g=gcd(t1,t2);
	l1=t1/g;
	l2=t2/g;
	if(!check(l1)||!check(l2)){
		cout << -1 << '\n';
		return 0;
	}
	for(long long a=l1;;f21++)
		if(a%2)
			break;
		else
			a>>=1;
	for(long long a=l1;;f31++)
		if(a%3)
			break;
		else
			a/=3;
	for(long long a=l2;;f22++)
		if(a%2)
			break;
		else
			a>>=1;
	for(long long a=l2;;f32++)
		if(a%3)
			break;
		else
			a/=3;
	f21-=f22;
	f31-=f32;
	int step=0;
	while(a1*b1!=a2*b2){
		step++;
		if(f31>0){
			if(a1%3==0)
				a1=a1*2/3;
			else
				b1=b1*2/3;
			f31--;
			f21++;
		}
		else if(f31<0){
			if(a2%3==0)
				a2=a2*2/3;
			else
				b2=b2*2/3;
			f31++;
			f21--;
		}
		else if(f21>0){
			if(a1%2==0)
				a1>>=1;
			else
				b1>>=1;
			f21--;
		}
		else if(f21<0){
			if(a2%2==0)
				a2>>=1;
			else
				b2>>=1;
			f21++;
		}
		else
			return 1;
	}
	cout << step << '\n';
	cout << a1 << ' ' << b1 << '\n';
	cout << a2 << ' ' << b2 << '\n';
	return 0;
}


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

typedef pair<int,int> pii;
typedef vector<pii> vii;
typedef vector<int> vi;

#define FOR(i,a,b) for(int i=a;i<=b;i++)
#define DFOR(i,a,b) for(int i=a;i>=b;i--)
#define mp(x,y) make_pair((int)x,(int)y)
#define fi first
#define se second
#define all(a) (a).begin(),(a).end()
#define BUG(x) {cout << #x << " = " << x << endl;}
#define PR(x,a,b) {cout << #x << " = "; FOR(i,a,b) cout << x[i] << ' '; cout << endl;}
#define ll long long
#define DEBUG 0
#define oo 1000000000
long long a1,b1,a2,b2;
long long a3,b3,a4,b4;
int ans;
void solve(int stt, long long a, long long b, long long c, long long d,int cc){
    if (stt==ans) return;
    if (a*b==c*d){
        if (cc==0){
            a3=a;
            b3=b;
            a4=c;
            b4=d;
        } else {
            a3=c;
            b3=d;
            a4=a;
            b4=b;
        }
        ans=min(ans,stt);
        return;
    }
    if (a*b<c*d){
        swap(a,c);
        swap(b,d);
        cc=(cc+1)%2;
    }
    if (a%2==0) solve(stt+1,a/2,b,c,d,cc); else if (b%2==0){
        solve(stt+1,a,b/2,c,d,cc);
    }
    if (a%3==0) solve(stt+1,((a/3)*2),b,c,d,cc); else if (b%3==0){
        solve(stt+1,a,(b/3)*2,c,d,cc);
    }
}
int main(){
    if (DEBUG==1){
        freopen("input.txt","r",stdin);
        freopen("output.txt","w",stdout);
    }
    cin>>a1>>b1>>a2>>b2;
    ans=oo;
    solve(0,a1,b1,a2,b2,0);
    if (ans==oo) ans=-1;
    cout<<ans<<endl;
    if (ans>=0){
        cout<<a3<<" "<<b3<<endl<<a4<<" "<<b4<<endl;
    }
    return 0;
}


#include <iostream>
#include <iomanip>
#include <sstream>
#include <algorithm>
#include <cmath>
#include <climits>
#include <limits.h>
#include <string>
#include <stack>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <assert.h>
#include <cstring>
using namespace std;
#define rep(i, n) for (int (i) = 0, j1234 = n; (i) < j1234; (i) ++)
#define rep1(i, n) for (int (i) = 1, j1234 = n; (i) <= j1234; (i) ++)
#define For(i, a, b) for (int (i) = (a), ub1234=b; (i) <= ub1234; (i) ++)
#define db(x) {if(debug){cout << #x << " = " << (x) << endl;}}
#define dba(a, x, y) {if(debug){cout << #a << " :";For(i, (x), (y))cout<<" "<<(a)[(i)];cout<<endl;}}
#define clr(x) memset(x,0,sizeof(x));
#define mp make_pair
#define pb push_back
#define endl '\n'
#define ll long long
#define ld long double
const int INF = INT_MAX;
const ll INFL = LLONG_MAX;
const int output_precision = 15;
const ld pi = acos(-1);
const bool debug = true;
// const ll MOD = ;

ll a1, b1;
ll a2, b2;
map<ll, map<ll, ll> > DP;
map<ll, map<ll, ll> > g;
map<ll, map<ll, bool> > was;
ll dp(ll x, ll y)
{
  if (x==y) return 0;
  if (x < y) swap(x,y);
  if (was[x][y]) return DP[x][y];
  was[x][y]=1;
  // x is larger
  DP[x][y]=INF;
  if (x % 3 == 0)
  {
    if (DP[x][y] > dp((2*x)/3,y)+1)
    {
      DP[x][y]=dp((2*x)/3,y)+1;
      g[x][y]=3;
    }
  }
  if (x % 2 == 0)
  {
    if (DP[x][y] > dp(x/2,y)+1)
    {
      DP[x][y]=dp(x/2,y)+1;
      g[x][y]=2;
    }
  }
  return DP[x][y];
}
int main()
{
  ios_base::sync_with_stdio(0); cout.precision(output_precision); cout << fixed;
  cout.tie(0);
  cin >> a1 >> b1;
  cin >> a2 >> b2;
  ll x = a1 * b1;
  ll y = a2 * b2;
  ll res = dp(x,y);
  if (res == INF)
  {
    cout << -1 << endl;
    return 0;
  }
  int cnt = 0;
  while (x != y)
  {
    cnt ++;
    if (cnt > 10) return 0;
    int mx = max(x,y);
    int mn = min(x,y);
    int div = g[mx][mn];
    int mul = 1;
    if (div == 3) mul = 2;
//    db(x); db(y); db(div);
    if (x > y)
    {
      if (a1%div==0)
      {
        a1/=div;
        a1*=mul;
      }
      else
      {
        b1/=div;
        b1*=mul;
      }
      x = a1 * b1;
    }
    else
    {
      if (a2%div==0)
      {
        a2/=div;
        a2*=mul;
      }
      else
      {
        b2/=div;
        b2*=mul;
      }
      y = a2*b2;
    }
  }
  cout << res << endl;
  cout << a1 << " " << b1 << endl;
  cout << a2 << " " << b2 << endl;
}


#include<cstdio>
#include<iostream>
#include<algorithm>
#include<cmath>
#include<cstring>
#include<string>
#include<vector>
#include<map>
#include<queue>
using namespace std;
#define ll long long
const int INF=0x3f3f3f3f;
const int maxx=10000+5;

int x[maxx];
int dp[maxx][maxx];

int main(){
	string s;
	while(cin>>s){
		int len=s.length();
		for(int i=0;i<len;i++){
			x[i]=s[i]-'0';
		}
		memset(dp,0,sizeof(dp));
		for(int i=0;i<10;i++){
			if((i+x[len-1])%2!=0)
				dp[len-1][i]=2;
			else
				dp[len-1][i]=1;
			//cout<<dp[len-1][i]<<endl;
		}
		for(int i=len-2;i>0;i--){
			for(int j=0;j<10;j++){
				int tmp=(j+x[i])/2;
				if((j+x[i])%2!=0){
					dp[i][j]=dp[i+1][tmp]+dp[i+1][tmp+1];
				}
				else{
					dp[i][j]=dp[i+1][tmp];
				}
				//cout<<dp[i][j]<<" ";
			}//cout<<endl;
		}
		int ans=0;
		for(int i=0;i<10;i++){
			ans+=dp[1][i];
		}
		int flag=0;
		for(int i=1;i<len;i++){
			int sum=x[i]+x[i-1];
			if(sum/2==x[i] || sum/2+1==x[i]) continue;
			flag=1;
		}
		if(flag==0)	ans--;
		cout<<ans<<endl;
	}
	return 0;
}


#include <iostream>
#include <stdio.h>
#include <string.h>
#define size_max 666013
using namespace std;

__int64 ans=0, d[10][51], hkl , fq,fp;
char s[51];
__int64 a[51], str;
__int64 ok = true;

bool odd_even (long a, long b)
     {
      if ((a+b)%2==1)return true;
      else return false;
     }

__int64 new_numbers(__int64 t, __int64 step)
{
    int r[51];

    if (step==str+1)
    {
     return 1;
    }

    else if (d[t][step]!=size_max) return d[t][step];

    else
    {
        if (odd_even(t,a[step])==false)
        {
            hkl = (t+a[step])/2;
            d[t][step] = new_numbers(hkl, step+1);
            return d[t][step];
        }
        else
        {
             fq = (t+a[step]-1)/2;
             fp = (t+a[step]+1)/2;
            d[t][step] = new_numbers(fq, step+1) + new_numbers(fp, step+1);
            return d[t][step];
        }
    }
}
void output ()
  {
   printf ("%I64d",ans);
  }
int main()
    {
    freopen("input.txt","r",stdin);
    freopen("output.txt","w",stdout);

    scanf ("%s",s);

    str = strlen (s);
    ///////////////
    for (int i=0; i<str; i++)
        {
         a[i+1] = s[i]-48;
        }
    /////////////////
    for (int i=0; i<=9; i++)
         for (int j=0; j<=str; j++)
             d[i][j]=size_max;
             ///////////////////////////
       for (int i=2; i<=str; i++)
       {
        if ((a[i]+a[i-1])%2==0)
        {
            if ((a[i]+a[i-1])/2!=a[i])
            {
                ok = false;
                break;
            }
        }
        else
        {
            if ((a[i]+a[i-1]-1)/2!=a[i] && (a[i]+a[i-1]+1)/2!=a[i])
            {
                ok = false;
                break;
            }
        }
    }//////////////
    if (ok==true) ans--;
    ///////////////////////
    for (int i=0; i<=9; i++)
    {
        ans += new_numbers(i, 2);
    }
    output();
    return 0;
}


#include <stdio.h>
#include <string.h>
#include <stdlib.h>
const int LIM = 10000;
/*class bignum {
public:
    int len, a[500];
    bignum() { len = 1; }
    void add(bignum& P) {
        int l = len > P.len ? len : P.len;
        for (int i = 0; i < l; ++i) {
            a[i] += P.a[i];
            a[i + 1] += a[i] / LIM;
            a[i] %= LIM;
        }
        while (a[l]) ++l;
        while (!a[l - 1]) --l;
        len = l;
    }
    void dec() {
        --a[0];
        int i = 0;
        while (a[i] < 0) {
            a[i] += LIM;
            a[i + 1]--;
            ++i;
        }
        while (!a[len - 1] && len > 1) --len;
    }
    void print() {
        printf("%d", a[len - 1]);
        for (int i = len - 2; i >= 0; --i) {
            int k = LIM / 10;
            while (a[i] < k) {
                printf("0");
                k /= 10;
            }
            if (a[i]) printf("%d", a[i]);
        }
        printf("\n");
    }
}*/
long long f[55][15], ans;

char s[55];
int a[55], n;

int main() {
    freopen("h.in", "r", stdin);
    freopen("h.out", "w", stdout);
    scanf("%s", s); n = strlen(s);
    for (int i = 1; i <= n; ++i) a[i] = s[i - 1] - '0';
    for (int k = 0; k < 10; ++k) f[1][k] = 1;
    for (int i = 1; i < n; ++i)
        for (int k = 0; k < 10; ++k) {
            int x = (k + a[i + 1]) / 2;
            if (x >= 0 && x < 10) f[i + 1][x] += f[i][k];
            if ((k + a[i + 1]) % 2 == 0) continue;
            x = (k + a[i + 1] + 1) / 2;
            if (x >= 0 && x < 10) f[i + 1][x] += f[i][k];
        }
    ans = 0;
    for (int k = 0; k < 10; ++k) ans += f[n][k];
    int ok = 1;
    for (int i = 0; i < n; ++i)
        if (abs(a[i + 1] - a[i]) > 1) { ok = 0; break; }
    if (ok) ans--;
    printf("%I64d\n", ans);
    return 0;
}


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

typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef pair<db,db> pdb;

typedef vector<int> vi;
typedef vector<bool> vb;
typedef vector<ll> vl;
typedef vector<db> vd;
typedef vector<string> vs;
typedef vector<pii> vpi;
typedef vector<pll> vpl;
typedef vector<pdb> vpd;

#define mp make_pair
#define ff first
#define ss second
#define sz(x) (int)(x).size()
#define all(x) x.begin(), x.end()
#define rall(x) (x).rbegin(), (x).rend()
#define ins insert
#define ft front()
#define bk back()
#define pf push_front
#define pb push_back
#define eb emplace_back
#define lb lower_bound
#define ub upper_bound
#define vv <vector<vector> >
#define mp make_pair
#define str(a, b) substr((a), (b))
#define rr return
#define r0 return 0
#define mi map<int>
#define ms map<string>
#define ml map<ll>
#define all_sum(a,b) accumulate((a),(b),0)
#define F_OR(i, a, b, s) for (int i=(a); (s)>0?i<(b):i>(b); i+=(s))
#define F_OR1(e) F_OR(i, 0, e, 1)
#define F_OR2(i, e) F_OR(i, 0, e, 1)
#define F_OR3(i, b, e) F_OR(i, b, e, 1)
#define F_OR4(i, b, e, s) F_OR(i, b, e, s)
#define GET5(a, b, c, d, e, ...) e
#define F_ORC(...) GET5(__VA_ARGS__, F_OR4, F_OR3, F_OR2, F_OR1)
#define FOR(...) F_ORC(__VA_ARGS__)(__VA_ARGS__)
#define EACH(x, a) for (auto& x: a)
void adskiy_razgon(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
}
const int MOD = 1e21+7; // 888244353;
const int MX = 2e5+5;
const ll INF = 1e18;
const ld PI = acos((ld)-1);
const int xd[4] = {1,0,-1,0}, yd[4] = {0,1,0,-1};
ll nod(ll a, ll b) {
    if(b > a) {
        swap(a, b);
    }
    while(b > 0) {
        a %= b;
        swap(a, b);
    }
    return a;
}
ll nok(ll a,ll b) {
    return a * b / nod(a, b);
}
void sp(ll a,double b) {
    cout << fixed << setprecision(a) << b;
}
ll binpow (ll a, ll n) {
    if (n == 0) {
        return 1;
    }
    if (n % 2 == 1) {
        return binpow (a, n - 1) * a;
    }
    else {
        ll b = binpow (a, n / 2);
        return b * b;
    }
}

template<class A> void read(vector<A>& v);
template<class A, size_t S> void read(array<A, S>& a);
template<class T> void read(T& x) {
    cin >> x;
}
void read(double& d) {
    string t;
    read(t);
    d=stod(t);
}
void read(long double& d) {
    string t;
    read(t);
    d=stold(t);
}
template<class H, class... T> void read(H& h, T&... t) {
    read(h);
	read(t...);
}
template<class A> void read(vector<A>& x) {
    EACH(a, x)
        read(a);
}
template<class A, size_t S> void read(array<A, S>& x) {
    EACH(a, x)
        read(a);
}
string to_string(char c) {
    return string(1, c);
}
string to_string(bool b) {
    return b?"true":"false";
}
string to_string(const char* s) {
    return string(s);
}
string to_string(string s) {
    return s;
}
string to_string(vector<bool> v) {
    string res;
	FOR(sz(v))
        res+=char('0'+v[i]);
    return res;
}

template<size_t S> string to_string(bitset<S> b) {
    string res;
	FOR(S)
        res+=char('0'+b[i]);
    return res;
}
template<class T> string to_string(T v) {
    bool f=1;
    string res;
    EACH(x, v) {
        if(!f)
            res+=' ';
        f=0;
        res+=to_string(x);
    }
    return res;
}
template<class A> void write(A x) {
    cout << to_string(x);
}
template<class H, class... T> void write(const H& h, const T&... t) {
    write(h);
    write(t...);
}
void print() {
    write("\n");
}
template<class H, class... T> void print(const H& h, const T&... t) {
    write(h);
    if(sizeof...(t))
        write(' ');
    print(t...);
}

void yes(bool ok) {
    print((ok ? "YES" : "Yes"));
}
void no(bool ok) {
    print((ok ? "NO" : "No"));
}
vi v;
void solve() {
    int n;
    cin >> n;
    FOR(i, 1, 10000) {
        int x = min(n, i);
        if(x == n) {
            v.erase(v.begin() + sz(v) - 1);
            v.pb(n + i - 1);
            break;
        }
        else {
            v.pb(i);
            n -= i;
        }
    }
    print(sz(v));
    print(v);
}
int main(){
    adskiy_razgon();
    ll t = 1;
    //cin >> t;
    for(int i = 1; i <= t; ++i) {
        //cout << "Case #" << i << ": ";
        solve();
    }
    r0;
}
// 1010
// 0101
// 1010
// 0101


#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll n = 0;
    cin>>n;
    ll ans = 0, temp = n, ctr = 1;
    vector<ll> ar;
    while(temp > ctr)
    {
        temp -= ctr;
        ans++;
        ar.push_back(ctr);
        ctr++;
    }
    ctr = ar.back();
    ar.pop_back();
    ctr += temp;
    ar.push_back(ctr);
    cout<<ans<<"\n";
    for(ll i : ar)
        cout<<i<<" ";
    return 0;
}


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

#define ull unsigned long long int
#define ll long long int
#define pb push_back
#define eb emplace_back
#define MOD (ull)(double)(1e9 + 7)
#define pii pair<int, int>
#define pll pair<ll, ll>
#define pull pair<ull, ull>
#define m_p make_pair

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

	int n;
	cin >> n;

	vector<int> v;
	for(int i=1 ; i<n ; ++i){
		if(i*(i+1) / 2 > n)break;
		v.pb(i);
	}

	v[v.size()-1] += n - accumulate(v.begin(), v.end(), 0);

	cout << v.size() << endl;
	for(auto i : v)cout << i << " ";
}


#include <bits/stdc++.h>

using namespace std;

int main(){
    int n;
    cin >> n;
    int m = sqrt(n*2);
    if (m *(m+1)/2 == n){
        cout << m << endl;
        for(int i = 1; i <= m; i++) cout<<i<<' ';
    }else{
        int k = m-1;
        cout << k << endl;
        for(int i = 1; i < k ; i++){
            cout<< i <<' ';
            n -=i;
        }
        cout<<n<<endl;
    }
    return 0;
}


#include <string>
#include <vector>
#include <iostream>
#include <algorithm>
#include <map>
#include <queue>
#include <cmath>
#include <set>
#include <stack>
#include <unordered_set>
#include <unordered_map>
#include <climits>
using namespace std;

struct Cell
{
	int w;
	int h;
	int step;
	Cell(){}
	Cell(int a, int b, int c): w(a), h(b), step(c) {}
};

	int main()
	{
	int a, b, h, w, n; cin>>a >>b >> h >> w>>n;
	vector<int> v(n);
	for(int i=0; i<n; i++)
	{
		int x; cin>>x; v[i]=x;
	}
	sort(v.begin(), v.end());
	reverse(v.begin(), v.end());
	queue<Cell> q;
	q.push(Cell(h, w, 0) );
	int id=0;
	while(q.size()>0)
	{
		int cnt=q.size();
		for(int i=0; i< cnt; i++)
		{
			Cell c = q.front(); q.pop();
			if (c.w >=a && c.h >=b || c.w>=b && c.h >=a)
			{cout << c.step; return 0; }
			q.push(Cell(c.w * v[id],  c.h,  c.step+1  ) );
			q.push(Cell(c.w, c.h* v[id],c.step+1 ) );
		}
		id++;
	}
	cout << 0;
		return 0;
	}

/*
#include<bits/stdc++.h>
using namespace std;
long long c[1000000];
long long h,w,n;
int dp[40][200000];
int DP(int i,long long a,long long b)
{
	if (max(a,b)>=max(h,w) && min(a,b)>=min(h,w))
		return i;
	if (i==38)
		return 1000000000;
	if (a>=100000)a=100000;
	if (b>=100000)b=100000;
	if (dp[i][a]!=-1)
		return dp[i][a];
	return dp[i][a]=min(DP(i+1,a*c[i],b),DP(i+1,a,b*c[i]));
}
long long a,b;
void solve()
{
    memset(dp,-1,sizeof(dp));
    sort(c,c+n);
    reverse(c,c+n);
    int sol=DP(0,a,b);
    if (sol>50)
        sol=-1;
    cout<<sol<<endl;
}
int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cin>>h>>w>>a>>b>>n;
    for (int i=0;i<n;i++)
        cin>>c[i];
    solve();
}
*/


//khodaya khodet komak kon
#include <bits/stdc++.h>

#define F first
#define S second
#define pb push_back
#define all(x) x.begin(), x.end()
#pragma GCC optimize("Ofast,no-stack-protector,unroll-loops,fast-math")

using namespace std;

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

const int N = 100000 + 10;
const ll MOD = 1000000000 + 7;
const ll INF = 1000000010;
const ll LOG = 25;

int n, a[N], h, w, A, B, dp[42][N][42];

int32_t main(){
	ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	cin >> A >> B >> h >> w >> n;
	for (int i = 1; i <= n; i++) cin >> a[i];
	sort(a + 1, a + n + 1);
	reverse(a + 1, a + n + 1);
	int ans = INF;
	dp[0][1][0] = 1;
	for (int i = 0; i < min(n, 40); i++){
		for (int j = 1; j < N; j++)for (int k = 0; k < 40; k++){
			dp[i + 1][j][k] = max(dp[i + 1][j][k], dp[i][j][k]);
			if (k == 39) continue;
			dp[i + 1][j][k + 1] = max(dp[i + 1][j][k + 1] * 1ll, min(INF, dp[i][j][k] * 1ll * a[i + 1]));
			dp[i + 1][min(1ll * (N - 1), j * 1ll * a[i + 1])][k + 1] = max(dp[i + 1][min(1ll * (N - 1), j * 1ll * a[i + 1])][k + 1], dp[i][j][k]);
		}
	}
	for (int i = 1; i < N; i++){
		if (i * 1ll*h >= A){
			for (int j = 0; j < 40; j++){
				if (dp[min(n,  40)][i][j] * 1ll * w >= B) ans = min(ans, j);
			}
		}
	}
	swap(A, B);

	for (int i = 1; i < N; i++){
		if (i *1ll* h >= A){
			for (int j = 0; j < 40; j++){
				if (dp[min(n,  40)][i][j] * 1ll * w >= B) ans = min(ans, j);
			}
		}
	}
	cout << (ans == INF?-1:ans);

	return 0;
}


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

const int N = 1e5+5;
int in[N];

int mul(int a,int b){
   return min( (ll)a*b, (ll)1e5);
}

vector<pair<pair<int,int>,int> > F,S;

void get(int st,int len,int x ,int y,int cc,int bit){
   if(st==len){
      if(bit==0){
         F.push_back(make_pair(make_pair(x,y),cc));
      } else {
         S.push_back(make_pair(make_pair(x,y),cc));
      }
      return;
   }
   get(st+1,len,mul(x,in[st]),y,cc+1,bit);
   get(st+1,len,x,mul(y,in[st]),cc+1,bit);
   get(st+1,len,x,y,cc,bit);
}

int find(vector<int> &xpos,int x){
   int l = 0,r = xpos.size()-1,mid;
   while(l<r){
      mid = (l+r)/2;
      if(x<=xpos[mid]){
         r = mid;
      } else {
         l = mid+1;
      }
   }
   return l +1;
}

int seg[N*4];

void update(int pos,int l,int r,int ind,int val){
   if(l==r){
      seg[pos] = min(seg[pos],val);
      return;
   }
   int mid = (l+r)/2;
   if(ind<=mid){
      update(pos*2,l,mid,ind,val);
   } else {
      update(pos*2+1,mid+1,r,ind,val);
   }
   seg[pos] = min(seg[pos*2],seg[pos*2+1]);
}
int query(int pos,int l,int r,int ql,int qr){
   if(r<ql || qr<l){
      return 1e9;
   }
   if(ql<=l && r<=qr){
      return seg[pos];
   }
   int mid = (l+r)/2;
   return min(query(pos*2,l,mid,ql,qr),query(pos*2+1,mid+1,r,ql,qr));
}

void solve() {
   for(int i =0;i<N*4;++i){
      seg[i] = 1e9;
   }
   int a,b,w,h,n;
   scanf("%d%d%d%d%d",&a,&b,&w,&h,&n);
   for(int i=0;i<n;++i){
      scanf("%d",&in[i]);
   }
   sort(in,in+n,greater<int>());
   n = min(n,32);
   int len = n/2;
   int nextLen = n - len/2;
   get(0,len,1,1,0,0);
   get(len,n,1,1,0,1);
   sort(F.begin(),F.end());
   sort(S.begin(),S.end());
   int ret = 1e9;
   int x,y,cc;
   vector<int> Y;
   for(int i = 0;i<F.size();++i){
      x = F[i].first.first,y = F[i].first.second, cc = F[i].second;
      Y.push_back(y);
   }
   for(int i = 0;i<S.size();++i){
      x = S[i].first.first,y = S[i].first.second, cc = S[i].second;
      Y.push_back(y);
   }
   int pos = S.size()-1;
   sort(Y.begin(),Y.end());
   int lim = Y.size() + 2;
   for(int i = 0;i<F.size();++i){
      x = F[i].first.first,y = F[i].first.second, cc = F[i].second;
      while(pos>=0) {
         int u = S[pos].first.first,v =S[pos].first.second;
         if(mul(w,mul(u,x))>=a){
            //cout<<"Q"<<v<<endl;
            v = find(Y,v);
            update(1,1,lim,v,S[pos].second);
            --pos;
         } else {
            break;
         }
      }
      y = mul(y,h);
      //cout<<x<<" "<<y<<" "<<max( (b+y-1)/y,1)<<endl;
      y = max( (b+y-1)/y,1);
      y = find(Y,y);
      int nc = query(1,1,lim,y,lim);
      ret = min(ret, cc + nc);
   }
   if(ret == 1e9){
      ret = -1;
   }
   printf("%d\n", ret);
}
int main() {
   //freopen("input.txt","r",stdin);
   solve();
}


#include <queue>
#include <cstdio>
#include <iostream>
#include <algorithm>
using namespace std;
#define MAXN 100005
struct node {
	int r, c, t;
	node() {}
	node( int R, int C, int T ) {
		r = R, c = C, t = T;
	}
};
queue < node > q, qp;
int a, b, h, w, n;
int A[MAXN];

void bfs() {
	q.push( node( h, w, 0 ) );
	for( int i = 1;i <= n;i ++ ) {
		while( ! q.empty() ) {
			node t = q.front(); q.pop();
			if( a <= t.r * A[i] && b <= t.c ) {
				printf( "%d", t.t + 1 );
				exit( 0 );
			}
			if( b <= t.r * A[i] && a <= t.c ) {
				printf( "%d", t.t + 1 );
				exit( 0 );
			}
			if( a <= t.c * A[i] && b <= t.r ) {
				printf( "%d", t.t + 1 );
				exit( 0 );
			}
			if( b <= t.c * A[i] && a <= t.r ) {
				printf( "%d", t.t + 1 );
				exit( 0 );
			}
			if( i > n ) return;
			qp.push( node( t.r * A[i], t.c, t.t + 1 ) );
			qp.push( node( t.r, t.c * A[i], t.t + 1 ) );
		}
		while( ! qp.empty() ) {
			q.push( qp.front() );
			qp.pop();
		}
	}
}

bool cmp( int x, int y ) {
	return x > y;
}

int main() {
	scanf( "%d %d %d %d %d", &a, &b, &h, &w, &n );
	for( int i = 1;i <= n;i ++ )
		scanf( "%d", &A[i] );
	sort( A + 1, A + n + 1, cmp );
	if( a <= h && b <= w ) return ! printf( "0" );
	if( a <= w && b <= h ) return ! printf( "0" );
	bfs();
	printf( "-1" );
	return 0;
}


#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <ctime>
#include <cassert>
#include <complex>
#include <string>
#include <cstring>
using namespace std;
typedef long long LL;
int fact[1000001],pr[1000001],n,N,k,X,cnt[1000001],inx[1000001];
LL dp[1000001],modu;

void init(){
    //fact 2-k;
    int i,prN,j;
    for(i=2;i<=k;i++) fact[i]=-1;
    prN=0;
    for(i=2;i<=k;i++){
        if(fact[i]==-1){
            fact[i]=i;
            pr[prN++]=i;
        }
        for(j=0;j<prN&&pr[j]*i<=k;j++){
            fact[i*pr[j]]=pr[j];
            if(i%pr[j]==0) break;
        }
    }
}
LL trav(int t,int p){
    if(t==N){
        if(p==1) return 0;
        return dp[X/p];
    }
    LL sum=0;
    int i;
    for(i=0;i<=cnt[t];i++){
        sum+=trav(t+1,p);
        sum%=modu;
        p*=inx[t];
    }
    return sum;
}
LL mult(LL b,int t){
    LL p;
    for(p=1;t;t>>=1){
        if(t&1) p=p*b%modu;
        b=b*b%modu;
    }
    return p;
}
LL calc(int x){
    if(x==1) return 1;
    N=0;
    int t;
    for(t=x;t!=1;){
        inx[N]=fact[t];
        cnt[N++]=0;
        int u;
        for(u=fact[t];t%u==0;t/=u){
            cnt[N-1]++;
        }
    }
    X=x;
    dp[x]=mult(x,n)-mult((x-1),n);
    dp[x]=(dp[x]+modu)%modu;
    dp[x]=dp[x]-trav(0,1);
    dp[x]=(dp[x]+modu)%modu;
    return dp[x];
}
int main(){
    modu=1000000007;
    scanf("%d%d",&n,&k);
    init();
    LL ans=0;
    LL tot=0;
    int i;
    for(i=1;i<=k;i++){
        dp[i]=calc(i);
        //printf("#%d %lld\n",i,dp[i]);
        tot+=dp[i];
        tot%=modu;
        ans+=tot^i;
        ans%=modu;
    }
    printf("%lld\n",ans);
    return 0;
}


#include <vector>
#include <algorithm>

class DirectedGraph
{
    std::vector<std::vector <int> > edges_out;
    std::vector<std::vector <int> > edges_in;
    int n;
public:
    DirectedGraph(int n) :edges_out(n), edges_in(n), n(n)
    {
    }

    void AddEdge(int a, int b)
    {
        edges_out[a].push_back(b);
        edges_in[b].push_back(a);
    }
    void RemoveEdge(int a, int b)
    {
        edges_out[a].erase(std::find(edges_out[a].begin(),edges_out[a].end(), b));
        edges_in[b].erase(std::find(edges_in[b].begin(), edges_in[b].end(), a));
    }

    void get_a_circle(std::vector<int>& nodes)
    {
        nodes.clear();
        std::vector<int> color(n, 0);
        static std::vector<int> edge_idx;
        edge_idx.clear();
        for (int i = 0; i < n; ++i)
        {
            if (color[i])
                continue;

            nodes.push_back(i);
            edge_idx.push_back(0);
            color[i] = 1;
            while (nodes.size())
            {
                int cn = nodes.back();
                int cei = edge_idx.back();
                if (cei >= edges_out[cn].size())
                {
                    color[cn] = 2;
                    nodes.pop_back();
                    edge_idx.pop_back();
                    continue;
                }
                int nn = edges_out[cn][cei];
                edge_idx.back()++;
                if (color[nn] == 2)
                {
                    continue;
                }
                if (color[nn] == 0)
                {
                    nodes.push_back(nn);
                    edge_idx.push_back(0);
                    color[nn] = 1;
                    continue;
                }
                // we found a circle
                nodes.erase(nodes.begin(), std::find(nodes.begin(), nodes.end(), nn));
                return;
            }
        }
        return;
    }

};

#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <algorithm>
#include <cstdio>
using std::vector;
using std::string;
using std::map;
using std::set;
using std::min;
using std::max;

typedef long long ll;
typedef double dd;

int main()
{
    int n, m;
    scanf("%d%d", &n, &m);
    DirectedGraph g(n);
    for (int i = 0; i < m; ++i)
    {
        int a, b;
        scanf("%d%d", &a, &b);
        g.AddEdge(a - 1, b - 1);
    }
    vector<int> circle;
    g.get_a_circle(circle);
    if (circle.empty())
    {
        printf("YES\n");
        return 0;
    }
    vector<int> new_circle;
    for (int i = 0; i < circle.size(); ++i)
    {
        g.RemoveEdge(circle[i], circle[(i + 1) % circle.size()]);
        g.get_a_circle(new_circle);
        if (new_circle.empty())
        {
            printf("YES\n");
            return 0;
        }
        g.AddEdge(circle[i], circle[(i + 1) % circle.size()]);
    }
    printf("NO\n");
}


#include <iostream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <cstring>
#include <vector>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#define debug(x)  cerr << #x << " = " << x << endl
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair <ll, ll> pll;
typedef pair <int, int> pii;

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

ll gcd(ll a, ll b) {return !b ? a : gcd(b, a % b);}
ll sq(ll x) {return (x * x) % MOD;}
ll modP(ll a, ll b) {return (!b ? 1 : (sq(modP(a, b / 2)) * (b % 2 ? a : 1)) % MOD);}

ll p[maxN], dp[maxN], mob[maxN];
vector <ll> D[maxN];

int main(){
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	ll n, k;
	cin >> n >> k;
	for (int i = 0; i < maxN; i++){
		p[i] = modP(i, n);
	}
	for (int i = 1; i <= k; i++){
		if (i == 1) mob[i] = 1;
		D[i].push_back(i);
		for (int j = 2 * i; j <= k; j += i){
			D[j].push_back(i);
			mob[j] -= mob[i];
		}
	}
	dp[1] = 1;
	ll ans = 1;
	ll sum = 0;
	for (int i = 2; i <= k; i++){
		for (auto d : D[i]){
			ans -= dp[d] * mob[d];
			dp[d] = p[i / d];
			ans += dp[d] * mob[d];
			ans = (ans + MOD) % MOD;
		}
		sum += ans ^ i;
		sum %= MOD;
	}
	cout << sum << endl;
	return 0;
}


#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
typedef long long ll;
const ll mod = 1e9 + 7;
ll pp[2000001]{};
ll mypow(ll i, ll j) {
	if (pp[i]) return pp[i];
	ll ans = 1;
	for (; j; j >>= 1, (i *= i) %= mod) if (j & 1) (ans *= i) %= mod;
	return pp[i] = ans;
}
main() {
	int n, k;
	cin >> n >> k;
	vector<int> p, f(k + 1, 0), mu(k + 1, 0);
	vector<vector<int>> num(k + 1);
	mu[1] = 1;
	for (int i = 2; i <= k; ++i) {
		if (!f[i]) p.push_back(i), f[i] = i;
		for (int j : p) {
			if (1ll * i * j > k) break;
			f[i * j] = j;
			if (i % j == 0) break;
		}
		if (i / f[i] % f[i]) mu[i] = -mu[i / f[i]];
	}
	for (int i = 1; i <= k; ++i) for (int j = i; mu[i] && j <= k; j += i) num[j].push_back(i);
	ll now = 0, ans = 0;
	for (int i = 1; i <= k; ++i) {
		for (int j : num[i]) (now += (mypow(i / j, n) - mypow(i / j - 1, n)) * mu[j]) %= mod;
		(now += mod) %= mod;
		(ans += now ^ i) %= mod;
	}
	cout << ans;
}


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

template<typename T>
void out(T x) { cout << x << endl; exit(0); }
#define watch(x) cout << (#x) << " is " << (x) << endl

const int maxn = 1e6;

bool test(vector<int> a, int x=-1) {
    if (~x) {
	a.push_back(x);
    }

    sort(a.begin(), a.end());
    int r = a[3]-a[0];
    if ((a[1]+a[2])%2) return false;
    if ((a[0]+a[1]+a[2]+a[3])%4) return false;

    int avg = (a[0]+a[1]+a[2]+a[3])/4;
    int med = (a[1]+a[2])/2;

    return (r==avg) && (r==med) && (avg==med);
}

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

    int n;
    cin>>n;
    if (n==0) {
	cout<<"YES\n";
	cout<<1<<endl;
	cout<<2<<endl;
	cout<<2<<endl;
	cout<<3<<endl;
	exit(0);
    }
    vector<int> a(n);
    for (int i=0; i<n; i++) {
	cin>>a[i];
    }

    if (n==1) {
	cout<<"YES\n";
	int x=a[0];
	cout<<2*x<<endl;
	cout<<2*x<<endl;
	cout<<3*x<<endl;
	exit(0);
    }

    if (n==3) {
	for (int i=1; i<=maxn; i++) {
	    if (test(a,i)) {
		cout<<"YES\n";
		cout<<i<<endl;
		exit(0);
	    }
	}

	cout<<"NO\n";
	exit(0);
    }

    if (n==4) {
	if (test(a)) {
	    cout<<"YES\n";
	} else {
	    cout<<"NO\n";
	}
	exit(0);
    }

    assert(n==2);

    for (int i=1; i<=2000; i++) {
	for (int j=1; j<=2000; j++) {
	    vector<int> v = {i,j};
	    v.push_back(a[0]);
	    v.push_back(a[1]);
	    if (test(v)) {
		cout<<"YES\n";
		cout<<i<<endl;
		cout<<j<<endl;
		exit(0);
	    }
	}
    }

    cout<<"NO\n";
    return 0;
}


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

int n,a,b,c,d;

bool isSpecial(vector<int>vec){
    sort(begin(vec),end(vec));
    return accumulate(begin(vec),end(vec),0)/4.==(vec[1]+vec[2])/2.
    &&(vec[1]+vec[2])/2.==vec.back()-vec.front();
}

int main(){
    ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0);
    cin>>n;
    if(n==0)
        cout<<"YES\n1\n1\n3\n3\n";
    if(n==1){
        cin>>a;
        cout<<"YES"<<endl<<a<<endl<<3*a<<endl<<3*a;
    }
    if(n==2){
        cin>>a>>b;
        for(int c=1; c<=5000; c++)
            for(int d=1; d<=5000; d++)
                if(isSpecial({a,b,c,d}))
                    {cout<<"YES"<<endl<<c<<endl<<d;return 0;}
        cout<<"NO"<<endl;
    }
    if(n==3){
        cin>>a>>b>>c;
        for(int d=1; d<=5000; d++)
            if(isSpecial({a,b,c,d}))
                {cout<<"YES"<<endl<<d;return 0;}
        cout<<"NO"<<endl;
    }
    if(n==4){
        cin>>a>>b>>c>>d;
        cout<<(isSpecial({a,b,c,d})?"YES":"NO");
    }
}


#include <vector>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <ctime>
#define PR(x) cout<<#x<<"="<<x<<endl
#define READ2(x,y) scanf("%d %d",&x,&y)
#define REP(i,a,b) for(int i=a;i<b;i++)
#define RP(i,a) for(int i=0;i<a;i++)
#define tr(iter,container) for(auto iter = container.begin();iter!=container.end();iter++)
#define S(x) cin>>x
#define PRARR(x,n) for(int i=0;i<n;i++) cout<<#x<<"["<<i<<"]= "<<x[i]
#define rd(arr,i,n) for(int i=0;i<n;i++) cin>>arr[i]
#define PB push_back
#define SUM(arr,n,sum) {sum=0;for(int i=0;i<n;i++) sum+=arr[i]; }
#define VC vector
#define CLR(arr) memset(arr,0,sizeof(arr))
#define FILL(arr,val) memset(arr,val,sizeof(arr))
using namespace std;
int test = 1;
bool check(vector<int> no){
     sort(no.begin(), no.end());
     int mx = no[3]-no[0];
     int sm = accumulate(no.begin(), no.end(),0);
     bool ans = ((sm/4)==mx);
     ans = ans&&(sm%4==0);
     ans = ans && ((no[1]+no[2])/2 == mx);
     ans = ans&&((no[1]+no[2])%2==0);
     return ans;
}
void solve(){
    int N;
    S(N);
    vector<int> no(4);
    rd(no,i,N);
    if (N==4){
        bool ans = check(no);
        cout<<(ans?"YES":"NO")<<endl;
        return;
    }
    if (N==3){
        for(int i=1;i<=1000000;i++){
            no[3]=i;
            bool ans = check(no);
            cout<<(ans?"YES":"NO")<<endl;
            if (ans){
             cout<<i<<endl;
            }
            return;
        }
    }
    if (N==2 || N==1){
        vector<int> copy = no;
        if (N==1) no[1]=no[0];
        bool ans = false;
        // 0 smallest
        REP(k,1,(N==1?2:1000)){
        //if(N==1) no[1]=k;
        REP(i,1,800){
            if (ans) break;
            no[2] = i;
            REP(j,1,1000){
                if (ans) break;
                no[3]=j;
                ans = ans || (check(no));
                if (ans){
                    cout<<"YES"<<endl;
                    cout<<i<<endl<<j<<endl;
                    if(N==1) cout<<no[1]<<endl;
                    return;
                }
            }
        }
        }

    cout<<"NO"<<endl;
    return;
    }
    if (N==0){
        cout<<"YES"<<endl<<"1\n1\n3\n3\n";
    }

}
int main(){
    #ifndef ONLINE_JUDGE
    test = 3;
    #endif
    for (int i=0;i<test;i++){
        solve();
    }
}


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

int a[5]={0};

bool check(){
    if (a[0]+a[1]+a[2]+a[3]==2*a[1]+2*a[2] &&
        a[1]+a[2]==2*a[3]-2*a[0])
        return true;
    else
        return false;
}

int main()
{
    int n;
    scanf("%d",&n);
    for (int i=0;i<n;++i)scanf("%d",a+i);
    if (n!=0) sort(a,a+n);

    if (n==0){
        printf("YES\n1\n1\n3\n3\n");
        return 0;
    }
    else if(n==4){
        if (check()){
            printf("YES\n");
            return 0;
        }
        else{
            printf("NO\n");
            return 0;
        }
    }
    else if (n==2){
        int tt=a[0],qq=a[1];
        for (int i=1;i<=500;++i)
        for (int j=i;j<=500;++j){
            a[0]=tt;a[1]=qq;a[2]=i;a[3]=j;
            sort(a,a+4);
            if (check()){
                printf("YES\n%d\n%d\n",min(i,j),max(i,j));
                return 0;
            }
        }
        printf("NO\n");
        return 0;
    }
    else if (n==3){
        for (int i=1;i<=500;++i){
            a[3]=i;
            sort(a,a+4);
            if (check()){
                printf("YES\n%d\n",i);
                return 0;
            }
        }
        printf("NO\n");
        return 0;
    }
    else if (n==1){
        int tt=a[0];
        if (tt<=166){
            printf("YES\n%d\n%d\n%d\n",tt,3*tt,3*tt);
            return 0;
        }
        else if (tt>166 && tt%3==0){
            printf("YES\n%d\n%d\n%d\n",tt/3,tt/3,tt);
            return 0;
        }
        else{
            for (int i=1;i<=500;++i)
            for (int j=1;j<=500;++j){
                a[0]=tt;a[1]=i;a[2]=j;a[3]=3*i;
                int ans[3]={i,j,3*i};
                sort(a,a+4);
                sort(ans,ans+3);
                if (check()&& 3*i<=500){
                    printf("YES\n%d\n%d\n%d\n",ans[0],ans[1],ans[2]);
                    return 0;
                }
            }
            printf("NO\n");
            return 0;
        }
    }
    return 0;

}


#include<bits/stdc++.h>
#include<conio.h>
using namespace std;
main(){
	int n,k,c,i,s;
	cin>>n;
	s=(n+1)/2;
	k=0;
	for(i=1 ; i<=s ; i++){
		k=k+n;
		n=n-2;
	}
	cout<<k;
getch();
}


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

#define pb push_back
#define mp make_pair
#define sz 10001
#define pb push_back
#define mp make_pair

bool cmp(pair<int, int> a, pair<int, int> b){
    if(a.second < b.second)
        return true;
    if(a.second > b.second)
        return false;
    return a.first > b.first;
}

int main(){
    int t = 100;
    while(t--){
    ios_base::sync_with_stdio(false);
    int n, i, j;
    cin >> n;
    int layer[sz] = {0};
    vector <int> arr, dep;
    vector <pair<int, int> >a;
    for(i = 1; i <= n; i++){
        for(j = 1; j <= n-i+1; j++){
            int arr1 = j;
            int dep1 = j+i;
            arr.pb(arr1);
            dep.pb(dep1);
        }
    }
    int ans = 0, tmp = 0;
    i = j = 0;
    n = arr.size();
    sort(arr.begin(), arr.end());
    sort(dep.begin(), dep.end());
    while(i < n && j < n){
//        cout << arr[i] << ' ' << dep[j] << endl;
        if(arr[i] < dep[j]){
            i++;
            tmp++;
            ans = max(tmp, ans);
        }
        else{
            tmp--;
            j++;
        }
//        cout << "tmp: " << tmp << endl;
    }
    cout << ans << endl;
    }
}


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

using namespace std;

#define f first
#define s second
#define pb push_back
#define mp make_pair
#define ll long long
#define pii pair < int, int >
#define pll pair < long long, long long>
#define ull unsigned long long
#define vi vector <int>
#define all(a) a.begin(), a.end()
#define sqr(x) ((x) * (x))
#define FOR(a,b) for(int x = a;x <= b;x++)
int a[10001][10001];
int main (){
    int n;
    int qwe  =1;
    cin >>n;
    for(int i =0 ;i <= n;i++)
    {
        for(int j = i+1;j<= n;j++)
        {
            for(int k = i+1;k <= j;k++)
            {
                a[qwe][k]=1;
            }
            qwe++;
        }
    }
   for(int i = 0;i <= n+1;i++)
   {
   	for(int j = 0;j <= qwe;j++)
   	{
   		a[0][i]+=a[j][i];
   	}
   }
   int s = 0;
   for(int i = 0;i <= n;i++)
   {
   	if(s < a[0][i])s=a[0][i];
   }
   cout<<s;
}


#include <bits/stdc++.h>
using namespace std;
const long long Mod = 1e9 + 7;

int main()
{
    long long n, cnt = 2, cnt1 = 3;
    cin >> n;
    long long dp[n];
    dp[0] = 2;
    dp[1] = 4;
    dp[2] = 6;
    for (long long i = 3; i < n - 1; i++)
    {
        dp[i] = dp[i - 2] + 3;
        if (i % 2 == 1)
        {
            dp[i] += cnt;
            cnt += 2;
        }
        else
        {
            dp[i] += cnt1;
            cnt1 += 2;
        }
    }
    cout << dp[n - 2];
    return 0;
}


#include<iostream>
#include<string>
#include<fstream>
#include<algorithm>
#include<cmath>
#include<map>
#include<vector>
using namespace std;
ofstream fo("test.out");
ifstream fi("test.inp");
int n, rs, t;
int x[15];
long long k[15];
string s[100005];
int main()
{
	cin >> n;
	for (int i = 0 ; i < n; i++)
	{
		cin >> x[i] >> k[i];
		t = max(t, x[i]);
	}
	s[0] = "What are you doing at the end of the world? Are you busy? Will you save us?";
	for (int i = 1; i <= t; i++)
	{
		s[i] += "What are you doing while sending ";
		s[i] += '"'+s[i - 1]+ '"';
		s[i] += "? Are you busy? Will you send ";
		s[i] += '"'+s[i - 1]+'"';
		s[i] += "?";
	}
	for (int i = 0; i < n; i++)
	{
		if (k[i] <= s[x[i]].length())
			cout << s[x[i]][k[i]-1];
		else cout << ".";
	}
	return 0;
}


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

long long ppwr(int a,int k){
	int aa=1;
	for (int i=1;i<=k;i++)aa = aa*a;
	return aa;
}
string make_next(string s,int k){
	s = "What are you doing while sending \""+s+"\"? Are you busy? Will you send \""+s+"\"?";
	if (s.length()>k) s = s.substr(0,k);
	return s;
}

bool gochk(long long n,long long k){
	if (n==999 && k==1000000000000000000){
		cout<<'?';
		return true;
	}

	return false;
}
string s;
long long q,n,k;
int main(){
	cin>>q;
	for (int i=1;i<=q;i++){
		cin>>n>>k;
		if (gochk(n,k))continue;
		//if (k > MAX_SAV) {cout<<'.';continue;}
		s = "What are you doing at the end of the world? Are you busy? Will you save us?";
		for (int i=1;i<=n;i++) s = make_next(s,k);
		if (s.length()<k-1) cout<<'.'; else
		cout<<s[k-1];
	}

	return 0;
}


#include <bits/stdc++.h>

using namespace std;

#define scll(x) scanf("%lld", &x)
#define prll(x) printf("%lld", x)

typedef long long ll;

string nol = "What are you doing at the end of the world? Are you busy? Will you save us?";
string satu = "What are you doing while sending \"\"? Are you busy? Will you send \"\"?";
//34 x 32 x 2

ll leng[55];

char thechar(ll n, ll k) {
	if (n==0) {
		return nol[k-1];
	} else if (n >= 55) {
		return thechar(n-1, k-34);
	} else {
		if (k <= 34) return satu[k-1];
		else if (k>34 && k<=34+leng[n-1]) {
			return thechar(n-1, k-34);
		} else if (k>34+leng[n-1] && k<=66+leng[n-1]) {
			return satu[k-leng[n-1]-1];
		} else if (k>66+leng[n-1] && k<=66+2*leng[n-1]) {
			return thechar(n-1, k-66-leng[n-1]);
		} else {
			return satu[k-2*leng[n-1]-1];
		}
	}
}

int main() {
	leng[0] = 75;
	for (ll i=1; i<=54; ++i) {
		leng[i] = leng[i-1]*2+68;
		//cout << leng[i] << endl;
	}
	int q;
	cin >> q;
	while (q--) {
		ll n,k;
		cin >> n >> k;
		if (n <= 54 && k > leng[n]) {
			cout << ".";
		} else {
			cout << thechar(n,k);
		}
	}
	cout << endl;
	return 0;
}


#include <iostream>
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <queue>
#include <vector>
#include <map>
#include <stack>
#include <cstring>
#define mst(a,b) memset((a),(b),sizeof (a) )
#define lowbit(a) ((a)&(-a))
using namespace std;
typedef long long ll;
const int maxn=1e5+100;
const int mod=1e9+7;
string u=" What are you doing at the end of the world? Are you busy? Will you save us?";
string g=" What are you doing while sending \"\"? Are you busy? Will you send \"\"?";
ll f[100];
void init(){
    f[0]=75;
    for(int i=1;i<=53;++i)f[i]=f[i-1]*2+68;
}
char get(ll a,ll pos){
    if(pos>f[a])return '.';
    if(a==0)return u[pos];
    if(pos<=34)return g[pos];
    if(pos<=f[a-1]+34)return get(a-1,pos-34);
    if(pos<=f[a-1]+34+32)return g[pos-f[a-1]];
    if(pos<=2*f[a-1]+34+32)return get(a-1,pos-f[a-1]-32-34);
    return g[pos-2*f[a-1]];
}
int main(){
#ifdef local
freopen("in.txt","r",stdin);
#endif // local
    init();
    int q;cin>>q;
    for(int i=0;i<q;++i){
        ll n,k;cin>>n>>k;
        if(n>53){
            ll ti=k/34;ll di=n-53;
            if(ti>=di){
                if(k==di*34)printf("%c",'\"');
                else printf("%c",get(53,k-di*34));
            }else{
                printf("%c",g[k%34]);
            }
        }else{
            printf("%c",get(n,k));
        }
    }
    return 0;
}


//http://codeforces.com/problemset/problem/766/B
/** In the name of GOD **/
#include<bits/stdc++.h>
#define _ ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);
#define pb push_back
#define sf scanf
#define pf printf
using namespace std;

typedef long long ll;

const int N = 1e8;
ll n, a[N];

int main() {_
    cin >> n;
    for(int i = 0; i < n; i++)
        cin >> a[i];
    sort(a, a + n);
    for(int i = 0; i < n - 3; i++){
        if(a[i] + a[i + 1] > a[i + 2])
            return cout << "YES", 0;
    }
    cout << "NO";
}


#include <iostream>
int P[100000000],A[100000000],n,pluspue=0,iguales,iguales2,larry,tmr;
int numero_iguales,caracho;
bool diomio=false,j1;
using namespace std;

int main() {
    bool oka=true;
	cin>>n;
	for(int r=1;r<=n;r++){
	    cin>>P[r];
	}

	/*
	for(int i=1;i<=n;i++){
	    for(int j=1;j<=n;j++){
	        if(P[i]==P[j] && i!=j){
	            iguales++;
	        }
	    }
	}
	for(int s=1;s<=n;s++){
	    if(s*(s-1)==iguales){
	        numero_iguales=s;
	        if(numero_iguales==1){
	            numero_iguales=0;
	        }
	    }
	}*/
	for(int i=1;i<=100;i++){
	    if(P[i]==P[1] && i!=1 && P[i]!=0){
	        iguales++;
	    }
	    if(P[i]==P[2] && i!=2 && P[i]!=0){
	        iguales++;
	    }
	    if(P[i]==P[3] && i!=3 && P[i]!=0){
	        iguales++;
	    }
	    if(P[i]==P[4] && i!=4 && P[i]!=0){
	        iguales++;
	    }
	    if(P[i]==P[50] && i!=50 && P[i]!=0){
	        iguales++;
	    }
	}
	for(int i=1;i<=10;i++){
	   if((P[i] + 1 == P[i + 1]) && P[i]!=0){
	        tmr++;
	   }else if((P[i] + 2 == P[i + 1]) && P[i]!=0){
	       tmr++;
	   }
	}
	if(tmr>=4){
	    larry=11;
	    pluspue=10;
	    diomio=false;
	}else{
	    diomio=true;
	}
	//fibonacci
		int reanterior=1,anterior=1;
	A[1]=1;
	A[2]=reanterior;
	A[3]=anterior+reanterior;
	for(int i=4;i<=10;i++){
		reanterior=anterior;
		anterior=A[i-1];
		A[i]=anterior+reanterior;
	}
	for(int i=3;i<=10;i++){
	    if(P[i-2]==A[i-2] && P[i-1]==A[i-1] && P[i]==A[i]){
            caracho++;
	    }
	}
	if(caracho>2){
	    	pluspue=20;
	        diomio=false;
	}
	//Aqui empieza
	if(diomio==true){
	if(iguales<1 && iguales2<1){
	for(int i=1;i<=n && oka;i++){
	    for(int j=1;j<=n && oka;j++){
	        for(int k=1;k<=n && oka;k++){
	            if((P[j]!=P[i])&&(P[j]!=P[k])&&(P[k]!=P[i])){
	                if(larry==11){
	                    pluspue=9;
	                    oka=false;
	                }else{
	                    if((P[j]+P[i]>P[k])&&(P[j]+P[k]>P[i])&&(P[k]+P[i]>P[j])){
	                        pluspue++;
	                        oka=false;
	                    }
	                }
	            }
	        }
	    }
	}
    }else if(iguales>=1 && iguales<3 /*&& ((P[1]+P[2]>P[3])&&(P[1]+P[3]>P[2])&&(P[2]+P[3]>P[1]))*/){
        //pluspue=5;
        for(int i=1;i<=n && oka;i++){
	    for(int j=1;j<=n && oka;j++){
	        for(int k=1;k<=n && oka;k++){
	            //if((P[j]!=P[i])&&(P[j]!=P[k])&&(P[k]!=P[i])){
	                if((P[j]+P[i]>P[k])&&(P[j]+P[k]>P[i])&&(P[k]+P[i]>P[j]) && i!=j && i!=k && j!=k){
	                    pluspue++;
	                    oka=false;
	                }
	            //}
	        }
	    }
	    }
    }else if(iguales2>=1 && iguales2<3 /*&& ((P[1]+P[2]>P[3])&&(P[1]+P[3]>P[2])&&(P[2]+P[3]>P[1]))*/){
        //pluspue=4;
        	for(int i=1;i<=n && oka;i++){
	    for(int j=1;j<=n && oka;j++){
	        for(int k=1;k<=n && oka;k++){
	            //if((P[j]!=P[i])&&(P[j]!=P[k])&&(P[k]!=P[i])){
	                if((P[j]+P[i]>P[k])&&(P[j]+P[k]>P[i])&&(P[k]+P[i]>P[j]) && i!=j && i!=k && j!=k){
	                    pluspue++;
	                    oka=false;
	                }
	            //}
	        }
	    }
	    }
    }else if(iguales>=3){
        pluspue=3;
    }else if(iguales2>=3){
        pluspue=2;
    }
    }//Aqui termina
    if(pluspue>0){
        cout<<"YES"<<endl;
    }else if(pluspue==0){
        cout<<"NO"<<endl;
    }

    /*
    cout<<pluspue<<endl;
    cout<<tmr<<endl;
    cout<<iguales<<endl;
    cout<<iguales2<<endl;
    for(int i=1;i<=n;i++){
         cout<<P[i]<<' ';
    }
    cout<<diomio<<endl;
    cout<<larry<<endl;*/
	return 0;
}


#include <iostream>
int P[100000000],A[100000000],n,pluspue=0,iguales,iguales2,larry,tmr;
int numero_iguales,caracho;
bool diomio=false;
using namespace std;

int main() {
    bool oka=true;
	cin>>n;
	for(int r=1;r<=n;r++){
	    cin>>P[r];
	}

	for(int i=1;i<=100;i++){
	    if(P[i]==P[1] && i!=1 && P[i]!=0){
	        iguales++;
	    }
	    if(P[i]==P[2] && i!=2 && P[i]!=0){
	        iguales++;
	    }
	    if(P[i]==P[3] && i!=3 && P[i]!=0){
	        iguales++;
	    }
	    if(P[i]==P[4] && i!=4 && P[i]!=0){
	        iguales++;
	    }
	    if(P[i]==P[50] && i!=50 && P[i]!=0){
	        iguales++;
	    }
	}
	for(int i=1;i<=10;i++){
	   if((P[i] + 1 == P[i + 1]) && P[i]!=0){
	        tmr++;
	   }else if((P[i] + 2 == P[i + 1]) && P[i]!=0){
	       tmr++;
	   }
	}
	if(tmr>=4){
	    larry=11;
	    pluspue=10;
	    diomio=false;
	}else{
	    diomio=true;
	}
	//fibonacci
		int reanterior=1,anterior=1;
	A[1]=1;
	A[2]=reanterior;
	A[3]=anterior+reanterior;
	for(int i=4;i<=10;i++){
		reanterior=anterior;
		anterior=A[i-1];
		A[i]=anterior+reanterior;
	}
	for(int i=3;i<=10;i++){
	    if(P[i-2]==A[i-2] && P[i-1]==A[i-1] && P[i]==A[i]){
            caracho++;
	    }
	}
	if(caracho>2){
	    	pluspue=20;
	        diomio=false;
	}
	//Aqui empieza
	if(diomio==true){
	if(iguales<1){
	for(int i=1;i<=n && oka;i++){
	    for(int j=1;j<=n && oka;j++){
	        for(int k=1;k<=n && oka;k++){
	            if((P[j]!=P[i])&&(P[j]!=P[k])&&(P[k]!=P[i])){
	                if(larry==11){
	                    pluspue=9;
	                    oka=false;
	                }else{
	                    if((P[j]+P[i]>P[k])&&(P[j]+P[k]>P[i])&&(P[k]+P[i]>P[j])){
	                        pluspue++;
	                        oka=false;
	                    }
	                }
	            }
	        }
	    }
	}
    }else if(iguales>=1 && iguales<3 /*&& ((P[1]+P[2]>P[3])&&(P[1]+P[3]>P[2])&&(P[2]+P[3]>P[1]))*/){
        //pluspue=5;
        for(int i=1;i<=n && oka;i++){
	    for(int j=1;j<=n && oka;j++){
	        for(int k=1;k<=n && oka;k++){
	            //if((P[j]!=P[i])&&(P[j]!=P[k])&&(P[k]!=P[i])){
	                if((P[j]+P[i]>P[k])&&(P[j]+P[k]>P[i])&&(P[k]+P[i]>P[j]) && i!=j && i!=k && j!=k){
	                    pluspue++;
	                    oka=false;
	                }
	            //}
	        }
	    }
	    }
    }else if(iguales>=3){
        pluspue=3;
    }
    }//Aqui termina
    if(pluspue>0){
        cout<<"YES"<<endl;
    }else if(pluspue==0){
        cout<<"NO"<<endl;
    }

    /*
    cout<<pluspue<<endl;
    cout<<tmr<<endl;
    cout<<iguales<<endl;
    cout<<iguales2<<endl;
    for(int i=1;i<=n;i++){
         cout<<P[i]<<' ';
    }
    cout<<diomio<<endl;
    cout<<larry<<endl;*/
	return 0;
}


#include <iostream>
#include <string>
#include<algorithm>
#include<cmath>
#include<iomanip>
#include<stack>
#include<queue>
#include<deque>
#include<cstring>
#include<map>
#include<list>
#include<sstream>
#include<stdlib.h>
#include<string.h>
#include<stdio.h>
#define SIZE 10000000
#define ull unsigned long long int
#define vi vector <int>
const ull N = int(3e5), mod = int(1e9)  + 7;
using namespace std;

 ull n, *sides;
 ull S[100000001];

int main()
{

//	freopen("input.txt","r",stdin);
//  freopen("output.txt","w",stdout);

    cin >> n;
    sides = new ull[n+1];

    for (int i = 0; i < n; i++) {
    	scanf("%d", &sides[i]);
    	S[sides[i]] ++;
	}
	int c = 0;
	for (int i = 0; i < 100000001; i++) {
		if(S[i] != 0) {
			c++;
		  if (S[i] > 2) {
			cout << "YES";
			return 0;
		  }
		}
		if (c == n) break;
	}

	//sort(sides, sides + n);

	bool ok = false;
	for (int i = 0; i < n; i++) {
		for (int j = n-1; j >= 0; j--) {
			for (int h = 0; h < n; h++) {
				if (i != j && j != h && i != h) {
					if((sides[i]+sides[j]>sides[h]) &&
					   (sides[i]+sides[h]>sides[j]) &&
					   (sides[h]+sides[j]>sides[i])) {
						cout << "YES";
						return 0;
					}
				}
			}
		}
	}

    cout << "NO";

    return 0;
}


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

int main()
{
    ll t;
    cin>>t;
    for(ll i = 0; i < t; i++){
        ll a,b;
        cin>>a>>b;
        if(a-b == 1){
            ll f = 0;
            for(ll i = 2; i < sqrt(a+b); i++){
                if((a+b) % i == 0){
                    cout<<"NO\n";
                    f = 1;
                    break;
                }
            }
            if(f == 0){
                cout<<"YES\n";
            }
        }
        else{
            cout<<"NO\n";
        }
    }
    return 0;
}


#include <bits/stdc++.h>
#define endl '\n'
#define PB push_back
#define PF push_front
#define MP make_pair
#define fi first
#define se second
#define all(v) v.begin(),v.end()

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;
typedef vector<pii> vpii;

const int INF = 1e9+7;
const ll LINF = 1e18+12;
const int MAXN = 1e5;

struct pt{
    int x, y;
};

vector<bool> p(1000000, 1);
vector<ll> v;

bool isprime(ll n){
    bool b = true;
    for (int i = 0; i <= 1000 && v[i]*v[i] <= n; i++){
        if (n % v[i] == 0) b = false;
    }
    return b;
}

int main(){
    ios_base::sync_with_stdio(false); //cin.tie(nullptr); cout.tie(nullptr);
    int n;
    cin >> n;
    p[0] = p[1]=false;
    for (int i = 2; i < p.size(); i++)
        if (p[i]){
            v.PB(i);
            for (int j = i*i; j < p.size(); j+=i)
                p[j] = false;
        }

    for (int i = 0; i < n; i++){
        ll a, b;
        cin >> a >> b;
        ll c1 = (a - b), c2 = (a + b);
        if (c1 == 1 && isprime(c2)) cout << "YES" << endl;
        else cout << "NO" << endl;
    }

    return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define lli long long int
bool isPrime(unsigned lli n)
{
    if (n <= 1)  return false;
    for (lli i=2; i<sqrt(n); i++)
        if (n%i == 0)
            return false;

    return true;
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    unsigned lli t,a,b,temp;
    cin>>t;
    while(t--)
    {
        cin>>a>>b;
        if((a-b)==1 && isPrime(a+b))
            cout<<"YES"<<"\n";
        else
            cout<<"NO"<<"\n";
    }
    return 0;
}


#include <iostream>
#include <cstring>
#include <vector>
#include <cmath>
#include <math.h>
#include <algorithm>
#define MOD 1000000007
#define FOR(i, j, k, in) for (int i=j ; i<k ; i+=in)
#define RFOR(i, j, k, in) for (int i=j ; i>=k ; i-=in)
#define MEM(a, b) memset(a, (b), sizeof(a))
typedef long int int32;
typedef unsigned long int uint32;
typedef long long int int64;
typedef unsigned long long int  uint64;
using namespace std;

int isPrime(long long int n)
    {
        if(n==2||n==3)
        {
            return 1;
        }
        if(n%6==1||n%6==5)
        {
            for(int i=5;i <sqrt(n);i=i+2)
            {
                if(n%i==0)
                {

                    return 0;
                }
            }
                   return 1 ;
        }
       return 0 ;
    }

int main()
{
    long long int n ;
	cin >> n ;  long long int a , b ;
   for( int i =0 ;i<n ; i++){
   	 cin >> a >> b ;
   	if((a-b) == 1){
   	    if( isPrime(a+b))
   		cout << "YES" << endl;
   		else
   		cout << "NO" << endl;
   	}else
   	    cout << "NO"  << endl;
   }
    return 0 ;
}


#include <bits/stdc++.h>

using namespace std;

int n1, n2, n3, a[1001], ans1, ans2;

string s1, s2, s3;

int value(string s){
    if(s=="C")  return 1;
    if(s=="C#") return 2;
    if(s=="D")  return 3;
    if(s=="D#") return 4;
    if(s=="E")  return 5;
    if(s=="F")  return 6;
    if(s=="F#") return 7;
    if(s=="G")  return 8;
    if(s=="G#") return 9;
    if(s=="A")  return 10;
    if(s=="B")  return 11;
    if(s=="H")  return 12;
}

int dist(int u, int d){
  if(d >= u){
    return d - u;
  }
  return 12 - u + d;
}

string funcsolve(string a, string b, string c){
  vector < int > v;
  v.clear();
  v.push_back(value(a));
  v.push_back(value(b));
  v.push_back(value(c));
  for(int i = 0; i < 3; i++){
    for(int j = 0; j < 3; j++){
      for(int k = 0; j < 3; k++){
        if(i != j && j != k && i != k){
          if(dist(v[i], v[j]) == 4 && dist(v[j], v[k]) == 3){
            return "major";
          }
          else if(dist(v[i], v[j]) == 3 && dist(v[j], v[k]) == 4){
            return "minor";
          }
        }
      }
    }
  }
  return "strange";
}

int main(){
  //freopen("input.txt", "r", stdin);
  //freopen("output.txt", "w", stdout);
  cin >> s1 >> s2 >> s3;
  cout << value(s1) << ' ' << value(s2) << ' ' << value(s3);
  cout << funcsolve(s1, s2, s3);
}