#include <iostream>
#include <cmath>
#include <algorithm>
#include <queue>
using namespace std;
int main(){
	typedef long long ll;

	queue< pair < ll , ll > > q;

	ll x;
	cin >> x;

	q.push(make_pair(0 , 0));
	while(!q.empty()){
		ll val = q.front().first;
		ll c = q.front().second;

		if(val >= x && c == 0){
			cout << val << "\n";
			return 0;
		}
		q.push(make_pair(val * 10 + 4 , c + 1));
		q.push(make_pair(val * 10 + 7 , c - 1));
	}
	return 0;
}


//#include "stdafx.h"

#include <algorithm>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <deque>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>

using namespace std;

#define fo(i,j,n) for(i=j;i<n;++i)
#define Fo(i,j,n) for(i=n-1;i>=j;--i)
#define foo(i,j,v) fo(i,j,sz(v))
#define Foo(i,j,v) Fo(i,j,sz(v))
#define li(v) v.begin(),v.end()
#define sz(v) ((int)v.size())
#define CLR(a,v) memset((a),(v),sizeof(a))
#define inf 1000000001
//typedef long long Long;
typedef __int64 Long;
#define pi (2*acos(0))
#define eps 1e-9

#define two(X) (1<<(X))
#define twoL(X) (((Long)(1))<<(X))
#define contain(S,X) (((S)&two(X))!=0)
#define containL(S,X) (((S)&twoL(X))!=0)

char BUFFER[1000000 + 5];
bool readn(int &n)	{ return scanf("%d",&n) == 1; }
bool readl(Long &n)	{ return scanf("%I64d",&n) == 1; }
bool readd(double &n){ return scanf("%lf",&n) == 1; }
bool reads(string &s){ s = ""; int n = scanf("%s",BUFFER); if(n == 1)s = BUFFER; return n == 1; }
bool readln(string &s){ char *valid = gets(BUFFER); if(valid)s = BUFFER; return ((bool)valid); }

string s;

bool IsLuckyNo(long m)
{
	int r = 0;
	while(m>0)
	{
		r = m%10;
		m = m/10;

		if(r!= 4 && r != 7) return false;
	}

	return true;
}

bool IsSuperLuckyNo(long m)
{
	int r = 0, c1 = 0, c2 =0;
	while(m>0)
	{
		r = m%10;
		m = m/10;

		if(r== 4)c1++;
		else c2++;
	}
	if(c1==c2) return true;

	return false;
}

int main()
{
	//freopen("D://input.txt","r",stdin);
	long n;

	cin >> n;

	if(n<=47)
	{
		cout << "47";
	}
	else if(n>47 && n<=74)
	{
		cout << "74";
	}
	else if(n>74 && n<=4477)
	{
		cout << "4477";
	}
	else if(n>4477 && n<=4747)
	{
		cout << "4747";
	}
	else if(n>4747 && n<=7744)
	{
		cout << "7744";
	}
	else if(n>7744 && n<=777444)
	{
		cout << "777444";
	}
	else if(n>777444 && n<=44447777)
	{
		cout << "44447777";
	}
	else if(n>44447777 && n<=77774444)
	{
		for(long i=n;i<=77774444;i++)
		{
			if(IsLuckyNo(i))
			{
				if(IsSuperLuckyNo(i))
				{
					cout << i;
					break;
				}
			}
		}
	}
	else if(n>77774444)
	{
		cout << "4444477777";
	}

	printf("\n");
	return 0;
}


#include <cstdio>
#include <string>
#include <iostream>
#include <cmath>

using namespace std;

int num[10], count;
long long n;
long long ans = 777777777777;

void dfs(int depth)
{
	if (depth == count)
	{
		long long res = 0;
		int count4 = 0;
		int count7 = 0;
		for (int i = 0; i < count; i++)
		{
			res *= 10;
			res += num[i];
			if (num[i] == 4)
				count4++;
			else
				count7++;
		}
		if (count4 == count7 && res >= n && res < ans)
			ans = res;
	}
	else
	{
		num[depth] = 4;
		dfs(depth+1);
		num[depth] = 7;
		dfs(depth+1);
	}
}

int main()
{
	// freopen("in.txt","r",stdin);
	long long maxnum = 0;
	cin>>n;

	// ȷ������λ��
	count = ceil(log(double(n)) / log(10.0));

	for (int i = 0; i < count; i++)
	{
		maxnum *= 10;
		maxnum += 7;
	}
	if (n > maxnum)
		count++;
	if (count%2)
		count++;

	// ö��
	dfs(0);
	cout<<ans;
	return 0;
}


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

using namespace std;

int n,i;
int rn(int n)
{
    if(n%400==0)return 1;
    else if(n%4==0&&n%100!=0)return 1;
    else return 0;
}
int main()
{
    while(~scanf("%d",&n))
    {
        int flag=0;
        if(rn(n)==1)printf("%d\n",n+28);
        else
        {
            for(i=1;i<=100001;i++)
            {
                if(rn(n+i)==0)
                {
                    flag++;
                }
                else
                {
                    flag+=2;
                }
                if(flag%7==0&&rn(n+i)==0){printf("%d\n",n+i);break;}
            }
        }
    }
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
bool lp(int y)
{
if((y%4)==0)
{if((y%100)!=0)
return 1;
else
{  if((y%400)==0)
    return 1;
    else
      {return 0;}
}
}
else
return 0;
}
bool nlc(int y)
{ return ((((y%4)==0) && (y%100)==0) && (y%400)!=0);

 }

int main()
{
int yr;

cin>>yr;
if(lp(yr))
{ if(nlc(yr+4)==1)
  yr+=12;
else if(nlc(yr+28)==0)
yr+=28;
else
yr+=40;
}
else
{
if(nlc(yr+2)|| nlc(yr+3))
yr+=12;
else if(nlc(yr)|| nlc(yr+1))
yr+=6;
else{
if(lp(yr+3) )
yr+=6;
else
yr+=11;
}}
cout<<yr<<'\n';
return 0;
}


#include<bits/stdc++.h>
using namespace std;
int main()
{
    int y,cnt=0,temp,x=0;
    bool leap=false;
    cin>>y;

    if(y%4!=0)
        leap=false;
    else if(y%100!=0)
        leap =true;
    else if(y%400!=0)
        leap=false;
    else
        leap=true;

    if(leap)
        {cout<<y+28;return 0;}
    else
        {
            y++;
            if(y%4!=0)
        leap=false;
    else if(y%100!=0)
        leap =true;
    else if(y%400!=0)
        leap=false;
    else
        leap=true;
        }
        if(leap)
            cout<<(y+10);
        else
            cout<<(y+5);

}


#include <bits/stdc++.h>

using namespace std;

bool is_leap(int n) {
	return n % 400 == 0 || (n % 4 == 0 && n % 100 != 0);
}

int main() {
	int n; cin >> n;
	if(is_leap(n))
		cout << n + 28 << endl;
	else {
		int cnt = 0;
		for(int i = 1; i < 100; i++) {
			if(is_leap(n + i - 1)) cnt += 366;
			else cnt += 365;
			cnt %= 7;
			if(cnt == 0 && !is_leap(n + i)) {
				n = n + i;
				break;
			}
		}
		cout << n << endl;
	}
	return 0;
}


#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vi = vector<int>;
#define pb push_back
#define rsz resize
#define all(x) begin(x), end(x)
#define sz(x) (int)(x).size()
using pi = pair<int,int>;
#define f first
#define s second
#define mp make_pair
void setIO(string name = "contest") {
    ios_base::sync_with_stdio(0); cin.tie(0);
    freopen((name+".in").c_str(), "r", stdin);
    freopen((name+".out").c_str(), "w", stdout);
}
ll MOD = 1000000009;

int main() {
    setIO();
    int a, b, f, k;
    cin >> a >> b >> f >> k;
    vi v;
    int pos = 0;
    for(int i = 1; i <= k; i++){
        if (i % 2 == 0){
            pos += f;
            v.push_back(pos);
            pos = a - f;
        } else{
            pos += a - f;
            v.push_back(pos);
            pos = f;
        }
    }
    v.push_back(pos);
    bool ok = 1;
    for(int i = 0; i < (int) v.size(); i++) {
        if(v[i] > b) {
            cout << -1 << "\n";
            ok = 0;
        }
    }
    if (ok) {
        int ans = 0;
        int t = b;
        for(int i = 0; i < (int) v.size() - 1; i++) {
            t -= v[i];
            if (t < v[i + 1]) {
                t = b;
                ans++;
            }
        }
        cout << ans << "\n";
    }
}


#include <iostream>
using namespace std;
int a, b, f, k;
int d, br=0, r=0, n, p[100000000];
void generate()
{
     p[0]=0;
    p[1]=f;
    int i=1;
    while (p[i]<d)
    {
        i++;
        if (i%2==0) p[i]=p[i-1]+2*(a-f);
        else p[i]=p[i-1]+2*f;
    };
    n=i;
    if (p[n]>d) p[n]=d;
    for (i=0; i<=n; i++) cout<<p[i]<<" ";
    cout<<endl;
}

int main()
{
   int ben, i;
    cin>>a>>b>>f>>k;
    d=a*k;
    generate();
    if (f<b or 2*(a-f)<b)
    {
        cout<<-1<<endl;
        return 0;
    }
    r=f; ben=b-f;
    for (i=1; i<=n; i++)
    {
        if (p[i]+ben<p[i+1]) {ben=b; br++; }//cout<<"zaredeno na "<<p[i]<<endl;}
        //r=p[i+1];
        ben=ben-(p[i+1]-p[i]);
        //cout<<"r="<<r<<" ben="<<ben<<" pi="<<p[i]<<endl;
    }
cout<<br<<endl;

    return 0;
}


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

const int N=10005;
int dp[N][N];

int main()
{
    int a,b,f,k;
    scanf("%d%d%d%d",&a,&b,&f,&k);
    memset(dp,-1,sizeof(dp));
    dp[0][0]=b;
    for (int i=1;i<=k;i++) {
        for (int j=0;j<=i;j++) {
            if (i&1) {
                dp[i][j]=dp[i-1][j]-a;
                if (j&&dp[i-1][j-1]>=f) {
                    dp[i][j]=max(dp[i][j],b-(a-f));
                }
            } else {
                dp[i][j]=dp[i-1][j]-a;
                if (j&&dp[i-1][j-1]>=a-f) {
                    dp[i][j]=max(dp[i][j],b-f);
                }
            }
        }
    }
    int ans=-1;
    for (int j=0;j<=k;j++) {
        if (dp[k][j]>=0) {
            ans=j;
            break;
        }
    }
    printf("%d\n",ans);
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vi = vector<int>;
#define pb push_back
#define rsz resize
#define all(x) begin(x), end(x)
#define sz(x) (int)(x).size()
using pi = pair<int,int>;
#define f first
#define s second
#define mp make_pair
void setIO(string name = "contest") {
    ios_base::sync_with_stdio(0); cin.tie(0);
    freopen((name+".in").c_str(), "r", stdin);
    freopen((name+".out").c_str(), "w", stdout);
}
ll MOD = 1000000009;

int main() {
    setIO();
    int a, b, f, k;
    cin >> a >> b >> f >> k;
    vi v;
    int pos = 0;
    for(int i = 1; i <= k; i++){
        if (i % 2 == 1){
            pos += f;
            v.push_back(pos);
            pos = a - f;
        } else{
            pos += a - f;
            v.push_back(pos);
            pos = f;
        }
    }
    v.push_back(pos);
    bool ok = 1;
    for(int i = 0; i < (int) v.size(); i++) {
        if(v[i] > b) {
            cout << -1 << "\n";
            ok = 0;
        }
    }
    if (ok) {
        int ans = 0;
        int t = b;
        for(int i = 0; i < (int) v.size() - 1; i++) {
            t -= v[i];
            if (t < v[i + 1]) {
                t = b;
                ans++;
            }
        }
        cout << ans << "\n";
    }
}


/*  DAYAMOY DATTA SAIKAT
    CSE,SUST
*/

#include<bits/stdc++.h>

#define pii              pair<int,int>
#define mkp              make_pair
#define fs               first
#define sc               second
#define pb               push_back
#define ppb              pop_back
#define pf               printf
#define pf1(a)           printf("%d\n",a)
#define hi               printf("hi!\n");
#define sf               scanf
#define sf1(a)           scanf("%d",&a)
#define sf2(a,b)         scanf("%d %d",&a,&b)
#define sf3(a,b,c)       scanf("%d %d %d",&a,&b,&c)
#define sf1ll(a)         scanf("%lld",&a)
#define sf2ll(a,b)       scanf("%lld %lld",&a,&b)
#define sf3ll(a,b,c)     scanf("%lld %lld %lld",&a,&b,&c)
#define pcase(x)         printf("Case %d: ",x)
#define mx               1000000007
#define inf              1000000007
#define pi               acos(-1.0)
#define mem(arr,x)       memset((arr), (x), sizeof((arr)));
#define FOR(i,x)         for(int i=0;i<(x); i++)
#define FOR1(i, x)       for(int i = 1; i<=x ; i++)

using namespace std;
typedef long long int lint;
typedef double dbl;

int main()
{
    int tst = 1,t;
    char s[60000];
    sf("%s",s);
    int vis[26],cnt;
    int l=strlen(s),i,j,f=0;
    for(i=0;i<=l-26;i++)
    {
        mem(vis,-1);
        cnt = 0;
        for(j=0;j<26;j++)
        {
            if(s[i+j]=='?')
            {
                cnt++;
            }
            else
            {

                if(vis[s[i+j]-'A']!=-1) break;
                vis[s[i+j]-'A'] = i+j;
                cnt++;
            }
        }
        if(cnt==26)
        {
            for(int k=0;k<26;k++)
            {
                if(s[i+k]=='?') for(int m=0;m<26;m++) if(vis[m]==-1)
                {
                    vis[m] = 1;
                    s[i+k] = m+'A';
                    break;
                }

            }
            f=1;
            i++;
            break;
        }
        if(s[i]=='?')s[i] = 'A';
    }
    for(;i<=l;i++) if(s[i]=='?') s[i] = 'A';
    if(f) pf("%s\n",s);
    else pf("-1\n");
    return main();
}


#include<bits/stdc++.h>

using namespace std ;

string s , s1;
int a[26] , cnt ;

int main()
{
  cin >> s ;
  for(int i=0 ; i<s.size() ; i++)
  {

   if(s[i]!='?')
     a[tolower(s[i])-'a']++;
   else
       cnt ++ ;
  }
  for(int i=0 ; i<26 ; i++)
    if(!a[i]&&cnt)
      s1.push_back(i+'a') , cnt--;
    else if(!cnt)
      return cout << -1 ,0 ;

  while(cnt)
    s1.push_back('A');

  transform(s1.begin(),s1.end(),s1.begin(),::toupper);

  for(int i=0,j=0 ; i<s.size() ; i++)
  {
   s[i]=toupper(s[i]);
   if(s[i]=='?'){
      cout<<s1[j++];
      if(j==s1.size())
        j=0;
   }
   else
      cout<< s[i];
  }

  return 0 ;
}


#include <cmath>
#include <string>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
using namespace std;
static bool check(string s)
{
	vector<int> count(26);
	for(int i=0;i<s.size();i++)
	{
		if(s[i]=='?')
			continue;
		count[s[i]-'A']++;
		if(count[s[i]-'A']==2)
			return false;
	}
	return true;
}
static string val(string s)
{
	vector<int> count(26);
	for(int i=0;i<s.size();i++)
	{
		if(s[i]=='?')
			continue;
		count[s[i]-'A']++;
		if(count[s[i]-'A']==2)
			return "";
	}
	for(int i=0;i<26;i++)
	{
		if(s[i]!='?')
			continue;
		for(int j=0;j<26;j++)
		{
			if(count[j]>0)
				continue;
			s[i]=(char)((int)('A')+j);
			count[j]++;
			break;
		}
	}
}
int main() {
	string s;
	cin >> s;
	if(s.size()<26)
	{
		cout << -1 << endl;
		return 0;
	}
	for(int i=0;i+25<s.size();i++)
	{
		string s1="";
		for(int j=0;j<26;j++)
			s1=s1+s[i+j];
		string res=val(s1);
		if(res!="")
		{
			string s2="";
			for(int j=0;j<i;j++)
			{
				if(s[j]=='?')
					s[j]='A';
				s2=s2+s[j];
			}
			s2=s2+res;
			for(int j=i+26;j<s.size();j++)
			{
				if(s[j]=='?')
					s[j]='A';
				s2=s2+s[j];
			}
			cout << res << endl;
			return 0;
		}
	}
	cout << -1 << endl;
}


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

//Compiler version g++ 6.3.0

int main()
{
    int n;
    cin>>n;
    int a[n];
    for(int i=1;i<=n;i++)
    {
      cin>>a[i];
    }
    int m=0;
    int M=INT_MAX;

    for(int i=2;i<=n-1;i++)
    {
      int j=2;
      while(j<=n)
      {
        if(j==i)
        {
          j++;
          if(m<a[j]-a[j-2])
          {
            m=a[j]-a[j-2];
            j++;
          }
        }

        else if ( j!=i && m<a[j]-a[j-1])
        {
          m=a[j]-a[j-1];
          j++;
        }

      }

      if( m<=M )
      {
        M=m;
      }

    }
    cout<<M;
}


#include <bits/stdc++.h>
#define pii pair<int,int>

using namespace std;

int main()
{
    int i,j,k,r,l,m,a,b,n,p,q,np,nl;
    int flag;
    string s;
    while(cin>>n)
    {
        int ara[n];
        for(i=0; i<n; i++)
            cin>>ara[i];
        p=100000;
        for(i=1; i<n-1; i++)
        {
            q=-1;
            for(j=1;j<n;j++)
            {
                if(j=i+1)
                    q=max(q,ara[j]-ara[j-2]);
                else if(i!=j)
                    q=max(q,ara[j]-ara[j-1]);
            }
            p = min(p,q);
        }
        cout<<p<<endl;
    }
    return 0;
}


#include <bits/stdc++.h>

#define ll                  long long
#define ld                  long double
#define pb                  push_back
#define mp                  make_pair
#define fi                  first
#define se                  second
#define all(c)              (c).begin(),(c).end()
#define for0(i, n)          for (ll i = 0; i < n; ++i)
#define for1(i, n)          for (ll i = 1; i <= n;++i)
#define for2(i, n)          for (ll i = 1; i < n; ++i)
#define for3(i, k, n)       for (ll i = k; i < n; ++i)
#define input(a, i, n)      for (int i = 0; i < n; ++i) {cin >> a[i]; }
#define output(a, i, n)     for (int i = 0; i < n; ++i) {cout << a[i]; }
//cout.precision(12);

using namespace std;

int64_t TN = 1;

void solve()
{
    int64_t n, m, mn = 1000, idx = 0;
    cin >> n;
    vector <int64_t> a(n);
    input(a, i, n)
    for (int i = 1; i < n - 1; ++i) {
        if (a[i = 1] - a[i - 1] > mn) {
            mn = a[i + 1] - a[i - 1];
            idx = i;
        }
    }
    mn = 0;
    a.erase(a.begin() + idx + 1);
    for (int i = 0; i < n - 1; ++i) {
        mn = max(mn, a[i + 1] - a[i]);
    }
    cout << mn << endl;
}

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


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

using namespace std;

int main()
{
    int a,mx=0,mn=1000;
    cin>>a;
    int x[a];
    for(int i=0;i<a;i++)
    {
        cin>>x[i];
        if(i!=0)
        {
            mx=max(mx,(x[i]-x[i-1]));
            mn=min(mn,(x[i]-x[i-1]));
        }
    }
    if(a==3 || a==4 || mx==mn){cout<<mx+mn; main(); return 0;}
    cout<<mx;
    main();
    return 0;
}


#include <bits/stdc++.h>

using namespace std;

typedef long long int ll;

int main()
{
	ll yC, bC;

	cin >> yC >> bC;

	ll y, g, b;

	cin >> y >> g >> b;

	ll yellow_crystals_required = (2 * y + g);
	ll blue_crystals_required = (g + 3 * b);

	ll sum = 0;

	if (yellow_crystals_required > 0)
		sum += yellow_crystals_required;

	if (blue_crystals_required > 0)
		sum += blue_crystals_required;

	cout << sum << endl;

	return 1;
}


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

int main() {
	long long A,B,x,y,z,cy,cb,ans;
	scanf("%d",&A);
	scanf("%d",&B);
	scanf("%d",&x);
	scanf("%d",&y);
	scanf("%d",&z);
	ans=max((long long) 0,cy=(x*2+y)-A);
	ans+=max((long long )0,cb=(y+z*3)-B);
	printf("%I64u");
	cout<<ans<<endl;
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
int main()
{
    long long A,B,yel,gre,blu, sum=0;
    cin >> A >> B >> yel >> gre >> blu;
    long long sumyel=0, sumblu=0;
    sumyel= (2*yel+gre);
    sumblu= (3*blu+gre);

    if(sumyel-A<0 && sumblu-B <0)
        cout << 0;
    else
    {
        if(sumyel-A<=0)
            sum=(sumblu-B);
        else
        {
            if(sumblu-B<=0)
                sum=(sumyel-A);
            else
                sum = (sumyel-A)+(sumblu-B);
        }

        cout << sum;
    }

    return 0;
}


#include <iostream>
#include <cstdio>
#include <algorithm>
#include <iomanip>
#include <cmath>
#include <vector>
#include <map>
#include <set>

#define loop(i, num)  for (int i = 0; i < num; i++)

using namespace std;

long long n1, n2, a, b, c, ans;

int main() {

    cin >> n1 >> n2 >> a >> b >> c;

    n2 -= b;

    n1 -= b;

    n1 -= 2 * a;

    long long req = 3 * c;

    if (n1 > 0 && req > 0) {

        req -= min(n1, req);

        n1 = 0;

    }

    if (n2 > 0 && req > 0) {

        req -= min(n2, req);

        n2 = 0;

    }

    ans = (n1 > 0 ? 0 : -n1) + (n2 > 0 ? 0 : -n2) + req;

    cout << ans << endl;

}


#include<iostream>
using namespace std;
int main()
{   int n;
    while(true)
    {cin>>n;
    n=n*3/2;
    cout<<n<<endl;
    }
}


#include <stdio.h>
#include <conio.h>
int main()
{
 int j,x;
  scanf("%d",&j);
  x=(2*j)-(j/2);
  printf("%d",x);
  getch();
 return 0;
}


#include <iostream>
#include <conio.h>
using namespace std;
int main ()
{
    long long int n;
    cin>>n;
    cout<<n*3/2;
    getch();
    return 0;
}


#include <iostream>
#include <conio.h>
using namespace std;
int main ()
{
    int n;
    cin>>n;
    cout<<n*3/2;
    getch();
    return 0;
}


#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <sstream>
#include <algorithm>
#include <utility>
#include <cmath>

#include <vector>
#include <string>
#include <cstring>
#include <set>
#include <queue>
#include <deque>
#include <map>
#include <bitset>
#include <list>

#include <functional>
#include <numeric>
#include <cassert>
#include <ctime>

using namespace std;

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

#define mp make_pair
#define pb push_back
#define rep(i, n) for(int (i) = 0; (i) < (n); ++(i))
#define repr(i, l, r) for(int (i) = (l); (i) < (r); ++(i))
#define clr(t, v) memset((t), (v), sizeof(t))
#define all(x) (x).begin(), (x).end()
#define sz(x) ((int)(x).size())
#define fi first
#define se second

#define DEBUG

int r, h, c;

int main() {
#ifdef DEBUG
	freopen("in.txt", "r", stdin);
	//freopen("out.txt", "w", stdout);
#endif
	cin>>r>>h;
	c += 2*(h/r);
	h %= r;
	double h2, r2;
	h2 = h; r2 = r;
	if (h2>=r2/2) {
		c += 2;
		if (2*h2*h2>=r2*r2)
			c++;
	} else {
		c += 1;
	}
	cout << c << '\n';

	return 0;
}


#include <bits/stdc++.h>
using namespace std;
int r,h;
int ans;

int main()
{
    //freopen("in.txt","r",stdin);
    //freopen("out.txt","w",stdout);
    ans=(h/r)<<1;
    h%=r;
    int t=sqrt(3)*r;
    if(t<h*2) ans+=3;
    else{
        if(r>h*2) ans++;
        else ans+=2;
    }
    printf("%d",ans);
    return 0;
}


#include <iostream>
#include <fstream>
#include <vector>
#include <utility>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <iomanip>

#define vint vector<int>::iterator
#define maxn 100003

using namespace std;

ifstream fin("A.in");
ofstream fout("A.out");

int r,h;

int main()
{
    fin>>r>>h;

    if (h%r==0)
    {
        cout<<(h/r)*2+1;
        return 0;
    }

    double d = double(h)/double(r);
    int z = h/r;

    double dd = z+0.5;

    if (d>=dd)
    {
        if ((r/2)*(r/2) +  ((d-dd)*r+r/2)*((d-dd)*r+r/2) >= r) cout<<2*z+3;
        else cout<<2*z+2;
    }
    else
    {
        cout<<2*z+1;
    }
}


#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
typedef long long ll;
typedef vector<long long> vl;
typedef pair<long long , long long > pl;
#define po pop_back
#define pb push_back
#define mk make_pair
#define lw lower_bound
#define up upper_bound
#define ff first
#define ss second
#define boost ios_base::sync_with_stdio(); cin.tie(0); cout.tie(0);
#define MOD 1000000007
#define MAX 1e18
#define MIN -1e18
#define rep(i,a,b) for(ll i=a;i<=b;i++)
#define per(i,a,b) for(ll i=a;i>=b;i--)
#define con continue
#define freopen freopen("input.txt", "r", stdin);freopen("output.txt", "w", stdout);
#define PI 3.14159265358979323846264338327950288419716939937510582097494459230781640628
typedef tree<ll , null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update> indexed_set;
//template< typename T>
//using indexed_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
const int N=1e6+1;
ll ans,mid,mn,mx,cnt,m,T,sum,h1,h2,a,b,c[1234567],d[1234567],c1[N][30],n,k,i,j,l,x,y,r;
bool used[10000005];
ll dp[60][60][60][60];
string s;
int main(){
    double x,y;
    cin>>x>>y;
    printf("%.10lf" , y/x*2+1);
}


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

using namespace std;

class Lar
{
public:
	Lar(int nr1, int nr2, int nc1, int nc2, int nd1, int nd2)
	{
		gems[0][0] = 0;
		gems[0][1] = 0;
		gems[1][0] = 0;
		gems[1][1] = 0;

		r1 = nr1;
		r2 = nr2;
		c1 = nc1;
		c2 = nc2;
		d1 = nd1;
		d2 = nd2;
	}

	void setR1(int n1, int n2)
	{
		gems[0][0] = n1;
		gems[0][1] = n2;
	}

	void setR2(int n1, int n2)
	{
		gems[1][0] = n1;
		gems[1][1] = n2;
	}

	bool check()
	{
		if (gems[0][0] == gems[1][0] || gems[0][0] == gems[0][1] || gems[0][0] == gems[1][1])
			return false;
		if (gems[0][1] == gems[1][0] || gems[0][1] == gems[1][1])
			return false;
		if (gems[1][0] == gems[1][1])
			return false;

		if (gems[0][0] + gems[0][1] != r1)
			return false;

		if (gems[1][0] + gems[1][1] != r2)
			return false;

		if (gems[0][0] + gems[1][0] != c1)
			return false;

		if (gems[0][1] + gems[1][1] != c2)
			return false;

		if (gems[0][0] + gems[1][1] != d1)
			return false;

		if (gems[0][1] + gems[1][0] != d2)
			return false;

		return true;
	}

private:
	int gems[2][2];
	int r1, r2, c1, c2, d1, d2;
};

int main(int argc, char* argv[])
{
	int r1, r2, c1, c2, d1, d2;
	cin >> r1;
	cin >> r2;
	cin >> c1;
	cin >> c2;
	cin >> d1;
	cin >> d2;

	Lar lar(r1, r2, c1, c2, d1, d2);

	for (int i = 1; i < r1; i++)
	{
		lar.setR1(i, r1 - i);

		for (int j = 1; j < r2; j++)
		{
			lar.setR2(j, r2 - j);

			if (lar.check())
			{
				cout << i << ' ' << r1 - i << endl <<
					j << ' ' << r2 - j;
				_getch();
				return 0;
			}
		}
	}

	cout << -1;
	_getch();
	return 0;
}


#include <iostream>
#include <fstream>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include <conio.h>

using namespace std;

int main(){

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

    getch();
    return 0;
}


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

int main(){
    ifstream fin;
    ofstream fout;
    int k, n;
    cin>>n>>k;
    int array[n];
    if(n%2==0){
               int count=0;
               for(int i=0; i<n/2; i++){
                       array[i]=count+1;
                       count+=2;
            }
            count=2;
            for(int j=n/2; j<n; j++){
                    array[j]=count;
                    count+=2;
            }
    }
        if(n%2==1){
               int count=0;
               for(int m=0; m<(n-1)/2; m++){
                       array[m]=count+1;
                       count+=2;
            }
            count=2;
            for(int p=(n+1)/2; p<n; p++){
                    array[p]=count;
                    count+=2;
            }
    }

    cout<<array[k-1];
getch();
return 0;
}


#include <iostream>
#include <conio.h>
using namespace std;
int main()
{
	long int n, m;
	cin >> n >> m;
	long int *a = new long int[n];
	long int x;
	long int j = 0;
	if (n % 2 == 0)
		x = n / 2;
	else x = n / 2 + 1;

	for (long int i = 1; i <= n; i++)
	{

		if (i % 2 == 0)
		{
			a[x] = i;
			x++;
		}
		else
		{
			a[j] = i;
			j++;
		}
	}
	cout << a[m-1];
	getch();
	return 0;
}


#include <iostream>
#include <conio.h>
using namespace std;
int main()
{
	long long n, m;
	cin >> n >> m;
	long long *a = new long long[n];
	long long x;
	long long j = 0;
	if (n % 2 == 0)
		x = n / 2;
	else x = n / 2 + 1;

	for (long long i = 1; i <= n; i++)
	{

		if (i % 2 == 0)
		{
			a[x] = i;
			x++;
		}
		else
		{
			a[j] = i;
			j++;
		}
	}
	cout << a[m-1];
	getch();
	return 0;
}


#include <stdio.h>
#include <strings.h>

int main(){
	int alf[26],cont=0;
	//nineteen => n = 3,i=1,e=3,t=1
	int n=3,i=1,e=3,t=1;
	char str[110];

		scanf(" %s",str);
		//printf("%s\n",str);
		for(int j=0;j<26;j++)
			alf[j]=0;
		for(int j =0;j< strlen(str);j++)
			alf[(int)str[j]-'a']++;

	//	for(int j=0;j<26;j++)
	//		printf("%d ",alf[j]);

	int N =alf[13];
	int E = alf[4];
	int I = alf[8];
	int T = alf[19];

	while(N && I && E && T){
		if(N>=n && I>= i && E>=e && T>=t){
			N -= 2;I-=i;E-=e;T-=t;cont++;
		}
	}

	printf("%d\n",cont);

return 0;
}
// 1506955344782


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

int main()
{
    char s[100];
    cin>>s;
    int n=0,i=0,e=0,t=0;
    int w=0;
    for(int i=0;i<sizeof(s);i++)
    {
        string temp="";
        for(int j=i;j<i+8 && j<sizeof(s);j=j++)
        {
            temp+=s[j];
        }
        if(temp=="nineteen")
            {
                w++;
                for(int j=i;j<i+7;j++)
                {
                    s[j]=' ';
                }
            }

    }
    for(int j=0;j<sizeof(s);j++)
    {
        if(s[j]=='n') n++;
        if(s[j]=='i') i++;
        if(s[j]=='e') e++;
        if(s[j]=='t') t++;
    }
    int q=0;
    while(n>=3 && i>=1 && e>=3 && t>=1)
    {
        n=n-3;
        i=i-1;
        e=e-3;
        t=t-1;
        q++;
    }
    cout << w+q<<endl;

    return 0;
}


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

int main()
{
    char s[100];
    cin>>s;
    int n=0,i=0,e=0,t=0;
    int w=0;
    for(int i=0;i<sizeof(s)-8;i++)
    {
        string temp="";
        for(int j=i;j<i+8;j=j++)
        {
            temp+=s[j];
        }
        if(temp=="nineteen")
            {
                w++;
                for(int j=i;j<i+7;j++)
                {
                    s[j]=' ';
                }
            }

    }
    for(int j=0;j<sizeof(s);j++)
    {
        if(s[j]=='n') n++;
        if(s[j]=='i') i++;
        if(s[j]=='e') e++;
        if(s[j]=='t') t++;
    }
    int q=0;
    while(n>=3 && i>=1 && e>=3 && t>=1)
    {
        n=n-3;
        i=i-1;
        e=e-3;
        t=t-1;
        q++;
    }
    cout << w+q<<endl;

    return 0;
}


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

#define ll long long
#define vi vector<int>
#define vs vector<string>
#define vc vector<char>
#define twv vector<vector<int>>
#define fo(i,a,n) for(int i=int(a);i<int(n);i++)
#define op(x) cout<<x
#define ip(x) cin>>x
#define si set<int>
#define sc set<char>
#define ss set<string>
#define qqi queue<int>
#define qqc queue<char>
#define sti stack<int>
#define stc stack<char>
#define nl cout<<"\n"
#define pb(x) push_back(x)
int main()
{
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n;ip(n);
    vi a(n,0);
    vi b(n,0);
    int max_ans=0;
    fo(i,0,3)ip(a[i]);
    fo(i,0,3)ip(b[i]);
    fo(i,0,3){
        max_ans+=min(a[i],b[(i+1)%3]);
    }
    vi visited(3,0);
    fo(i,0,3){
        int max_index=0;int max=0;
        fo(j,0,3){
            if(a[j]>max && !visited[j]){
                max=a[j];
                max_index=j;
            }
        }
        if(!visited[max_index]){
            visited[max_index]=1;
            int j=max_index;int k=(j-1)%3;
            if(k<0)k=3+k;
            if(b[j]+b[k]<=a[j]){
                a[j]-=b[j]+b[k];
                b[j]=0;b[k]=0;
            }
            else{
                int t=min(b[k],a[j]);
                a[j]-=t;
                b[k]=b[k]-t;
                int w=min(a[j],b[j]);
                a[j]-=w;
                b[j]-=w;
            }
        }
    }
    int min_ans=0;
        fo(i,0,3){
        min_ans+=min(a[i],b[(i+1)%3]);
    }
    cout<<min_ans<<" "<<max_ans;
	return 0;
}


#include<bits/stdc++.h>
#define endl "\n";
#define ll long long
#define pb push_back
#define mp make_pair
#define ull unsigned long long
#define satyam ios_base::sync_with_stdio(false);
#define mishra cin.tie(NULL);cout.tie(NULL);
#define mod 1000000007
using namespace std;
ll fac[2000005];
void pre(){ fac[0]=1; fac[1]=1; for(ll i=2;i<2000005;i++) fac[i]=(i*fac[i-1])%mod;}
ll power(ll a,ll b){ll res=1;while(b){if(b&1) res=(res*a)%mod;a=(a*a)%mod;b=b/2;}return res%mod;}
ll ncr(ll n,ll r){return ((fac[n]*power(fac[r],mod-2))%mod*power(fac[n-r],mod-2))%mod;}
ll binomialCoeff(ll n, ll k) {
  ll C[k + 1];
  memset(C, 0, sizeof(C));
  C[0] = 1; // nC0 is 1
  for (ll i = 1; i <= n; i++) {

    // Compute next row of pascal triangle using
    // the previous row
    for (ll j = min(i, k); j > 0; j--)
      C[j] = C[j] + C[j - 1];
  }
  return C[k];
}

// Returns count of G.P. subseqeunces
// with length 3 and common ratio r
long long subsequences(ll a[], ll n, ll r)
{
    // hashing to maintain left and right array
    // elements to the main count
    unordered_map<ll,ll> left, right;

    // stores the answer
    long long ans = 0;

    // traverse through the elements
    for (ll i = 0; i < n; i++)
        right[a[i]]++; // keep the count in the hash

    // IF RATIO IS ONE
    if (r == 1){

        // traverse the count in hash
        for (auto i : right) {

             // calculating nC3, where 'n' is
             // the number of times each number is
             // repeated in the input
             ans += binomialCoeff(i.second, 3);
        }

        return ans;
    }

    // traverse through all elements
    // and find out the number of elements as k1*k2
    for (ll i = 0; i < n; i++) {

        // keep the count of left and right elements
        // left is a[i]/r and right a[i]*r
        long long c1 = 0, c2 = 0;

        // if the current element is divisible by k,
        // count elements in left hash.
        if (a[i] % r == 0)
            c1 = left[a[i] / r];

        // decrease the count in right hash
        right[a[i]]--;

        // number of right elements
        c2 = right[a[i] * r];

        // calculate the answer
        ans += c1 * c2;

        left[a[i]]++; // left count of a[i]
    }

    // returns answer
    return ans;
}
void sol()
{
    int n;
    cin>>n;
    vector<int> v(n),b(n);
    for(int i=0;i<n;i++)
    {
      cin>>v[i];
      b[i]=v[i];
    }
    sort(v.begin(),v.end(),greater<int>());
    bool flag=false;
    for(int i=0;i<n;i++)
    {
      if(v[i]!=b[i])
        flag=true;
      if(i!=0 && b[i-1]==b[i])
      {
        flag=true;
        break;
      }
    }
    if(flag)
    {
      cout<<"YES\n";
    }
    else
    {
      cout<<"NO\n";
    }

}
void solve(ll n)
{
    vector<ll> v(n);
    for(int i=0;i<n;i++)
    {
      cin>>v[i];
      //b[i]=v[i];
    }
    sort(v.begin(),v.end());
    ll p=1;
    ll ans=0;
    int ind=0;
    for(int i=0;i<32;i++)
    {
      p=p*2;
      ll tmp=0;
      for(ind;ind<n && v[ind]<p;ind++)
      {
        tmp++;
      }
      if(tmp>=2)
      {
        ans+= ((tmp)*(tmp-1))/2;
      }
    }
    cout<<ans<<endl;
  }
void satyamm()
  {
    ll n,x;
   cin>>n>>x;
   vector<ll>v;
   v.pb(2);
   ll i=0;
   while(v[i]<n)
   {
      v.pb(v[i]+x);
      i++;
   }
   i++;
   cout<<i<<endl;
  }
void kamalkutiya()
{
    ll n,m;
    cin>>n>>m;
    ll arr[n];
    for(int i=0;i<n;i++)
    {
      arr[i]=i+1;
    }
    sort(arr,arr+n);
    for(int i=0;i<15;i++)
    {
     sort(arr,arr+n);
    }
    int nn=n;
    for(int i=0;i<15;i++)
    {
     sort(arr,arr+n);
    }
    ll flag=0;
     for(int i=0;i<15;i++)
    {
     sort(arr,arr+n);
    }
    while(nn--){
        int a,b,c,d;
        cin>>a>>b>>c>>d;

        if(b == c){
            flag=1;
        }
    }
   for(int i=0;i<15;i++)
    {
     sort(arr,arr+n);
    }
    if(m%2==1)
    {
        cout<<"NO"<<endl;
    }
    else if(flag==1)
      {
        cout<<"YES"<<endl;
     }
    else
      {
        cout<<"NO"<<endl;
      }
}
void tangay()
{
    ll n;cin>>n;
    ll a1,b1,a2,b2,a3,b3;
    cin>>a1>>a2>>a3>>b1>>b2>>b3;
    ll arr[n];
    for(int i=0;i<n;i++)
    {
      arr[i]=i+1;
    }
    sort(arr,arr+n);
    cout<<max((ll)0,max(a1-b1-b3,max(a2-b2-b1,a3-b3-b2)))<<" ";
    for(int i=0;i<15;i++)
    {
     sort(arr,arr+n);
    }
    cout<<min(a1,b2)+min(a2,b3)+min(a3,b1)<<endl;
}
int main()
{
  satyam mishra
  int t;
  //cin>>t;
  t=1;
  pre();
  while(t--)
  {
    //satyamm();
    //kamalkutiya();
    tangay();
   // nikhil();
    //nikhilpro();
  }
  return 0;
}


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

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

int solve(vector<pair<int,pair<int,int>>> v)
{
    int i;
    rep(i,3){
        v.at(i).first = min(v.at(i).second.first, v.at(i).second.second);
    }
    sort(all(v));
    if(v.at(2).second.second >= v.at(0).second.first + v.at(1).second.first){
        return v.at(2).second.second - v.at(0).second.first - v.at(1).second.first;
    }
    vector<pair<int,pair<int,int>>> vtmp = v;
    int ans = (1ll << 60);
    {
        if(v.at(2).second.second >= v.at(1).second.first){
            vtmp.at(0).second.first -= v.at(2).second.second - v.at(1).second.first;
            vtmp.at(1).second.first = 0;
            vtmp.at(2).second.second = 0;
            ans = min(ans, solve(vtmp));
        }else{
            vtmp.at(1).second.first -= v.at(2).second.second;
            vtmp.at(2).second.second = 0;
            ans = min(ans, solve(vtmp));
        }
    }
    return ans;

}

int main()
{
    int i,j;
    int n;
    cin >> n;
    vector<int> a(3);
    vector<int> b(3);
    rep(i,3) cin >> a[i];
    rep(i,3) cin >> b[i];
    int maxwin = min(a[0], b[1]) + min(a[1], b[2]) + min(a[2], b[0]);
    vector<pair<int,pair<int,int>>> v;
    rep(i,3){
        v.emplace_back(min(a[i], b[(i + 1)%3]), make_pair(a[i], b[(i + 1)%3]));
    }
    int minwin = solve(v);
    cout << minwin << " " << maxwin << endl;

    return 0;
}


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

#define rep(i,n) for(i = 0;i < n;++i)
#define all(v) v.begin(), v.end()
using ll = long long;

ll solve(vector<pair<ll,pair<ll,ll>>> v)
{
    int i;
    rep(i,3){
        v.at(i).first = min(v.at(i).second.first, v.at(i).second.second);
    }
    sort(all(v));
    if(v.at(2).second.second >= v.at(0).second.first + v.at(1).second.first){
        return v.at(2).second.second - v.at(0).second.first - v.at(1).second.first;
    }
    vector<pair<ll,pair<ll,ll>>> vtmp = v;
    ll ans = (1ll << 60);
    {
        if(v.at(2).second.second >= v.at(1).second.first){
            vtmp.at(0).second.first -= v.at(2).second.second - v.at(1).second.first;
            vtmp.at(1).second.first = 0;
            vtmp.at(2).second.second = 0;
            ans = min(ans, solve(vtmp));
        }else{
            vtmp.at(1).second.first -= v.at(2).second.second;
            vtmp.at(2).second.second = 0;
            ans = min(ans, solve(vtmp));
        }
    }
    return ans;

}

int main()
{
    ll i,j;
    ll n;
    cin >> n;
    vector<ll> a(3);
    vector<ll> b(3);
    rep(i,3) cin >> a[i];
    rep(i,3) cin >> b[i];
    ll maxwin = min(a[0], b[1]) + min(a[1], b[2]) + min(a[2], b[0]);
    vector<pair<ll,pair<ll,ll>>> v;
    rep(i,3){
        v.emplace_back(min(a[i], b[(i + 1)%3]), make_pair(a[i], b[(i + 1)%3]));
    }
    ll minwin = solve(v);
    cout << minwin << " " << maxwin << endl;

    return 0;
}


#include<math.h>
#include<stdio.h>
#include <cstdio>
#include <cstring>
#include <bits/stdc++.h>
#include <string>
#include <iomanip>
#include <cstdlib>
#include <vector>
#include <map>
#include <set>
#include <algorithm>
#define ll long long

using namespace std;
int main()
{
    int n;
    cin>>n;
    int a[n];
    for(int i=0; i<n; i++)
        cin>>a[i];
    sort(a,a+n);
    set < int >  r(a,a+n) ;
    int  len=r.size(),ok = 0;
    for(int i=0; i<len-2; i++)
    {
        if(a[i+2]-a[i]<3)
            ok = 1;
    }
    if(ok==1)
        cout << "YES";
    else
     cout<<"NO";
    return 0;
}


#include <bits/stdc++.h>

using namespace std;

#define SYN ios_base::sync_with_stdio(0);cin.tie(0);
typedef long long int LLI;
typedef unsigned long long int ULLI;

#define dbg(x)         cerr<<__LINE__<<" "<<#x<<" "<<x<<endl;
#define IMAX ((unsigned)1<<31)-1
#define eps 1e-11
#define mem(a,v) memset(a,v,sizeof (a))
#define SZ(X) ((int)X.size())
#define VI vector<LLI>
#define VS vector<string>
#define PB push_back
#define PI acos(-1.0)
#define mk make_pair
#define pll pair<LLI,LLI>
#define xx first
#define yy second
#define all(a) a.begin(),a.end()

#define MOD 1000000007
#define MX 100000
#define RADIANS(x)       (((1.0 * x * PI) / 180.0))
#define DEGREES(x)       (((x * 180.0) / (1.0 * PI)))

//I/O

#define  S                         scanf
#define  P                         printf

#define I(X)                       scanf("%I64", &(X))
#define II(X, Y)                   scanf("%I64%I64", &(X), &(Y))
#define III(X, Y, Z)               scanf("%I64%I64%I64", &(X), &(Y), &(Z))

// Loop

#define  F(i,a,b)                  for(int i=a;i<b; i++)
#define  FF(i,a,b)                 for(int i=a;i<=b;i++)

LLI n,m,k,arr[MX],fst[MX],snd[MX];
string str;

LLI stringtoLLI(string  str)
{
    LLI val;
    stringstream ss;
    ss<<str;
    ss>>val;
    return val;
}

string LLItostring(LLI val)
{
    string str;
    stringstream ss;
    ss<<val;
    ss>>str;
    return str;
}

int main()
{
    LLI val;
    while(cin>>val)
    {

        for(LLI i=0; i<val; i++)
        {
            cin>>arr[i];
        }

        bool ok=false;

        for(LLI i=0; i<val-3; i++)
        {
            for(LLI j=i+1; j<val-1; j++)
            {
                for(LLI k=j+1; k<val; k++)
                {
                    LLI d1=-1,d2=-1,d3=-1;

                    if(arr[i]!=arr[j]&&arr[i]!=arr[k]&&arr[j]!=arr[k])
                    {

//                        string LLItostring(LLI val)
//                        {
//                            string str;
//                            stringstream ss;
//                            ss<<val;
//                            ss>>str;
//                            return str;
//                        }

                        d1=arr[k]-arr[i];
                        if(d1<0)
                            d1*=(-1);
                        d2=arr[k]-arr[j];
                        if(d2<0)
                            d2*=(-1);
                        d3=arr[j]-arr[i];
                        if(d3<0)
                            d3*=(-1);
                        if(d1<=2&&d2<=2&&d3<=2)
                        {
                            ok=true;
                            break;
                        }
                    }
                }
                if(ok==true)
                    break;
            }
            if(ok==true)
                break;
        }
        if(ok==true)
            cout<<"YES"<<endl;
        else
            cout<<"NO"<<endl;
    }
    return 0;
}


#include <iostream>
#include <algorithm>
using namespace std;
int a[1002],i,n,k;
main(){
	cin>>n;
	for(i=0;i<n;i++){
		cin>>a[i];
	}
	sort(a,a+n);
	for(i=0;i<n;i++){
		if(a[i]==a[i+1]){
		 a[i]=0;}
	}
	sort(a,a+n);
	for(i=0;i<n;i++){
		if(a[i]+1==a[i+1]&&a[i+1]+1==a[i+2]) k++;
	}
	if(k>0){cout<<"YES"; return 0;} else {cout<<"NO"; return 0;}
}


#include<bits/stdc++.h>
using namespace std;
#define maxn  100000005
#define INF    1<<32-1
int n,MAX=-INF;
int a[maxn];
bool F[maxn];
int main(){
    scanf("%d",&n);
    for(int i=1;i<=n;i++){
        scanf("%d",&a[i]);
        F[a[i]]=1;
        if(a[i]>MAX)MAX=a[i];
}
//for(int i=1;i<=MAX;i++){
//	printf("%d",F[i]);
//}
//puts("");
    int flag=0;
    for(int i=1;i<=MAX;i++){
        if(F[i]==1)flag++;
        else flag=0;
        if(flag==3){puts("YES");  flag=0;return 0; }
    }
    puts("NO");
    return 0;
}


#include <iostream>
#include <math.h>
#include <string>

using namespace std;
void main(){
string a1,b1, s;
                                                    //cin >>s;
                                                    //getline(cin , s ) ;
                                                    //
                                                    int a,b,k=0,x =1,nice=0;
                                                    //a1=(s[0],s.find_first_of(' ')-1);
    cin >>a>>b ;                                                //b1=(s.find_first_of(' ')+1,s.length()-1);
                                                    //a=atoi(a1.c_str());
                                                    //b=atoi(b1.c_str());
                                                    // bool l=0;
                                                    // cout <<a1<<"\n"<<b1;
                                                    //
    if ((x%b)!=0){
for (x=1 ;k<=a;x++)
{
    if ((x%b)!=0)
    {
        k=floor(double (x/b))/(x%b);
        if ((k>=1)&&(k<=a))
        {cout <<"\nx="<<x;
        nice +=x ;
        //l=0;
        }
    }
    else {if (b==1)break ; }
    //if (k>a&&k<1 )break;
}
cout << nice  ;
    }
    else {
    nice = 0 ;
    cout <<nice ;
    }
system ("pause ");
}


#include <bits/stdc++.h>

#define ll long long
#define pb push_back
#define pii pair<int,int>
#define pll pair<ll,ll>
#define ff first
#define ss second

using namespace std;

const double pi = acos(-1);
const int N = 2e6 + 6, mod = 1000000007, M = 1e7 + 7;
const ll MAX = 5e18;

ll a, b, c, v, ans;

ll moding(ll x){
    if(x >= mod)
        x %= mod;
    return x;
}

bool can(ll x){
    return (x / b) / (x % b) <= a;
}

int main()
{
    cin >> a >> b;
    if(b == 1)
        return puts("0");
    while(v < a){
        v++;
        c += moding(v * b) + 1;
    }
    ans = c;
    for(int i = 2; i < b; i++){
        while(!can((v * b + 1) * i))
            c -= v * b + 1, v--;
        ans = moding(ans + moding(moding(c) * i));
    }
    cout << ans;
    return 0;
}


///Bismillahir Rahmanir Rahim
#define inf 9223372036854775807
#define ll long long
#define pii pair<ll,ll>
#define m_p  make_pair
#define ull unsigned long long
#define spd  ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0);
#include <bits/stdc++.h>
using namespace std;
const ll m = 1e9+7;
int main()
{
    spd

    ll a,b,i,x,ans=0,sum=0,tot,k,last,gun,n;

    cin>>a>>b;
    map<ll,ll>mp;

    for(i=1;i<b;i++)
    {
        sum+=i;
        sum%=m;
        mp[i] = sum;
    }
    for(k=1;k<=a;k++)
    {
        ll fst = (((k%m)*(b%m))%m + (1%m))%m;

        ans+=((fst%m)*(mp[b-1]%m))%m;
        ans%=m;
    }

    cout<<ans<<endl;
}


#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef vector<ll> vll;
typedef pair<int, int> pii;
typedef vector<string> vs;
typedef vector<bool> vb;
typedef vector<int> vi;
typedef vector<double> vd;
typedef vector<vector<int> > vvi;
typedef vector<pii> vii;
typedef vector<vector<pii> > vvii;
typedef long double ld;
typedef map<int, int> mapii;
typedef map<string, int> mapsi;

#define erep(i, x, n) for (auto i = x; i<=(ll)(n); i++)
#define rep(i, x, n) for(auto i = x; i<(ll)(n); i++)
#define INF  LLONG_MAX
#define all(v) ((v).begin()), ((v).end())
#define sz(v) ((int)((v).size()))
#define pi  acos(-1)
#define mod(n,m) ((n % m + m) % m)
#define eps (1e-8)
#define reset(n, m) memset(n, m, sizeof n)
#define endl '\n'
#define output freopen("output.txt", "w", stdout)
#define mp(x, y, z) { x, {y, z} }

const int N = 2e7 + 5, mod = 1e9 + 7;
ll vals[N], accum[N];

int main()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0);
//	ll p = 0, q = 5;
//	erep(i, 1, 1000)
//	{
//		if (i % q == 0)
//			continue;
//
//		if (((i / q) / (i % q)) == 2)
//		{
//			p += i;
//			cout << i << " " << i / q << " " << i % q << endl;
//
//		}
//	}
//	cout << p << endl;
//	return 0;

	ll a, b;
	cin >> a >> b;
	rep(i, 1, N)
	{
		vals[i] = vals[i - 1] + b;
		if (vals[i] >= mod)
			vals[i] -= mod;
		accum[i] = accum[i - 1] + vals[i];
		if (accum[i] >= mod)
			accum[i] -= mod;
	}

	ll sum = 0, temp = (b * (b - 1)) / 2, extra = -1, obba7 = 0, zawwed = 0,
			prev;
	for (ll i = 1; i < b; i++)
		zawwed = (zawwed + i * i) % mod;
	erep(i, 1, a)
	{
		if (extra != -1)
		{
			sum = (sum + prev + obba7) % mod;
			prev = sum;
			continue;
		}

		if (i == 1)
		{
			rep(j, 1, b)
			{
				int l = j - 1, r = (2 * j) - 1;
				sum = (sum + (accum[r] - accum[l])) % mod;
			}
			sum = (sum + zawwed) % mod;
		}
		else
		{
			extra = 0;
			ll hoba = temp;
			rep(j, 1, b)
			{
				int l = (2 * j) - 1, r = min(l + j * 1ll, l + hoba);
				if (j == 1)
					r = j + 1, l = 1;
				extra = (extra + (accum[r] - accum[l])) % mod;
				hoba -= j;
			}
			extra = (extra + zawwed) % mod;
			obba7 = mod(extra - sum, mod);
//			cout << "--> " << extra << " " << obba7 << endl;
//			cout << extra << endl;
			sum = (sum + extra) % mod;
			prev = extra;
		}
	}
	cout << sum;

	return 0;
}


#include <cstdio>
#include <algorithm>
using namespace std;
const int maxd = 10005;
int dp[maxd];
int main(){
    int n,m,number=1,tot=1;
    scanf("%d %d",&n,&m);
    for(int i=1;i<=maxd;i++){
        dp[i] = number+1;
        tot--;
        if(!tot)tot = ++number;
    }
    printf("%d %d",max(0,n-(m*2)),n-dp[m]);
    return 0;
}


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

using namespace std;

typedef long long ll;

ll n, m;
ll jc[100100];

int main()
{
	cin >> n >> m;
	if (n == 1)
	{
		cout << "1 1";
		return 0;
	}
	if (m == 0)
	{
		cout << n << " " << n;
		return 0;
	}
	for (ll i = 1; i <= n; ++i) jc[i] = (i * (i - 1)) >> 1;
	cout << max(n - (m << 1), 1LL * 0);
	cout << " ";
	for (int i = 1; i <= n; ++i)
		if (m < jc[i])
		{
			ll mm = m;
			mm -= jc[i - 1];
			while (mm > 0)
			{
				mm -= (i - 1);
				++i;
			}
			cout << n - i + 1;
			return 0;
		}

}


#include <iostream>
#include <algorithm>

using namespace std;

typedef long long ll;
const ll inf = 1e18;

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

	cout << max((ll)0,n - 2 * m) << ' ';

	for (ll i = 0; i < n*(n - 1) / 2; i++) {
		if (i*(i - 1) / 2 >= m) {
			cout << n - i;
			break;
		}
	}

	return 0;
}


#include <iostream>
#include <string>
#include <map>
#include <cmath>

using namespace std;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    int n, j, a, s, b, c, i;
    long long sum, m;
    cin >> n >> m;
    if(m == 0) cout << n << " " << n;
    else
    if(m == 1) cout << max(n - 2, 0) << " " << max(n - 2, 0);
    else{
    if(m >= (n + 1) / 2) cout << 0 << " ";
        else cout << n % m << " ";
    i = 1;
    sum = 0;
    for(;sum < m; i++)
        sum += i;
    cout << max(n - i, 0);
    return 0;
}
}


#include<iostream>
using namespace std;
int main (){
	long long int a,b;
	cin>>a>>b;
	for(int i=0;i<=a*b+10000000;i+=b)
	{
		if(i>a)
		{
			cout<<i;return 0;
		}
	}

	return 0;
}


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

#define MIN(a, b)	(a < b) ? a : b
#define MAX(a, b)	(a > b) ? a : b
#define endl	"\n"

typedef long long int int64;
typedef long double ld;

int main()
{
	ios_base :: sync_with_stdio(false);
	int n, k;
	cin >> n >> k;
	if(n % k == 0) cout << k*(n/k + 1) << endl;
	else cout << setprecision(1000000000) << k*(ceil((double)n/k)) << endl;
}


#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define ull unsigned long long int
#define file freopen("input.txt", "r", stdin);freopen("output.txt", "w", stdout);
#define done cin.tie(0);std::ios::sync_with_stdio(false);
#define forit(i, a) for ( __typeof( (a).begin() ) i = (a).begin(); i != (a).end(); i++ )
#define mp make_pair
#define pb push_back
#define clr(a,n) memset(a,n,sizeof(a))
#define all(c) c.begin(), c.end()
#define rep(i,n) for(int i=0;i<n;i++)
#define frep(i, n) for(int i=n-1;i>=0;i--)
#define popone(a) __builtin_popcount(a)
#define popzero(a) __builtin_ctz(a)
#define PI = 2.0*acos(0.0)
#define mod 1000000007
#define pi 3.14159265359
//ll gcd (ll x,ll y){if(y==0)return x;return gcd(y,x%y);}
//ll lcm(ll a,ll b){return a/gcd(a,b) * b;}
//bool power2(int x){return (x && !(x & (x - 1)));}
//ll largest_power(ll n){n = n| (n>>1);n= n| (n>>2);n = n| (n>>4);n = n| (n>>8);return (n+1)>>1;}
//bool cmp(pair<int,int>x,pair<int,int>y)
//{if (x.second==y.second) return x.first<y.first;return x.second>y.second;}
//int dx[] = {-1, -1, 1, 1, -2, -2, 2, 2 };
//int dy[] = {2, -2, 2, -2, 1, -1, 1, -1 };
//int dx[] = {1, -1, 0, 0, -1, -1, 1, 1};
//int dy[] = {0, 0, 1, -1, 1, -1, 1, -1};
//int dx[]= {1, -1, 0, 0};
//int dy[]= {0, 0, 1, -1};
vector<ll>vec;
ll n,k;
void solve()
{
    for(ll i=1;i<=1e9;i++)
        vec.pb(k*i);
}
int main()
{
    done
    cin>>n>>k;
    solve();
    cout<<*upper_bound(all(vec),n)<<endl;

    return 0;
}


#include <iostream>
#include <string>
#include <conio.h>
#include <Windows.h>
#include <stdlib.h>

using namespace std;

int main()
{
	int n, k, x;

	cin >> n >> k;

	x = n;

	while (x % k != 0)
	{
		x++;
	}

	cout << x;

	getch();
    return 0;
}


#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <limits.h>
#include <cmath>

using namespace std;

int main()
{
  int n;
  cin>>n;
  long long k = n * (n + 1) / 2;
  cout<<k%2<<endl;
  return 0;
}


#include <iostream>
#include <algorithm>
#include <cstdio>
#include <vector>
#include <cmath>
#include <complex>
#include <queue>
#include <map>
#include <set>
#include <bitset>
#include <iomanip>
#include <ctime>
//#include <unordered_map>
#define y1 blablabla
#define ll long long
#define tm ghfdskjdhf
#define MAXN 500005
#define MAXC 7000
//#define INF "~"
#define ss second
#define ff first
//#define int long long
#define fpos fuuuu
//#define double long double

using namespace std;

int n;

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

    ios_base::sync_with_stdio(0);
    cin.tie();

    cin >> n;

    if((n * (n + 1) / 2) % 2 == 1)
        cout << 1;
    else
        cout << 0;
    return 0;
}


#include<bits/stdc++.h>

using namespace std;

int main()
{
    int n,s=0;
    cin>>n;
    s=n*(n+1)/2;
    cout<<s%2;
    return 0;

}


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

int main() {
	int n;
	cin>>n;
	long long sum=((n+1)*n/2);
	cout<< sum%2 ;
	return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define MOD 1000000007
#define N 200100
#define  LL long long
LL fac[N], inv[N];
LL powi(LL a, LL b)
{
    LL c = 1;
    for (; b; b /= 2, a = 1ll * a * a % MOD)
        if (b & 1) c = 1ll * c * a % MOD;
    return c;
}
LL f, w, h;
LL C(LL a, LL b)
{
    if (a < 0) return 0;
    if (b < 0) return 0;
    if (a - b < 0) return 0;
    return 1ll * fac[a] * inv[b] % MOD * inv[a - b] % MOD;
}
LL get(LL ff, LL ww)
{
    return 1ll * C(f - 1, ff - 1) * C(w - 1, ww - 1) % MOD;
}
LL get2(LL ff, LL ww)
{
    return 1ll * C(f - 1, ff - 1) * C(w - 1 - ww * h, ww - 1) % MOD;
}
LL P, Q;
int main()
{
    cin >> f >> w >> h;
    fac[0] = 1; for (LL i = 1; i < N; ++ i) fac[i] = 1ll * fac[i - 1] * i % MOD;
    inv[N - 1] = powi(fac[N - 1], MOD - 2);
    for (LL i = N - 2; ~i; -- i) inv[i] = 1ll * inv[i + 1] * (i + 1) % MOD;
    for (LL ff = 1; ff <= f + 1; ++ ff)
    {
        P = (P + get(ff, ff - 1)) % MOD;
        P = (P + get(ff, ff)) % MOD;
        P = (P + get(ff, ff)) % MOD;
        P = (P + get(ff, ff + 1)) % MOD;
        Q = (Q + get2(ff, ff - 1)) % MOD;
        Q = (Q + get2(ff, ff)) % MOD;
        Q = (Q + get2(ff, ff)) % MOD;
        Q = (Q + get2(ff, ff + 1)) % MOD;
    }
    cout << 1ll * Q * powi(P, MOD - 2) % MOD;
}


#include <iostream>
#include <stdio.h>
#include <math.h>
#include <algorithm>
#include <queue>
#include <map>
using namespace std;
#define LL long long
#define MAX 100100
#define MOD 1000000007

LL dp1[405][MAX];
LL dp2[405][MAX];
LL dp3[405][MAX];

LL quick(int k,LL x)
{
    LL res=1;
    while(k)
    {
        if(k%2)res=(res*x)%MOD;
        x=(x*x)%MOD;
        k/=2;
    }
    return res;
}

int main()
{
    int f,w,h;
    scanf("%d%d%d",&f,&w,&h);

    dp1[0][0]=1;
    for(int i=1;i<=f&&i<=400;i++)
    {
        LL sum=0;
        for(int j=1;j<=f;j++)
        {
            dp1[i][j]=(dp1[i-1][j-1]+sum)%MOD;
            sum=(sum+dp1[i-1][j-1])%MOD;
        }
    }

    dp2[0][0]=1;
    for(int i=1;i<=w&&i<=400;i++)
    {
        LL sum=0;
        for(int j=h+1;j<=w;j++)
        {
            dp2[i][j]=(dp2[i-1][j-h-1]+sum)%MOD;
            sum=(sum+dp2[i-1][j-h-1])%MOD;
        }
    }

    dp3[0][0]=1;
    for(int i=1;i<=w&&i<=400;i++)
    {
        LL sum=0;
        for(int j=1;j<=w;j++)
        {
            dp3[i][j]=(dp3[i-1][j-1]+sum)%MOD;
            sum=(sum+dp3[i-1][j-1])%MOD;
        }
    }

    LL ans1=0,ans2=0;
    for(int i=0;i<=400;i++)
    {
        ans1=(ans1+dp1[i][f]*dp2[i][w]*2)%MOD;
        ans1=(ans1+dp1[i][f]*dp2[i+1][w])%MOD;
        if(i>0)
        {
            ans1=(ans1+dp1[i][f]*dp2[i-1][w])%MOD;
        }

        ans2=(ans2+dp1[i][f]*dp3[i][w]*2)%MOD;
        ans2=(ans2+dp1[i][f]*dp3[i+1][w])%MOD;
        if(i>0)
        {
            ans2=(ans2+dp1[i][f]*dp3[i-1][w])%MOD;
        }
    }

    printf("%lld\n",(ans1*quick(MOD-2,ans2))%MOD);

    return 0;
}


#include <iostream>
#include <stdio.h>
#include <math.h>
#include <algorithm>
#include <queue>
#include <map>
using namespace std;
#define LL long long
#define MAX 100100
#define MOD 1000000007

int dp1[405][MAX];
int dp2[405][MAX];
int dp3[405][MAX];

LL quick(int k,LL x)
{
    LL res=1;
    while(k)
    {
        if(k%2)res=(res*x)%MOD;
        x=(x*x)%MOD;
        k/=2;
    }
    return res;
}

int main()
{
    int f,w,h;
    scanf("%d%d%d",&f,&w,&h);

    dp1[0][0]=1;
    for(int i=1;i<=f&&i<=400;i++)
    {
        LL sum=0;
        for(int j=1;j<=f;j++)
        {
            dp1[i][j]=(dp1[i-1][j-1]+sum)%MOD;
            sum=(sum+dp1[i-1][j-1])%MOD;
        }
    }

    dp2[0][0]=1;
    for(int i=1;i<=w&&i<=400;i++)
    {
        LL sum=0;
        for(int j=h+1;j<=w;j++)
        {
            dp2[i][j]=(dp2[i-1][j-h-1]+sum)%MOD;
            sum=(sum+dp2[i-1][j-h-1])%MOD;
        }
    }

    dp3[0][0]=1;
    for(int i=1;i<=w&&i<=400;i++)
    {
        LL sum=0;
        for(int j=1;j<=w;j++)
        {
            dp3[i][j]=(dp3[i-1][j-1]+sum)%MOD;
            sum=(sum+dp3[i-1][j-1])%MOD;
        }
    }

    LL ans1=0,ans2=0;
    for(int i=0;i<=400;i++)
    {
        ans1=(ans1+(LL)dp1[i][f]*dp2[i][w]*2)%MOD;
        ans1=(ans1+(LL)dp1[i][f]*dp2[i+1][w])%MOD;
        if(i>0)
        {
            ans1=(ans1+(LL)dp1[i][f]*dp2[i-1][w])%MOD;
        }

        ans2=(ans2+(LL)dp1[i][f]*dp3[i][w]*2)%MOD;
        ans2=(ans2+(LL)dp1[i][f]*dp3[i+1][w])%MOD;
        if(i>0)
        {
            ans2=(ans2+(LL)dp1[i][f]*dp3[i-1][w])%MOD;
        }
    }

    printf("%lld\n",(ans1*quick(MOD-2,ans2))%MOD);

    return 0;
}


#include<bits/stdc++.h>
using namespace std;
const int N=10001;
const int mod=1e9+7;
long long int C[N][N];
void build()
{
	int i,j;
	for(i=0;i<N;++i)		C[i][0]=1;
	for(i=0;i<N;++i)		C[i][i]=1;
	for(j=1;j<N;++j)
		for(i=j+1;i<N;++i)
			C[i][j]=(C[i-1][j-1]+C[i-1][j])%mod;
}
int num(int r,int b,int k)
{
	if(b==0) 			return 1;
	int ans=0,u;
	for(u=1;u<=r+1&&(k==0||u<=(b-1)/k);++u)
	{
		ans+=1ll*C[r+1][u]*C[b-k*u-1][u-1]%mod;
		ans%=mod;
	}
	return ans;
}
long long int binpow(long long int x,long long int pow)
{
	if(pow==0)			return 1LL;
	if(pow==1)			return x;
	if(pow%2==0)		return binpow((x*x)%mod,pow/2)%mod;
	if(pow%2==1)
	{
		long long int k=x;
		return k%mod*binpow((x*x)%mod,pow/2)%mod;
	}
}
int main ()
{
	build();
	int f,w,h;
	scanf("%d %d %d",&f,&w,&h);
	int sn=num(f,w,h);
	int sd=C[f+w][w];
	printf("%I64d",1LL*sn*binpow(sd,mod-2)%mod);
	return 0;
}


#include <iostream>
using namespace std;

int main() {
	char str[101];
	cin>>str;
	int ans=0,sb=0;
	for(int i=1;str[i];i++) {
		if(str[i]=='K' && str[i-1]=='V') ans++;
		if(str[i-1]=='V' && str[i]=='V' && str[i+1]!='K') sb++;
	}
	ans+= (sb>0);
	cout<<ans;
	return 0;
}


#include <iostream>
#include <string>
#include <conio.h>
using namespace std;
int main()

{
	string str;
	cin >> str;
	int count = 0;
	bool flag = true;
	if (str == "VV" || str == "KK")
	{
		cout << 1;
		return 0;
	}
	for (int i = 0; i < str.size(); i++)
	{
		if (str[i] == 'V' && str[i + 1] == 'K')
		{
			count++; continue;
		}
		if (flag)
		{
			if (i < str.size() - 2)
			{
				if (str[i] == 'V' && str[i + 1] == 'V' && str[i + 2] == 'V' || str[i] == 'K' && str[i + 1] == 'K' && str[i + 2] == 'K')
				{
					count++; flag = false;
					cout << "I WAS HERE";
				}
			}
		}
	}
	cout << count;
	_getch();
	return 0;
}


#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include<conio.h>

using namespace std;

int main()
{
char str[100];
scanf("%s", str);
int k = 0,f=0;
for (int i = 0; i < strlen(str)-1; i++){
if (str[i] == 'V' && str[i+1] == 'K') {
k++;
str[i]='Q';
str[i+1]='Q';
}
}
for (int i = 0; i < strlen(str)-1; i++){
if (str[i] == 'V' && str[i+1] == 'V') {
           f++;
           break;
           }
if (str[i] == 'K' && str[i+1] == 'K') {
           f++;
           break;
           }
}
printf("%d",k+f);
getch();
return 0;
}


#include <iostream>
#include <string>
#include <conio.h>
using namespace std;
int main()

{
	string str;
	cin >> str;
	int count = 0;
	bool flag = true;
	if (str == "VV" || str == "KK")
	{
		cout << 1;
		return 0;
	}
	for (int i = 0; i < str.size(); i++)
	{
		if (str[i] == 'V' && str[i + 1] == 'K')
		{
			count++; continue;
		}
		if (flag)
		{
			if (i < str.size() - 2)
			{
				if (str[i] == 'V' && str[i + 1] == 'V' && str[i + 2] == 'V' || str[i] == 'K' && str[i + 1] == 'K' && str[i + 2] == 'K')
				{
					count++; flag = false;

				}
			}
		}
	}
	cout << count;
	_getch();
	return 0;
}


//Lasha Bukhnikashvili
#include<iostream>
#include<stdio.h>
#include<math.h>
#include<iomanip>
#include<algorithm>
#include<vector>
#include<map>
#include<queue>
#include<string>
#define Pi 3.14159265358
#define mod9 %1000000009
#define INF 1000000000
#define mod7 %1000000007
#define LL  long long
#define time clock()/(double)CLOCKS_PER_SEC
using namespace std;
 int n,i,m,x,y,t,op;
 struct name{
        LL sum;
        LL upd;
 } T[800001];
 int a[200001];
 void BuildTree(int v,int tl,int tr){
      if (tl==tr){
         T[v].sum=a[tl];
         return;
      };
      int tm=(tl+tr)/2;
      BuildTree(2*v,tl,tm);
      BuildTree(2*v+1,tm+1,tr);
      T[v].sum=T[2*v].sum+T[2*v+1].sum;
 };
 void update(int v,int tl,int tr,int l,int r,int newval){
      if (l>r) return;
      if (tl==l && tr==r){
         T[v].upd+=newval;
         T[v].sum+=newval*(r-l+1);
         return;
      };
      int tm=(tl+tr)/2;
      update(2*v,tl,tm,l,min(tm,r),newval);
      update(2*v+1,tm+1,tr,max(tm+1,l),r,newval);
      T[v].sum=T[2*v].sum+T[2*v+1].sum;
 };
 LL query(int v,int tl,int tr,int l,int r,LL down){
    if (l>r) return 0;
    if (tl==l && tr==r) return T[v].sum+down*(r-l+1);
    int tm=(tl+tr)/2;

    return query(2*v,tl,tm,l,min(tm,r),down+T[v].upd)+query(2*v+1,tm+1,tr,max(tm+1,l),r,down+T[v].upd);

 };
int main(){

    cin>>n>>m;
    for (i=1;i<=n;i++)
        cin>>a[i];
    BuildTree(1,1,n);
    while (m--){
          cin>>op>>x>>y;
          if (op==2) cout<<query(1,1,n,x,y,0)<<endl;
             else cin>>t,update(1,1,n,x,y,t);
    };
 return 0;
}


//Lasha Bukhnikashvili
#include<iostream>
#include<stdio.h>
#include<math.h>
#include<iomanip>
#include<algorithm>
#include<vector>
#include<map>
#include<queue>
#include<string>
#define Pi 3.14159265358
#define mod9 %1000000009
#define INF 1000000000
#define mod7 %1000000007
#define LL  long long
#define time clock()/(double)CLOCKS_PER_SEC
using namespace std;
 int n,i,m,x,y,t,op;
 struct name{
        LL sum;
        int upd;
 } T[800001];
 int a[200001];
 void BuildTree(int v,int tl,int tr){
      if (tl==tr){
         T[v].sum=a[tl];
         return;
      };
      int tm=(tl+tr)/2;
      BuildTree(2*v,tl,tm);
      BuildTree(2*v+1,tm+1,tr);
      T[v].sum=T[2*v].sum+T[2*v+1].sum;
 };
 void update(int v,int tl,int tr,int l,int r,int newval){
      if (l>r) return;
      if (tl==l && tr==r){
         T[v].upd+=newval;
         T[v].sum+=newval*(r-l+1);
         return;
      };
      int tm=(tl+tr)/2;
      update(2*v,tl,tm,l,min(tm,r),newval);
      update(2*v+1,tm+1,tr,max(tm+1,l),r,newval);
      T[v].sum=T[2*v].sum+T[2*v+1].sum;
 };
 LL query(int v,int tl,int tr,int l,int r,int down){
    if (l>r) return 0;
    if (tl==l && tr==r) return T[v].sum+down*(r-l+1);
    int tm=(tl+tr)/2;
    LL out;
    out=query(2*v,tl,tm,l,min(tm,r),down+T[v].upd)+query(2*v+1,tm+1,tr,max(tm+1,l),r,down+T[v].upd);
    return out;
 };
int main(){

    cin>>n>>m;
    for (i=1;i<=n;i++)
        cin>>a[i];
    BuildTree(1,1,n);
    while (m--){
          cin>>op>>x>>y;
          if (op==2) cout<<query(1,1,n,x,y,0)<<endl;
             else cin>>t,update(1,1,n,x,y,t);
    };
 return 0;
}


//Lasha Bukhnikashvili
#include<iostream>
#include<stdio.h>
#include<math.h>
#include<iomanip>
#include<algorithm>
#include<vector>
#include<map>
#include<queue>
#include<string>
#define Pi 3.14159265358
#define mod9 %1000000009
#define INF 1000000000
#define mod7 %1000000007
#define LL  long long
#define time clock()/(double)CLOCKS_PER_SEC
using namespace std;
 int n,i,m,x,y,t,op;
 struct name{
        LL sum;
        int upd;
 } T[800001];
 int a[200001];
 void BuildTree(int v,int tl,int tr){
      if (tl==tr){
         T[v].sum=a[tl];
         return;
      };
      int tm=(tl+tr)/2;
      BuildTree(2*v,tl,tm);
      BuildTree(2*v+1,tm+1,tr);
      T[v].sum=T[2*v].sum+T[2*v+1].sum;
 };
 void update(int v,int tl,int tr,int l,int r,int newval){
      if (l>r) return;
      if (tl==l && tr==r){
         T[v].upd+=newval;
         T[v].sum+=newval*(r-l+1);
         return;
      };
      int tm=(tl+tr)/2;
      update(2*v,tl,tm,l,min(tm,r),newval);
      update(2*v+1,tm+1,tr,max(tm+1,l),r,newval);
      T[v].sum=T[2*v].sum+T[2*v+1].sum;
 };
 LL query(int v,int tl,int tr,int l,int r,int down){
    if (l>r) return 0;
    if (tl==l && tr==r) return T[v].sum+down*(r-l+1);
    int tm=(tl+tr)/2;
    return query(2*v,tl,tm,l,min(tm,r),down+T[v].upd)+query(2*v+1,tm+1,tr,max(tm+1,l),r,down+T[v].upd);
 };
int main(){
 #ifndef ONLINE_JUDGE
   freopen("input.txt","r",stdin);
   freopen("output.txt","w",stdout);
 #endif
    cin>>n>>m;
    for (i=1;i<=n;i++)
        cin>>a[i];
    BuildTree(1,1,n);
    while (m--){
          cin>>op>>x>>y;
          if (op==2) cout<<query(1,1,n,x,y,0)<<endl;
             else cin>>t,update(1,1,n,x,y,t);
    };
 return 0;
}


#include <cstdio>
#include <algorithm>

int n;
int a[1000];

int b[1000];
int c;

int x[20000000][10];

int zbroj;

int main(){
    scanf("%d%d", &n, &c);
    for(int i = 0;i < n;++i)scanf("%d", &a[i]);
    for(int i = 1;i < n;++i){
        b[i] = a[i-1] - a[i] - c;
    }
    std::sort(b,b+n);
    printf("%d", b[n-1]);
}


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

const int N = 200;
int a[N]; char str[N];

int kiri, kanan, selisih;
int ab, kk;

int row[2][13];

void cek_kiri_kanan(){
	for(int i=0; i<27; i++){
		if(a[str[i]] != 0){
			kiri = a[str[i]];
			kanan = i;
			break;
		}

		a[str[i]] = i;
	}
}

void tentuin_posisi(){
	selisih = kanan - kiri - 1;

	int atas = selisih/2;

	ab = 0;
	kk = 12 - atas;
}

void isimid(){
	int idx = kiri;

	while(idx < kanan){

		if(ab == 0 && kk < 13){
			row[ab][kk] = str[idx];
			idx++;
			kk++;
		}
		else if(ab == 0 && kk == 13){
			ab = 1;
			kk = 12;
		}
		else if(ab == 1 && kk >= 0){
			row[ab][kk] = str[idx];
			kk--;
			idx++;
		}
	}
}

void isikiri(){
	int idx = kiri - 1;

	while(idx >= 0){

		if(ab == 1 && kk >= 0){
			row[ab][kk] = str[idx];
			idx--;
			kk--;
		}
		else if(ab == 1 && kk == -1){
			ab = 0;
			kk = 0;
		}
		else if(ab == 0 && kk < 13){
			row[ab][kk] = str[idx];
			idx--;
			kk++;
		}
	}
}

void isikanan(){
	int idx = 26;

	while(idx > kanan){
		if(ab == 1 && kk >= 0){
			row[ab][kk] = str[idx];
			idx--;
			kk--;
		}
		else if(ab == 1 && kk == -1){
			ab = 0;
			kk = 0;
		}
		else if(ab == 0 && kk < 13){
			row[ab][kk] = str[idx];
			idx--;
			kk++;
		}
	}
}

int main(){
	scanf("%s", str);

	cek_kiri_kanan();
	tentuin_posisi();

	// printf("%d %d\n", kiri, kanan);

	if(selisih == 0){
		puts("Impossible");
		return 0;
	}

	isimid();
	isikiri();
	isikanan();

	for(int i=0; i<13; i++) printf("%c", row[0][i]);
	puts("");
	for(int i=0; i<13; i++) printf("%c", row[1][i]);
	puts("");
}


#include <iostream>
#include <string>

using namespace std;

const int SIZE = 27;
string str;
char in[2][13] = {0, };
char visit[256] = { false, };

pair<int, int> where(char c, int row, int col) {
    int rs = max(0, row-1);
    int re = min(1, row+1);
    int cs = max(0, col-1);
    int ce = min(12, col+1);

    for (int rr = rs; rr <= re; rr++) {
        for (int cc = cs; cc <= ce; cc++) {
            if (rr == row && cc == col) continue;
            if (in[rr][cc] == c) return make_pair(rr, cc);
        }
    }
    return make_pair(-1, -1);
}

bool go(int index, char current, int row, int col) {
    if (index == SIZE) return true;
    char &now = str[index];

    if (!visit[now]) { // not exist
        int rs = max(0, row-1);
        int re = min(1, row+1);
        int cs = max(0, col-1);
        int ce = min(12, col+1);

        for (int rr = rs; rr <= re; rr++) {
            for (int cc = cs; cc <= ce; cc++) {
                if (rr == row && cc == col) continue;
                if (in[rr][cc] != 0) continue;

                visit[now] = true;
                in[rr][cc] = now;
                if (go(index+1, now, rr, cc)) return true;
                visit[now] = false;
                in[rr][cc] = 0;
            }
        }
        return false;
    }
    else { // exist
        pair<int, int> p = where(now, row, col);
        if (p.first == -1) return false;
        return go(index+1, now, p.first, p.second);
    }
}

bool go() {
    visit[str[0]] = true;
    for (int i = 0; i <= 6; i++) {
        in[0][i] = str[0];
        if (go(1, str[0], 0, i)) return true;
        in[0][i] = 0;
    }
    return false;
}

int main() {
    cin >> str;
    if (go()) {
        for (int i = 0; i < 13; i++) cout << in[0][i]; cout << endl;
        for (int i = 0; i < 13; i++) cout << in[1][i]; cout << endl;
    }
    else cout << "Impossible\n";
    return 0;
}


		#include <bits/stdc++.h>
       	#define s(a) cin >> a;
		#define s2(a,b) cin >> a>> b;
		#define s3(a,b,c) cin >> a>> b>> c;
		#define s4(a,b,c,d) cin >> a>> b>> c<<d;
        #define sp(b) cout << b << "\n";
		#define sp2(b,c) cout << b << " "<<c <<endl;
		#define sp3(a,b,c) cout <<a <<" "<< b << " "<<c <<endl;
        #define p(a) ////printf("%d\n",a);
        #define p2(a,b) ////printf("%d %d",a,b);
        #define pm(a) ////printf("a\n");
        #define test(t) while(t>0)
        #define sl(a) a.length()
        #define f(a,b,c) for(a=b;a<c;a++)
        #define v(a,b) vector<a> b;
        #define pb(a,b) a.push_back(b);
        #define ll long long
		#define mem(a,b) memset(a,b,sizeof(a));

        #define diff(a,b) abs(a-b);
        using namespace std;
        #define MOD 1000000007
int mod(int a,int b) {
	return (a%b<0 ? a%b+b:a%b);
}
int getans(string s){
	if(s[0]=='f'){
		return 1;
	}
	if(s[0]=='e'){
		return 3;
	}
}

using namespace std;
int main(){

int i,j,k;
	string s;
	cin >> s;
	int a[26];
	mem(a,-1);
	bool flag=false;
		string below="";
		string up="";

	int pos1,pos2;
	char arr[2][13];
	f(i,0,s.length()){
		if(a[s[i]-'A']==-1){
			a[s[i]-'A']=i;
		}
		else if(i-a[s[i]-'A']>1){
			flag=true;
			pos1=a[s[i]-'A'];
			pos2=i;
		}
	}
	if(flag){
		int temp=pos2-pos1;
		temp= temp+1;
		temp /=2;
		// printf("temp=%d\n",temp );
		temp +=pos1;
		f(i,pos1,temp){
			below +=s[i];
		}
		f(i,temp,pos2){
			up=s[i]+up;
		}
		// printf(" here \n");
		// cout << up <<endl;
		// cout << below << endl;
		for(i=pos2+1;;i =(i+1)%(s.length())){
			up =s[i] +up;
			if(up.length()==13){
				i =(i+1)%(s.length());
				break;
			}

		}
		// cout << s[i] << endl;
		string cd="";
		// printf("hey\n");
		for(;;){
			if(i==pos1){
				break;
			}
			// cout << s[i] << endl;
			cd +=s[i];

			i =i%(s.length()-1)+1;
		}
		below =cd +below;
		// printf("later\n");
		cout << up <<endl;

		/*for(;i<26;i++){
			cd +=s[i];
		}*/
		cout << below << endl;

	}
	else{
		printf("Impossible\n");
	}

	}


/**
    2021-12-14
    22:35:04
*/
//#pragma comment(linker, "/STACK:102400000,102400000")
//#pragma GCC optimize ("O2")
#include <bits/stdc++.h>
#define pb push_back
#define all(a) a.begin(),a.end()
#define alll(a,x) a.begin(),a.end(),x
#define rep(i,a,b) for(int i=(a);i<=(b);i++)
#define nrep(i,a,b) for(int i=(a);i>=(b);i--)
#define pll __builtin_popcount
using namespace std;
using ll = long long int ;
using ull = uint64_t ;
ll mi(ll a,ll b,ll p){ ll r=1;while(b){if(1&b)r=r*a%p;a=a*a%p;b>>=1;}return r; }
void print(ll n){ if(n<0){putchar('-');n=-n;}if(n>9)print(n/10);putchar(n%10+'0'); }
ll read(){
    char ch=getchar();
    ll f=1,x=0;
    while(!isdigit(ch)){ if(ch=='-')f=-1;ch=getchar(); }
    while(isdigit(ch)){ x=(x<<3)+(x<<1)+(ch^48);ch=getchar(); }
    return x*f;
}
void init(){  };
ll a,b;
string fan(ll n){
    string s;
    while(n){
        s+=(char)(n%2+'0');
        n>>=1;
    }
    reverse(all(s));
    return s;
}
ll fan(string s){
    int cnt=0;
    ll ans=0;
    for(int i=s.size()-1;i>=0;i--)
    {
        ans+=1LL*(s[i]-'0')<<cnt;
        cnt++;
    }
    return ans;
}
unordered_map<ll,bool>vis;
void solve()
{
    cin>>a>>b;
    priority_queue<ll,vector<ll>,less<ll>>q;
    q.push(a);
    while(!q.empty()){
        ll u=q.top();q.pop();
        if(vis.count(u)||__builtin_popcountll(u)>__builtin_popcountll(b))continue;
        vis[u]=true;
        if(u==b){
            cout<<"YES";
            exit(0) ;
        }
        string now=fan(u);
        string uu=now+"1",vv=now+"0";
        reverse(all(uu));
        reverse(all(vv));
        ll x=fan(uu),y=fan(vv);
        q.push(x);
        q.push(y);
    }
    cout<<"NO";
}
///10 1000
signed main()
{
    //cout<<fan(34)<<" "<<fan(69)<<endl;
    init();
    ios_base::sync_with_stdio(false);cin.tie(0),cout.tie(0);
    int t=1;
    //cin>>t;
    while(t--){
        solve();
    }
    return 0;
}


/**
    2021-12-14
    22:35:04
*/
#pragma comment(linker, "/STACK:102400000,102400000")
#pragma GCC optimize ("O2")
#include <bits/stdc++.h>
#define pb push_back
#define all(a) a.begin(),a.end()
#define alll(a,x) a.begin(),a.end(),x
#define rep(i,a,b) for(int i=(a);i<=(b);i++)
#define nrep(i,a,b) for(int i=(a);i>=(b);i--)
#define pll __builtin_popcount
using namespace std;
using ll = long long int ;
using ull = uint64_t ;
ll mi(ll a,ll b,ll p){ ll r=1;while(b){if(1&b)r=r*a%p;a=a*a%p;b>>=1;}return r; }
void print(ll n){ if(n<0){putchar('-');n=-n;}if(n>9)print(n/10);putchar(n%10+'0'); }
ll read(){
    char ch=getchar();
    ll f=1,x=0;
    while(!isdigit(ch)){ if(ch=='-')f=-1;ch=getchar(); }
    while(isdigit(ch)){ x=(x<<3)+(x<<1)+(ch^48);ch=getchar(); }
    return x*f;
}
void init(){  };
ll a,b;
string fan(ll n){
    string s;
    while(n){
        s+=(char)(n%2+'0');
        n>>=1;
    }
    reverse(all(s));
    return s;
}
ll fan(string s){
    int cnt=0;
    ll ans=0;
    for(int i=s.size()-1;i>=0;i--)
    {
        ans+=1LL*(s[i]-'0')<<cnt;
        cnt++;
    }
    return ans;
}
unordered_set<ll>vis;
void solve()
{
    cin>>a>>b;
    queue<ll>q;
    q.push(a);
    int cnt=0;
    while(!q.empty()){
        cnt++;
        if(cnt==200)break;
        ll u=q.front();q.pop();
        if(__builtin_popcountll(u)>__builtin_popcountll(b))continue;
        if(u==b){
            cout<<"YES";
            exit(0) ;
        }
        string now=fan(u);
        string uu=now+"1",vv=now+"0";
        reverse(all(uu));
        reverse(all(vv));
        ll x=fan(uu),y=fan(vv);
        if(!vis.count(x))
        {
            q.push(x);
            vis.insert(x);
        }
        if(!vis.count(y))
        {
            q.push(y);
            vis.insert(y);
        }
    }
    cout<<"NO";
}
///10 1000
signed main()
{
    //cout<<fan(34)<<" "<<fan(69)<<endl;
    init();
    ios_base::sync_with_stdio(false);cin.tie(0),cout.tie(0);
    int t=1;
    //cin>>t;
    while(t--){
        solve();
    }
    return 0;
}


/**
    2021-12-14
    22:35:04
*/
//#pragma comment(linker, "/STACK:102400000,102400000")
//#pragma GCC optimize ("O2")
#include <bits/stdc++.h>
#define pb push_back
#define all(a) a.begin(),a.end()
#define alll(a,x) a.begin(),a.end(),x
#define rep(i,a,b) for(int i=(a);i<=(b);i++)
#define nrep(i,a,b) for(int i=(a);i>=(b);i--)
#define pll __builtin_popcount
using namespace std;
using ll = long long int ;
using ull = uint64_t ;
ll mi(ll a,ll b,ll p){ ll r=1;while(b){if(1&b)r=r*a%p;a=a*a%p;b>>=1;}return r; }
void print(ll n){ if(n<0){putchar('-');n=-n;}if(n>9)print(n/10);putchar(n%10+'0'); }
ll read(){
    char ch=getchar();
    ll f=1,x=0;
    while(!isdigit(ch)){ if(ch=='-')f=-1;ch=getchar(); }
    while(isdigit(ch)){ x=(x<<3)+(x<<1)+(ch^48);ch=getchar(); }
    return x*f;
}
void init(){  };
ll a,b;
string fan(ll n){
    string s;
    while(n){
        s+=(char)(n%2+'0');
        n>>=1;
    }
    reverse(all(s));
    return s;
}
ll fan(string s){
    int cnt=0;
    ll ans=0;
    for(int i=s.size()-1;i>=0;i--)
    {
        ans+=1LL*(s[i]-'0')<<cnt;
        cnt++;
    }
    return ans;
}
unordered_map<ll,bool>vis;
void dfs(ll n){
    if(vis[n])return ;
    vis[n]=true;
    if(__builtin_popcountll(n)>__builtin_popcountll(b)){
        return ;
    }
    if(n==b){
        cout<<"YES";
        exit(0);
    }
    string a=fan(n);
    string u=a+"0",v=a+"1";
    reverse(all(u));
    reverse(all(v));
    ll uu=fan(u),vv=fan(v);
    dfs(uu);
    dfs(vv);
}
void solve()
{
    cin>>a>>b;
    dfs(a);
    cout<<"NO";
}
///10 1000
signed main()
{
    //cout<<fan(34)<<" "<<fan(69)<<endl;
    init();
    ios_base::sync_with_stdio(false);cin.tie(0),cout.tie(0);
    int t=1;
    //cin>>t;
    while(t--){
        solve();
    }
    return 0;
}


#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
#define int long long
#define watch(x) cerr << (#x) << " is " << (x) << endl;
#define endl '\n'
#define all(x) (x).begin(), (x).end()
#define sz(a) (int)(a).size()
#define vi vector<int>
#define pii pair<int, int>
#define fi first
#define se second
#define cerr if(false) cerr

int x,y;
string getStr(int num) {
    string s;
    bool f=false;
    for(int i = 62; i >= 0; i--) {
        if(num & (1LL << i)) f=true;
        if(f) {
            bool b = (1LL<<i) & num;

            s += (b)+'0';
        }
    }
    return s;
}
signed main() {
    ios::sync_with_stdio(0);
    cin.tie(0);

    cin >> x >> y;

    watch(x)
    watch(y)
    string s = getStr(x);
    string t = getStr(y);

    set<string> S;
    queue<string> Q;

    Q.push(s);
    S.emplace(s);

    cerr << "h" << endl;
    while(!Q.empty()) {
        string cur = Q.front(); Q.pop();
        if(sz(cur) > 10*sz(t)) continue;
        watch(cur);
        for(int j = 0; j <= 1; j++) {
            string nxt = cur;
            nxt += (j+'0');

            while(nxt.back() == '0') nxt.pop_back();
            reverse(all(nxt));

            if(!S.count(nxt)) {
                cerr << cur << " -> " << nxt << endl;
                S.emplace(nxt);
                Q.push(nxt);
            }
        }
    }

    if(S.count(t))  cout << "YES" << endl;
    else cout << "NO" << endl;
}

/*

reduce operations:

we always remove leading 0
adding 0 and reversing is just reversing

or we can add 1 and reverse

so we're always reversing and we have option to add 1

take s
is it a substring of t and is everything else 1

*/


#pragma optimize("", off)
#pragma GCC optimize("Ofast,no-stack-protector,unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma comment(linker, "/STACK:36777216")
#include <bits/stdc++.h>

#define _ ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define ll long long
#define int ll
#define all(v) v.begin(),v.end()
#define pb push_back
#define sz(i) (int)(i.size())
#define setto(n) cout << fixed << setprecision(n)
#define fi first
#define se second
#define ld long double
#define pii pair<int, int>
#ifdef ONLINE_JUDGE
#define endl '\n'
#endif
const int inf = 0x3f3f3f3f3f3f3f3LL;
const int mod = 1e9 + 7;
using namespace std;

#ifndef ONLINE_JUDGE
#define tr(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
	cerr << name << " : " << arg1 << std::endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
	const char* comma = strchr(names + 1, ',');cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
#else
#define tr(...)
#endif
template<class T> void smin(T& a, T val) {if (a > val) a = val;}
template<class T> void smax(T& a, T val) {if (a < val) a = val;}
template<typename T>inline std::ostream &operator << (std::ostream & os,const std::vector<T>& v){bool first = true;os << "[";for(auto i: v){if(!first)os << ", ";os << i;first = false;}return os << "]";}

//Check N size twiceeeeeeeeeeeeeeeeee, and verify it
const int N = 2*1e5 + 10;

int x, y, m;
int32_t main(){_

	cin>>x>>y>>m;

	queue<pair<pii, int> > q;
	q.push({{x, y}, 0});

	int op = 0;
	while(!q.empty()){
		auto it = q.front();
		int sum = it.fi.fi + it.fi.se;
		q.pop();
		// tr(it.fi, it.se, op);
		int tt = max(it.fi.fi, it.fi.se);
		if(tt >= m){
			cout<<it.se;
			return 0;
		}
		if(it.se >= 1e5){
			cout<<-1;
			return 0;
		}
		q.push({{sum, y}, it.se+1});
		q.push({{y, sum}, it.se+1});
	}

	return 0;
}


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

using namespace std;

int main()
{   long long ans; ans=0;
    long long x,y,m;
    cin>>x>>y>>m;
    while (((x<m) && (y<m)) && (ans<10000000000))
    {
                    ans=ans+1;
          if (x<y) x+=y; else y+=x;

    }
     if (ans==10000000000) cout<<-1<<endl; else
     cout<<ans<<endl;
     getch();
}


#include <Windows.h>

#include <string>
#include <sstream>
#include <cstring>
#include <sstream>
#include <vector>
#include <algorithm>
#include <iostream>
#include <stdio.h>
#include <fstream>
#include <ctime>
#include <cmath>
#include <math.h>
#include <set>
#include <map>
#include <list>
#include <iomanip>
#include <cstdio>
#include <algorithm>
#include <unordered_map>
#include <queue>
using namespace std;

#define pp system("pause");
#define ct double ttme = clock()
#define p_ct cout << (clock() - ttme) / CLOCKS_PER_SEC << endl
#define all(c) (c).begin(),(c).end()
#define fft ifstream fin("input.txt"); ofstream fout("output.txt")
#define fft_c FILE *fin, *fout
#define fft_c_open fin = fopen("input.txt","r"); fout = fopen("output.txt","w")
#define fft_c_cl fclose(fin); fclose(fout)
#define pii pair<int,int>
#define mp(a,b) make_pair((a),(b))
#define pff pair<float,float>
#define piii pair<int,pair<int,int>>
#define pss pair<string, string>
#define M_PI 3.14159265358979323846
#define mem0(m) memset((m), 0, sizeof(m));
#define memb(m) memset((m), false, sizeof(m));
#define memi(m) memset((m), 0, sizeof(m));
#define rep(i,n) for(i = 0; i < (int)(n); i++)
#define repi(a, n) for(int i = a; i < (int)(n); i++)
#define repp(i, a, n) for(int (i) = a; (i) < (int)(n); (i)++)
typedef unsigned long long int ull;
typedef signed long long int ll;
const int INF = 1e8;
const int DEL = 687134561;
const long long MODULO = 1e9 + 7;
const int MAX = 1e7;
const int des = 10000;

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

    Sleep(10000);

    ll ans = 0, eba = 0;

    if(x <= 0 && y <= 0 && m > x && m > y) {
        cout << -1;
        return 0;
    } else if(x >= m || y >= m) {
        cout << 0;
        return 0;
    }

    while(x < m && y < m) {
        eba++;
        if(x > y) {
            ll xx = (x == 0) ? 1 : x;
            ll plus = max(0LL - ((ll)(y / xx)), 1LL);
            ans += plus;
            y += plus * x;
        } else {
            ll yy = (y == 0) ? 1 : y;
            ll plus = max(0LL - ((ll)(x / yy)), 1LL);
            ans += plus;
            x += plus * y;
        }

        if(eba > 10000000) {
            cout << -1;
            return 0;
        }
    }

    cout << ans;
}


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

using namespace std;

int main()
{   long long ans; ans=0;
    long long x,y,m;
    cin>>x>>y>>m;
    while (((x<m) && (y<m)) && (ans<1000000))
    {
                    ans=ans+1;
          if (x<y) x+=y; else y+=x;

    }
     if (ans=1000000) cout<<-1<<endl; else
     cout<<ans<<endl;
     getch();
}


#include <bits/stdc++.h>
#define _ ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define int long long
#define pb push_back
#define sz(i) (int)(i.size())
#define F first
#define S second
#define L long double
#define P pair<int, int>
const int inf = 0x3f3f3f3f3f3f3f3LL;
const int mod = (int)1e9 + 7;
using namespace std;
#if LOCAL
#include "../../tr.h"
#else
#define tr(...)
#define endl '\n'
#endif
template<class T> void smin(T& a, T val) {if (a > val) a = val;}template<class T> void smax(T& a, T val) {if (a < val) a = val;}
const int N = 5*(int)1e5 + 10;

int k;
string s;

int32_t main(){_

   cin >> k >> s;
   int n = sz(s);

   string ans = "";

   vector<string> vec;

   for (int i = 0; i < n; )
   {
      int j = i;
      string ans = "";
      while(j < n and s[i] == s[j]){
         ans += s[j];
      }
      i = j;
      --k;
      if(k == 0){
         for (int x = j; x < n; ++x)
            ans += s[x];
      }
      vec.push_back(ans);
      if(k == 0)
         break;
   }

   if(sz(vec) == k){
      cout<<"YES"<<endl;
      for(auto it: vec)
         cout<<it<<endl;
   }
   else{
      assert(sz(vec) < k);
      cout<<"NO";
   }

   return 0;
}


#include <iostream>
#include <stdio.h>
#include <string.h>
#include <algorithm>
#include <queue>
#include <stack>
#include <math.h>
using namespace std;
int fu[200]={0};
int xu[110];
int main()
{
    char q[110];

    int lenq,n,k,i,j;
    scanf("%d",&n);
    getchar();
    scanf("%s",q);
    lenq=strlen(q);
    k=0;
    if(lenq>=n)
    {
		j=1;k=1;
		fu[q[0]]++;
		xu[0]=0;
		for(i=0;i<lenq&&j<n;i++)
			if(fu[q[i]]==0)
			{
				fu[q[i]]++;
				xu[j]=i;
				j++;
			}
		if(j<n-1)
			k=0;
		else
		{
			xu[n]=lenq;
			printf("YES\n");
			for(j=0;j<n;j++)
			{
				for(i=xu[j];i<xu[j+1];i++)
					printf("%c",q[i]);
				printf("\n");
			}
		}
    }
    if(k==0)
        printf("NO\n");
    return 0;
}


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

using namespace std;
vector <string> ans;
int main()
{
    int k;
    string q;
    cin >> k;
    cin >> q;
    if (q.size() < k + 1)
    {
        cout << "NO";
    }
    else
    {
        int i = 0;
        string a="";
        while (ans.size() != k && i < q.size())
        {
            bool f = true;
            for (int j = 0; j < ans.size(); j++)
            {
                if (ans[j][0] == q[i])
                {
                    f = 0;
                }
            }
            if (f)
            {
                a += q[i];
                ans.push_back(a);
                a = "";
            }
            else
            {
                ans[ans.size() - 1] += q[i];
            }

            i++;
        }

        if (ans.size() == k )
        {
            a = "";
            for (; i < q.size(); i++)
            {
                a += q[i];
            }
            ans[k - 1] += a;
            cout << "YES" << endl;
            for (int j = 0; j < ans.size(); j++)
            {
                cout << ans[j] << endl;
            }
        }
        else
        {
            cout << "NO";
        }
    }
    return 0;
}


#include <iostream>
#include <conio.h>
#include <algorithm>
using namespace std ;

int main()
{
    int a1 , a2 , a3 , a4 , a5 , a6 ;
    cin >> a1 >> a2 >> a3 >> a4 >> a5 >> a6 ;

    int res = 0 ;

    for ( int i = 0 ; i < a2 ; i++ )
        res += 2 * ( a1 + i ) + 1 ;

    for ( int i = 0 ; i < a3 ; i++ )
        res += 2 * ( a4 + i ) + 1 ;

    cout << res ;

    getch() ;
    return 0 ;
}


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

#define ios ios_base::sync_with_stdio(false)

int main() {
//    freopen("input.txt", "r", stdin);
    ios;
    double a1, a2, a3, a4, a5, a6;
    while (cin >> a1 >> a2 >> a3 >> a4 >> a5 >> a6) {
        double ans = (a3 / 2 + a5 / 2 + a4) * (a2 * sqrt(3) / 2 + a3 * sqrt(3) / 2);
        ans -= sqrt(3) / 8 * (a2 * a2 + a3 * a3 + a5 * a5 + a6 * a6);
        cout << ans * 4 / sqrt(3) << endl;
    }
    return 0;
}


#include<iostream>
#include<algorithm>
#include<queue>
#include<vector>
#include<cstring>
#include<cmath>
using namespace std;
typedef long long ll;

int main(){
    ios::sync_with_stdio(0);
    int a[6];
    double b[3];
    for(int i=0;i<6;i++)cin>>a[i];
    int ans=0;
    for(int i=0;i<6;i+=2)ans+=a[i]*a[i+1];
    //cout<<ans<<endl;
    for(int i=0;i<6;i+=2)b[i/2]=sqrt(a[i]*a[i]+a[i+1]*a[i+1]+a[i]*a[i+1]);
    double s=(b[0]+b[1]+b[2])/2;
    cout<<(ans+(sqrt(s*(s-b[0])*(s-b[1])*(s-b[2])))/(sqrt(3))*4);

}


#include <iostream>
#include <cmath>

using namespace std;
int a1, a2, a3, a4, a5, a6;
double b1, b2, b3;
int main() {

	cin >> a1 >> a2 >> a3 >> a4 >> a5 >> a6;
	double ans = 0;
	ans += a1*a2;
	ans += a3*a4;
	ans += a5*a6;

	b1 = sqrt(a1*a1 + a2 * a2 +(double(a1*a2)));
	b2 = sqrt(a3*a3 + a4 * a4 + (double(a3*a4)));
	b3 = sqrt(a5*a5 + a6 * a6 + (double(a5*a6)));
	double p = (b1 + b2 + b3) / 2;
	double s = sqrt(p*(p - b1)*(p - b2)*(p - b3));
	ans += (s*4)/ sqrt(3);
	cout << ans;

	return 0;
}


#include <bits/stdc++.h>
#define MAX 100000
using namespace std;
typedef unsigned long long ull;
typedef vector<int> vi;

vector<int> primes;
int prime[MAX];
void seive(){
    for(int p=2;p*p<=MAX;p++){
        if(prime[p]){
            primes.push_back(p);
            for(int j = p*p;j<=MAX;j+=p){
                prime[j] = false;
            }
        }
    }
    return ;
}

int main() {
    for(int i=0;i<MAX;i++) prime[i] = true;
    // prime[0] = false; prime[1] = false;
    // int primeless[MAX];
    seive();
    int x,y,k;
    cin>>x>>y>>k;
    int numl = lower_bound(primes.begin(),primes.end(),x)-primes.begin();
    int numr = lower_bound(primes.begin(),primes.end(),y)-primes.begin();
    int answer = primes[numl]-x+1;
    int j;
    for(j = numl; primes[j+k] <= y;j++){
        int n = j+k;
        answer = max(answer,primes[n]-primes[j]);
    }
    answer = max(answer,y-primes[j]+1);
    if(numr-numl < k) answer = -1;
	cout<<answer<<endl;
	return 0;
}


#include <stdio.h>
#include <string.h>
#include <math.h>
#include <algorithm>
using namespace std;
typedef long long ll;
int a[11111111];
int p[1000009];
void build(int n0,int n,int i){
    if(n0==n){
        a[i]=p[n];
        return;
        }
    int m=(n0+n)>>1;
    build(n0,m,2*i);
    build(m+1,n,2*i+1);
    a[i]=a[2*i]+a[2*i+1];
    }
int query(int n0,int n,int i,int aa,int b){//printf("%d %d %d %d %d\n",n0,n,i,aa,b);
    if(n0>=aa&&n<=b)
        return a[i];
    int m=(n0+n)>>1;
    if(b<=m)
        return query(n0,m,2*i,aa,b);
    if(aa>m)
        return query(m+1,n,2*i+1,aa,b);
    return query(n0,m,2*i,aa,m)+query(m+1,n,2*i+1,m+1,b);
    }
int ff(int n0,int n,int k,int a,int b){//printf("%d %d\n",n0,n);
    int i,j,t;
    int m;
    if((n/n0)>=10)
        m=(int)sqrt((double)(n0*n));
    else
        m=(n0+n)>>1;
    t=1;
        for(j=b-m+1;j>=a;j--){
            if(b-m+1-j>100)
                break;
            if(query(a,b,1,j,j+m-1)<k){
                t=0;
                break;
                }
            }
    if(n0==n)
        if(t)
            return m;
        else
            return -1;
    if(t)
        return ff(n0,m,k,a,b);
    else
        return ff(m+1,n,k,a,b);
    }
int main(){
    int i,j,a,b,k,x,t;
    for(i=2;i<=1000000;i++)
        p[i]=1;
    for(i=2;i<=1000000;i++)
        if(p[i])
            for(j=i+i;j<=1000000;j+=i)
                p[j]=0;
    while(~scanf("%d%d%d",&a,&b,&k)){
        build(a,b,1);
        int n0=1,n=b-a+1;
        t=ff(n0,n,k,a,b);
        printf("%d\n",t);
        }
    return 0;
    }


#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
ll a,b,k,ans=-1,isSNT[100000005],l,r,mid;
void sang(){
	for(ll i=0;i<100000005;i++){
		isSNT[i]=1;
	}
	isSNT[0]=0;
	isSNT[1]=0;
	for(ll i=2;i<100000005;i++){
		if(isSNT[i]==1){
			for(ll j=i*i;j<100000005;j+=i){
				isSNT[j]=0;
			}
		}

	}
	for(ll i=1;i<100000005;i++){
		isSNT[i]+=isSNT[i-1];
	}
}
int check(ll mid){
	ll v=r;
	for(ll i=a;i<=b-mid+1;i++){
		v=min(v,isSNT[i+mid-1]-isSNT[i-1]);
	}
	if(v<k)return 0;
	else return 1;
}
int main(){
	cin>>a>>b>>k;
	sang();
	l=1;
	r=b-a+1;
	while(l<=r){
		 mid=(l+r)/2;
		if(check(mid)){
			ans=mid;
			r=mid-1;
		}
		else l=mid+1;
	}
	cout<<ans;
}


#include<cstdio>
#include<set>
#include<algorithm>
#include <stdio.h>
#include <iostream>
#include <string.h>
#include <stack>
#include <vector>
#include <queue>
#include <map>
#include <cmath>
#define M 1000005
#define Mod 1000000007
#define For(i,a,b) for(int i=(a);i<(b);i++)
#define inf (1<<30)-1
#define eps 1e-8
using namespace std;
int p[80005];
int tag[M];
int cnt;
int a, b, k;

void get_prime() {
    cnt = 0;
    for (int i = 2; i < M; i++) {
        if (!tag[i]) p[cnt++] = i;
        for (int j = 0; j < cnt && p[j] * i < M; j++) {
            tag[i * p[j]] = 1;
            if (i % p[j] == 0)
                break;
        }
    }
}

//bool judge(int x) {
//    For(i,)
//}

int main(int argc, char** argv) {
    get_prime();
    cin >> a >> b >> k;
    int u, v;

    For(i, 0, cnt) {
        if (p[i] >= a) {
            u = i;
            break;
        }
    }

    For(i, 0, cnt) {
        if (p[i] > b) {
            v = i;
            break;
        }
    }
    int num = v - u;
    if (num < k) {
        printf("-1\n");
        return 0;
    }
    if (k == 0) {
        printf("0\n");
        return 0;
    }
    int ans = -1;
    //    if(b==p[u+k-1])
    if (p[u] != a)
        ans = max(ans, (min(b, p[u + k - 1]) - a + 1));
    else
        ans = max(ans, (min(b, p[u + k - 1]) - a));
    //    else{
    //
    //    }
    if (p[v - 1] == b) {
        ans = max(ans, b - max(a, p[max(0, v - 1 - k)]));
    } else
        ans = max(ans, 1 + b - max(a, p[max(0, v - 1 - k)]));
    for (int i = u; i + k < v; i++) {
        ans = max(ans, p[i + k] - p[i]);
    }
    printf("%d\n", ans);
    return 0;
}


#include<iostream>
#include<string>
using namespace std;
int main()
{
    string s1;
    string s2;
    cin>>s1;
    cin>>s2;
    for(int i=0;i<s1.size();i++)
    {
    if(s1[i]<91)
    {
        s1+=32;
    }
    for(int i=0;i<s2.size();i++)
    if(s2[i]<91)
    {
        s2+=32;
    }
    }
        if(s1==s2)
        {
            cout<<"0";
        }
        else if(s1>s2)
        cout<<"1";
        else
        cout<<"-1";
}


#include<iostream>
#include<string>
using namespace std;
int main()
{
    string s1;
    string s2;
    cin>>s1>>s2;
    for(int i=0;i<s1.size();i++)
    {
    if(s1[i]<91)
    {
        s1+=32;
    }
    for(int i=0;i<s2.size();i++)
    if(s2[i]<91)
    {
        s2+=32;
    }
    }
        if(s1==s2)
        {
            cout<<"0";
        }
        else if(s1>s2)
        cout<<"1";
        else
        cout<<"-1";
}


#include <bits/stdc++.h>

using namespace std;

int main()
{
	string a, b;
	cin >> a;
	cin >> b;
	for (unsigned int i = 0; i<=a.size(); i++)
	{
	    if(a[i]<'a')
        {
            a+=32;
        }
        if(b[i]<'a')
        {
            b+=32;
        }
	}
	if(a<b)
    {
        cout<<"-1";
    }
    else if(b<a)
    {
        cout<<"1";
    }
    else
    {
        cout<<"0";
    }
    return 0;
}


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

int main()
{
	string a, b;
	cin >> a;
	cin >> b;
	for (int i = 0; i<=a.size(); i++)
	{
	    if(a[i]<'a')
        {
            a+=32;
        }
        if(b[i]<'a')
        {
            b+=32;
        }
	}
	if(a<b)
    {
        cout<<"-1";
    }
    else if(b<a)
    {
        cout<<"1";
    }
    else
    {
        cout<<"0";
    }
    return 0;
}


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

typedef long long int           ll;
typedef unsigned long long int  ull;

ull check_bit(ull N,int POS){return (N & (1ULL<<POS));}

vector<ull>v;
ull gaussian_elimination()
{
    int long long n=v.size();
    int long long ind=0;  // Array index
    for(int long long bit=log2(v[0]);bit>=0;bit--)
    {
        int long long x=ind;
        while(x<n&&check_bit(v[x],bit)==0)
          x++;
        if(x==n)
          continue; // skip if there is no number below ind where current bit is 1
        swap(v[ind],v[x]);
        for(int long long j=0;j<n;j++)
        {
            if(j!=ind&&check_bit(v[j],bit))
                v[j]^=v[ind];
        }
        ind++;
    }
    ull ans=v[0];
    for(int long long i=1;i<n;i++)
      ans=max(ans,ans^v[i]);
    return ans;
}
int main()
{
    int long long i,j,k,l,m,n,t,kase=1;
    cin>>n>>k;
    ull x;
    for(i=0;i<n;i++)
    {
        v.push_back(i+1);
    }
    sort(v.rbegin(),v.rend());
    cout<<gaussian_elimination()<<"\n";
return 0;
}


#include<bits/stdc++.h>
using namespace std;
typedef long long int Int;
int main(){
Int n,k;
cin>>n>>k;
if(k==1){
    cout<<n<<endl;
    return 0;
}
unordered_map<Int,bool> m;
Int ans=n;
Int mans=n;
Int selected=1;
Int bit=0;
Int temp=ans;
m[n]=1;
while(temp>0){
    temp=temp>>1;
    bit++;
}
bit=bit-2;
Int last=n-1;
while(selected<k){
temp=ans;
while(bit>=0&&((temp>>bit)&1)==1){
    bit--;
    temp=ans;
}
if(bit>=0){
    bool done=false;
    while(!done){
    if(bit>=0){
    while(last>0&&(m[last]==1||((last>>bit)&1==0))){
        last--;
    }
    if(last>0){
    ans=ans^last;
    if(ans>mans){
    mans=max(ans,mans);
    last--;
    done=true;
    selected++;
    m[last]=1;
    last=n-1;
    bit--;
    }else{
    ans=mans;
    last--;
    }
    }else{
    last=n-1;
    bit--;
    }
    }else{
    cout<<mans<<endl;
    return 0;
    }
    }
}else{
cout<<mans<<endl;
return 0;
}
}
cout<<mans<<endl;
return 0;
}


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

typedef long long int           ll;
typedef unsigned long long int  ull;

ull check_bit(ull N,int POS){return (N & (1ULL<<POS));}

vector<ull>v;
ull gaussian_elimination()
{
    int n=v.size();
    int ind=0;  // Array index
    for(int bit=log2(v[0]);bit>=0;bit--)
    {
        int x=ind;
        while(x<n&&check_bit(v[x],bit)==0)
          x++;
        if(x==n)
          continue; // skip if there is no number below ind where current bit is 1
        swap(v[ind],v[x]);
        for(int j=0;j<n;j++)
        {
            if(j!=ind&&check_bit(v[j],bit))
                v[j]^=v[ind];
        }
        ind++;
    }
    ull ans=v[0];
    for(int i=1;i<n;i++)
      ans=max(ans,ans^v[i]);
    return ans;
}
int main()
{
    int long long i,j,k,l,m,n,t,kase=1;
    cin>>n>>k;
    ull x;
    for(i=0;i<n;i++)
    {
        v.push_back(i+1);
    }
    sort(v.rbegin(),v.rend());
    cout<<gaussian_elimination()<<"\n";
return 0;
}


#include<bits/stdc++.h>
#define pb push_back
#define ll long long
#define mp make_pair
#define pu push
#define po pop
#define N 100005
#define FAST ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0);srand(time(NULL));
using namespace std;
unsigned ll n,k,x,i;
vector<ll> v;
int main(void){
	cin>>n>>k;
	x=log2(n);

	for(i=x;i>=0;i--){

		if(!(n&((ll)1<<i)))v.pb(i);

	}

	k--;
	i=0;
	while(k-- && n<(((ll)1<<(x+1))-1)){

		n+=((ll)1<<v[i]);
		i++;

	}
	cout<<n;
	return 0;
}