#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int n;
void solve(int k){
	int i,j;
	ll rv=1;
	for(i=1;i<=k;++i,rv*=10);
	int R=n%rv;
	int L=n-R;
	for(i=0;i<k;++i)L/=10;
	ll ans=0;
	ans+=1LL*(L)*(L)*rv/2;
    if(ans)ans--;
	ans+=1LL*(L)*(R+1);
	ans+=1LL*(max(R-rv/2+1,0LL);
	printf("%I64d",ans);
}

int main(){
	//freopen("aa.in","r",stdin);
	int i,j;
	scanf("%d",&n);
	int ans;
	if(n==2)ans=1;
	if(n==3)ans=3;
	if(n==4)ans=6;
	if(n<5)return printf("%d",ans),0;
	ll a=5;
	int end=0;
	for(;a<=n;a=a*10)++end;
	solve(end);
	return 0;
}


#include<bits/stdc++.h>using namespace std;using LL=int64_t;const int INF=0x3f3f3f3f;LL len(LL num) {    LL ans=0;    while(num>0) {        ans++;        num/=10;    }    return ans;}int main(){    ios::sync_with_stdio(0);    cin.tie(0);    LL n,ans=0;    cin>>n;    int lens=len(n);    if(n<=49){        if(n<=9) ans=n/2;        else if(n==10) ans=1;        else {            int num[20]={0};            for(int i=1;i<=n;i++) {                num[i%10]++;            }            for(int i=1;i<=4;i++) ans+=num[i]*num[9-i];            ans+=num[9]*num[0];        }    }    else {        LL num1=0;        for(int i=1;i<=lens;i++) {            num1=num1*10+9;        }        if(num1-n<n) ans=(n-num1+n+1)/2;        else {            num1/=10;            ans=(n-num1+n+1)/2;        }    }    cout<<ans<<endl;    return 0;}


// in the name of god ;

#include <bits/stdc++.h>

using namespace std ;

typedef long long ll ;

#define X first
#define Y second

inline long long len(long long x)
{
  long long ret = 0;
  while(x){
    x /= 10;
    ret ++;
  }
  return ret;
}

int main() {
  ios_base::sync_with_stdio ( false ) ;
  long long n;
  long long ans = 0;
  cin >> n;
  ll cnt = 10;
  for(long long i = 1 ; i < 10 ; ++ i){
    if(cnt == n * 2){
      cout << 1 << endl;
      exit(0);
    }
    cnt *= 10;
  }
  long long x = 2 * n - 1;
  long long y = len(x) - 1;
  for(long long i = 0 ; i < 9 ; ++ i){
    long long u = (i+1) * pow(10,y) - 1;
    long long minn = (u+1) / 2;
    long long maxx = min(u , n);
    long long r = max(n - e + 1 , 0);
    ans += max(min(n+1,u) - (u+1) / 2,0);
    //cout << n << ' ' << u << ' ' << t << ' ' << e << ' ' << r << endl;
  }
  cout << ans << endl;
  return 0 ;
}


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

int n;
int order;
long ans;

int v(int n) {
	int value = 1;
	for (int i = 1; i <= n; i++)value *= 10;
	return value;
}

int main() {
	cin >> n;
	if (2 <= n; n <= 4) {
		if (n == 2)cout << 1 << endl;
		else if (n == 3)cout << 3 << endl;
		else if (n == 4)cout << 6 << endl;
		return 0;
	}
	int ordertest = n;
	ordertest /= 5;
	while (ordertest >= 1) {
		order++;
		ordertest /= 10;
	}
	for (int i = 1; i <= 10; i++) {
		if (n > i*v(order) - 1)ans += (i*v(order) - 1) / 2;
		else if (n <= (i*v(order) - 1) / 2);
		else {
			ans += n - (i*v(order) - 1) / 2;
		}
	}
	cout << ans << endl;
	return 0;
}


#include <iostream>
using namespace std;
int main(){
    int n;
    char tmp1;
    char tmp2;
    int count_SF = 0;
    int count_FS = 0;
    cin >> tmp1;
    tmp2 = tmp1;
    for (int i = 0; i < n; i++)
    {
        cin >> tmp1;
        tmp2 = tmp1;
         if (tmp1 == 'S'&& tmp2 == 'F')
        {
            count_SF = count_SF + 1;
        } else if (tmp1 == 'F' && tmp2 = 'S')
        {
            count_FS += 1;
        }

    }

    if (count_SF > count_FS)
    {
        cout << "YES";
    } else
    {
        cout << "NO";
    }

    return 0;
}


#include <iostream>
using namespace std;
int main() {

	int n;
	cin >> n;
	string s;
	std::cin >> s;

	int i = 0;
	for (int p = 1; p < s.length(); p++) {
		if (s[p - 1] == 'S' && s[p] == 'F') { ++i; }
		else if (s[p - 1] == 'F' && s[p] == 'S') { --i; }
	}

	if (i > 0) {
		cout << "YES";
	}
	else { cout << "NO"; };

	return 0;
}


#include <bits/stdc++.h>
using namespace std;
int main(){
string s;
int c,f;
int ans=0,sum=0;
cin>>c>>f;
for (int i=0;i<s.size()-1;i++)
{
	if(s[i] == 'S'&& s[i+1] == 'F')
	ans++;
}
 if(s[i] == 'F'&& s[i+1] == 'S')
	sum++;
else if(ans>sum)
	cout<<"YES";
else
cout<<"NO";
}


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

int main() {
	string s;
int n;
	cin >> n >>  s;
	int t1 = 0, t2 = 0;
	for (int i = 0; i < n - 1; i++) {
		if (s[i] == 'S' && s[i + 1] == 'F') t1++;
		else if (s[i] == 'F' && s[i + 1] == 'S') t2++;
	}
	if (t1 > t2) cout << "YES";
	else cout << "NO";
	return 0;
}
	return 0;
}


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

int main()
{
  string s1 , s2 , s3;
   cin >> s1 >> s2 >> s3;

   int i=0;
   while(i==0){
   if(s3.find(s1[i]) !=string::npos){

   s3.erase(s3.find(s1[i],1);
   s1.erase(i,1);

       }else i++;
   }
      int j=0;
   while(j==0){
   if(s3.find(s2[j]) !=string::npos){

   s3.erase(s3.find(s2[j],1);
   s2.erase(j,1);

       }else j++;
   }
   if (s1.empty() && s2.empty() && s3.empty() )
   cout<<"YES";
   else
   cout<<"NO";

}


#include <iostream>
#include <string>
#include <algortihm>

using namespace std;

int main(){
    string s1, s2, s3;
    cin>>s1>>s2>>s3;
    string s4=s1+s2;
    sort(s3.begin(), s3.end());
    sort(s4.begin(), s4.end());
    if(s3==s4){
    	cout<<"YES";
	}
	else cout<<"NO";
}


#include <iostream>
#include <string>
using namespace std;
int main()//
{
    ios::sunc_with_stdio(false);
    string s,ss,sss;
    cin>>s>>ss>>sss;
    if(s.size()+ss.size()!=sss.size())
    {
        cout<<"NO";
    }
    else
    {
        int i,j;
        for (i = 0; s[i]; i++)
        {
            for (j = 0; sss[j]; j++)
            {
                if(s[i]==sss[j])
                {
                    s[i]=sss[j]=1;
                    break;
                }

            }

        }
        for (i = 0; ss[i]; i++)
        {
            for (j = 0; sss[j]; j++)
            {
                if(ss[i]==sss[j])
                {
                    s[i]=sss[j]=1;
                    break;
                }

            }

        }

        for (i = 0; sss[i]; i++)
        {
            if(sss[i]-1)
                break;
        }
        if(i==sss.size())
            cout<<"YES";
        else
            cout<<"NO";
    }
}


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

int main()
{
int a=0,b=0,c=0,n=1,t=1;

string x,y,z;
cin>>x>>y>>z;

for (int i=0;i<z.size()i++){

    if (x[a]==z[i]){

        a++;n++;
        }

}

for (int i=0;i<z.size()i++){

    if (y[b]==z[i]){

        b++;t++;
        }

}

if (t+n==z.size()){cout<<"YES";}
else cout<<"NO";

}


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

int main()
{
    int a[4][4],count=0;
    for(int i=0;i<4;i++)
    for(int j=0;j<4;j++)
    cin>>a[i][j];
    for(i=0;i<4 && count=0;i++)
    {
        if(a[i][3]==1)
        {
            for(int k=0;k<3;k++)
            {if(a[i][k]==1)
            count++;}
            if(a[(i+1)%4][0]==1 && count==0)
            count++;
            else
            if(a[(i-1)%4][0]==1 && count==0)
            count++;

        }
    }
    if(count==0)
    cout<<"NO";
    else
    cout<<"YES";
    return 0;
}


#include <bits/stdc++.h>

using namespace std;
int n,m,k;
int minn=INT_MAX;
int maxx=0;
void nhap()
{
    scanf("%d%d%d",&n,&m,&k);
    for(int i=1;i<=n;i++)
    {
        int x;
        scanf("%d",&x);
        minn=min(minn,x);
    }
    for(int i=1;i<=m;i++)
    {
        int x;
        scanf("%d",&x);
        maxx=max(maxx,max);
    }
    if(maxx-minn<0)
        cout<<k;
    else
        cout<<maxx-minn+k;
}
int main()
{
    nhap();
    return 0;
}


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

рассвет.

*******************************************************************************/
#include <bits/stdc++.h>
typedef long long int lli;
typedef unsigned long long int ulli;
typedef long double ld;
#define rapgame ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define pb push_back
#define eb emplace_back
#define vi vector <int>
#define vlli vector <lli>
#define vulli vector <ulli>
#define vchar vector <char>
#define vstr vector <string>
#define vb vector <bool>
#define fst first
#define sec second
#define srt(a) sort(a.begin(),a.end())
#define rev(a) reverse(a.begin(),a.end())
#define vpii vector <pair <int,int> >
#define pii pair <int,int>
#define vplli vector <pair <lli,lli> >
#define vvi vector <vector <int> >
#define vvlli vector <vector <lli> >
#define vvpii vector <vector <pair <int,int>> >
#define fr(i,n) for (int i = 0; i < (n); ++i)
#define frbig(i,n) for (lli i = 0; i < (n); ++i)
#define fra(i,a,n) for (lli i = a; i < (n); ++i)
#define run(c,s) for(auto c:s)
#define read(n) int n; cin >> n;
#define readchar(n) char n; cin >> n;
#define readstr(n) string n; cin >> n;
#define readarr(a,n) fr(i,n) cin >> a[i];
#define read2(x,y) int x,y; cin >> x >> y;
#define read2ll(x,y) long long int x,y; cin >> x >> y;
#define readll(n) lli n; cin >> n;
#define watch(x) cout << (#x) << " is " << (x) << endl
#define print_array(x) fr(i,x.size()) cout << x[i] << " ";
using namespace std;

const lli MOD=1e9+7;
const lli MAXN=1e6+1;
const ld PI=acos(-1);

int main(){
    rapgame
    int t=1;
    //cin>>t;
    while(t--){
        read2(n,m);read(r);
        vi a(n),b(m);
        int counter=0;
        fr(i,n){
            cin >> a[i];
        }
        fr(i,m) cin >> b[i];
        srt(a);
        srt(b);
        fr(i,n){
            if(a[i]<r) break;
            else{
                counter+=r/a[i];
                r%=a[i];
            }
        }
        cout << r+counter*b[m-1] << '\n'
    }
    return 0;
}


<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <ItemGroup Label="ProjectConfigurations">
    <ProjectConfiguration Include="Debug|Win32">
      <Configuration>Debug</Configuration>
      <Platform>Win32</Platform>
    </ProjectConfiguration>
    <ProjectConfiguration Include="Release|Win32">
      <Configuration>Release</Configuration>
      <Platform>Win32</Platform>
    </ProjectConfiguration>
    <ProjectConfiguration Include="Debug|x64">
      <Configuration>Debug</Configuration>
      <Platform>x64</Platform>
    </ProjectConfiguration>
    <ProjectConfiguration Include="Release|x64">
      <Configuration>Release</Configuration>
      <Platform>x64</Platform>
    </ProjectConfiguration>
  </ItemGroup>
  <PropertyGroup Label="Globals">
    <VCProjectVersion>15.0</VCProjectVersion>
    <ProjectGuid>{EEBDFC67-0DE9-43EF-A2A3-4BA47538A6C3}</ProjectGuid>
    <Keyword>Win32Proj</Keyword>
    <RootNamespace>ConsoleApplication39</RootNamespace>
    <WindowsTargetPlatformVersion>10.0.17134.0</WindowsTargetPlatformVersion>
  </PropertyGroup>
  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
    <ConfigurationType>Application</ConfigurationType>
    <UseDebugLibraries>true</UseDebugLibraries>
    <PlatformToolset>v141</PlatformToolset>
    <CharacterSet>Unicode</CharacterSet>
  </PropertyGroup>
  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
    <ConfigurationType>Application</ConfigurationType>
    <UseDebugLibraries>false</UseDebugLibraries>
    <PlatformToolset>v141</PlatformToolset>
    <WholeProgramOptimization>true</WholeProgramOptimization>
    <CharacterSet>Unicode</CharacterSet>
  </PropertyGroup>
  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
    <ConfigurationType>Application</ConfigurationType>
    <UseDebugLibraries>true</UseDebugLibraries>
    <PlatformToolset>v141</PlatformToolset>
    <CharacterSet>Unicode</CharacterSet>
  </PropertyGroup>
  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
    <ConfigurationType>Application</ConfigurationType>
    <UseDebugLibraries>false</UseDebugLibraries>
    <PlatformToolset>v141</PlatformToolset>
    <WholeProgramOptimization>true</WholeProgramOptimization>
    <CharacterSet>Unicode</CharacterSet>
  </PropertyGroup>
  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
  <ImportGroup Label="ExtensionSettings">
  </ImportGroup>
  <ImportGroup Label="Shared">
  </ImportGroup>
  <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
  </ImportGroup>
  <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
  </ImportGroup>
  <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
  </ImportGroup>
  <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
  </ImportGroup>
  <PropertyGroup Label="UserMacros" />
  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
    <LinkIncremental>true</LinkIncremental>
  </PropertyGroup>
  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
    <LinkIncremental>true</LinkIncremental>
  </PropertyGroup>
  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
    <LinkIncremental>false</LinkIncremental>
  </PropertyGroup>
  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
    <LinkIncremental>false</LinkIncremental>
  </PropertyGroup>
  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
    <ClCompile>
      <PrecompiledHeader>Use</PrecompiledHeader>
      <WarningLevel>Level3</WarningLevel>
      <Optimization>Disabled</Optimization>
      <SDLCheck>true</SDLCheck>
      <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
      <ConformanceMode>true</ConformanceMode>
    </ClCompile>
    <Link>
      <SubSystem>Console</SubSystem>
      <GenerateDebugInformation>true</GenerateDebugInformation>
    </Link>
  </ItemDefinitionGroup>
  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
    <ClCompile>
      <PrecompiledHeader>Use</PrecompiledHeader>
      <WarningLevel>Level3</WarningLevel>
      <Optimization>Disabled</Optimization>
      <SDLCheck>true</SDLCheck>
      <PreprocessorDefinitions>_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
      <ConformanceMode>true</ConformanceMode>
    </ClCompile>
    <Link>
      <SubSystem>Console</SubSystem>
      <GenerateDebugInformation>true</GenerateDebugInformation>
    </Link>
  </ItemDefinitionGroup>
  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
    <ClCompile>
      <PrecompiledHeader>Use</PrecompiledHeader>
      <WarningLevel>Level3</WarningLevel>
      <Optimization>MaxSpeed</Optimization>
      <FunctionLevelLinking>true</FunctionLevelLinking>
      <IntrinsicFunctions>true</IntrinsicFunctions>
      <SDLCheck>true</SDLCheck>
      <PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
      <ConformanceMode>true</ConformanceMode>
    </ClCompile>
    <Link>
      <SubSystem>Console</SubSystem>
      <EnableCOMDATFolding>true</EnableCOMDATFolding>
      <OptimizeReferences>true</OptimizeReferences>
      <GenerateDebugInformation>true</GenerateDebugInformation>
    </Link>
  </ItemDefinitionGroup>
  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
    <ClCompile>
      <PrecompiledHeader>Use</PrecompiledHeader>
      <WarningLevel>Level3</WarningLevel>
      <Optimization>MaxSpeed</Optimization>
      <FunctionLevelLinking>true</FunctionLevelLinking>
      <IntrinsicFunctions>true</IntrinsicFunctions>
      <SDLCheck>true</SDLCheck>
      <PreprocessorDefinitions>NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
      <ConformanceMode>true</ConformanceMode>
    </ClCompile>
    <Link>
      <SubSystem>Console</SubSystem>
      <EnableCOMDATFolding>true</EnableCOMDATFolding>
      <OptimizeReferences>true</OptimizeReferences>
      <GenerateDebugInformation>true</GenerateDebugInformation>
    </Link>
  </ItemDefinitionGroup>
  <ItemGroup>
    <ClInclude Include="stdafx.h" />
    <ClInclude Include="targetver.h" />
  </ItemGroup>
  <ItemGroup>
    <ClCompile Include="ConsoleApplication39.cpp" />
    <ClCompile Include="stdafx.cpp">
      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader>
      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Create</PrecompiledHeader>
      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Create</PrecompiledHeader>
      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Create</PrecompiledHeader>
    </ClCompile>
  </ItemGroup>
  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
  <ImportGroup Label="ExtensionTargets">
  </ImportGroup>
</Project>


#include<bits/stdc++.h>
#include<limits.h>
#define lli long long
#define ull unsigned long long
#define f(a,k,m) for(int a=k ; a<m ; a++)
#define fl(a,k,m) for(long a=k ; a<m ; a++)
#define fll(a,k,m) for(lli a=k ; a<m ; a++)
#define rf(a,k,m) for(int a=k ; a>=m ; a--)
#define rfl(a,k,m) for(long a=k ; a>=m ; a--)
#define rfll(a,k,m) for(lli a=k ; a>=m ; a--)
#define pb push_back
#define mp make_pair
#define pq priority_queue
#define M 1000000007
#define Mcf 998244353
using namespace std ;
int main(){
    long n, m,r ;
    cin >> n >> m >> r ;
    long b[n] ;
    fl(i,0,n) cin >> b[i] ;
    long s[m] ;
    fl(i,0,m) cin >> s[i] ;
    long* x,*y;
    x = min_element(b,b+n) ;
    y = max_element(s,s+m) ;

    if((*x)>=(*y)){
        cout << r ;
    }

    if(r/(*x) > 0 && (*y) > (*x)) {
        cout << r - x*(r/(*x)) +  y*(r/(*x)) ;

    }

	return 0 ;
}


#include<bits/stdc++.h>
using namespace std;
int main()
{
    long long n,c=0;

    scanf("%I64d",&n);
    char s[n];
   scanf("%s",s);
    for(int i=0; i<n; j++)
     {
         if(s[i]=='B')
         c=c+pow(2,i);
     }
     printf("%I64d",c);
     return 0;
}


#include<iostream>
#include<cstdio>
#include<cstring>
#include<cmath>
#include<algorithm>
using namespace std;
bool r[100];
long long num[100];
int main()
{
    int n;
    char x;
    long long ans=0;
    scanf("%d",&n);
    for(int i=1;i<=n;i++)
    {
        x=getchar();
        while(x<30)
        x=getchar();
        b[i]=(x=='R'?1:0);
    }
    num[1]=1;
    for(int i=2;i<=n;i++)
    num[i]=2*num[i-1]+1;
    for(int i=1;i<=n;i++)
    if(r[i])
    ans+=num[i]-num[i-1];
    printf("%lld\n",ans);
    return 0;
}


#include <stdio.h>
int64_t u(int64_t a,   int64_t b);
int main()
{

	int n;
	scanf("%d\n", &n);
	char s[1000];
	int64_t t = 0;
	for (  int64_t i = 0; i < n; i++)
	{
		scanf("%c", &s[i]);
		 if (s[i] == 'B')
		{
			t += u(2, i);
		}
	}
	printf("\n%I64d", t);
}

int64_t u(  int64_t a,   int64_t b)
{
	if (b == 0)
		return 1;
	if (b == 1)
		return a;
	if (b == 2)
		return a * a;
	return u(u(a, b / 2), 2) * (b % 2 ? a : 1);
}


#include <iostream>
#include <vector>

using namespace std;

int main()
{
	int n,red=0;
	string s;
	int cnt = 0;

	cin >> n;
	cin >> s;

	reverse(s.begin(),s.end());

	while(1) {
//		cout << "ok1\n";
		while(s.length()>0 && s[s.length()-1]=='R')
		{
			s = s.substr(0,s.length()-1);
		}
		if(s.length()==0) break;
		s[s.length()-1]='R';
		while(s.length()<n) {
			s = s+'B';
		}
//		cout << "ok2\n";
        ++ cnt;
	}

	cout << cnt;

	return 0;
}


#include <bits/stdc++.h>

using namespace std;
const int MAXN = 100010;

int n, a[MAXN];

int main() {
    int t = 2e9, a = 10;
    for( int i = 0; i < t; ++i ) a *= 10;
	scanf( "%d", &n );
	for( int i = 0; i < n; ++i ) scanf( "%d", a+i );
	sort( a, a+n );
	for( int i = 0; i < n; ++i ) printf( "%d ", a[i] );
	return 0;
}


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

void sort (vector <long long> &x, long long size)
{
    for (int i = 0; i < size; i++)
    {
        for (int j = i + 1; j < size; j++)
        {
            if (x[i] > x[j])
            {
                swap(x[i],x[j]);
            }
        }
    }
}
int main()
{
    long long n, x;
    cin >> n;
    vector <long long> a;
    for (int i = 0; i < n; i++)
    {
        cin >> x;
        a.push_back(x);
    }
    sort(a, n);
    sort(a.begin(), a.end());
    sort(a.begin(), a.end());
    sort(a.begin(), a.end());
    multiset <long long> s;
    for (int i = 0; i < n; i++)
    {
        s.insert(a[i]);
    }
    for (auto it : s)
    {
        cout << it << " ";
    }
}


#include<iostream>
#include<algorithm>

int a[1000000];
int main()
{
    long long n;
    while(n--)
    cin>>a[n];
    sort(a,a+n);
}


#include <bits/stdc++.h>
#define RET(_x) return std::cout << (_x) << '\n', 0;
#define endl    "\n"
using namespace std;
using ll = int64_t;

int arr[15];
int tmp[1000][1000];

int main() {
    auto start = chrono::high_resolution_clock::now();
    std::ios_base::sync_with_stdio(false);
    std::cin.tie(nullptr);

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

    tmp[0][0][0] = 1;
    for (int i = 0; i < 100; ++i) {
        for (int j = 0; j < 1000; ++j) {
            for (int k = 0; k < 1000; ++k) {
                if (k && j < 999) {
                    tmp[j][k] = tmp[j + 1][k - 1] + arr[i % n] + (k & 1) + (i % 3);
                }
            }
        }
    }
    arr[n] = tmp[5][743][101];

    for (int i = 0; i < n; ++i) {
        cout << arr[i] << ' ';
    }

    cerr << "\nTotal execution time : " << chrono::duration_cast<chrono::milliseconds>(chrono::high_resolution_clock::now() - start).count() << " ms\n";

    return 0;
}


/*
	 Arafat  Mukhametkazin
      All rights reserved
        ALMATY 2016
*/
#include <bits/stdc++.h>

#define f first
#define s second
#define mp make_pair
#define pb push_back
#define ll long long
#define sz(x) x.size()
#define all(x) x.begin(), x.end()
#define pii pair < int , int >

using namespace std;

const int N = 1e3 + 123;
const int mod = 1e9 + 7;
const int INF = 1e9 + 1;
const ll INFL = 1e18 + 1;
const double eps = 1e-9;
const double pi = acos(-1.0);

int main () {

int n, cnt;
char x;

int main() {
	cin >> n;
	bool ok = 1;
    for (int i = 1;i <= n;i ++) {
        cin >> x;
        if (ok == 1)
            cnt ++;
        if (x == '0')
            ok = 0;
    }
    cout << cnt;
return 0;
}


#include <iostream>

using namespace std;
int main(){
    int n,maxx=0;;
    string s;
    cin>>n>>s;
    for(int i=0;i<n;i++){
        int ans=0,ti=i;
        while(s[ti]=='1')
            ti++,ans++;
        maxx=max(maxx,ans);
    }
    if(n==2&&s=='01'){
        cout<<1;
        return 0;
    }
    if(maxx==n)
        cout<<n;
    else
        cout<<maxx+1;
}


#include<algorithm>
using namespace std;

int main()
{
   int n,r,change=0,x;
   cin>>n;
   char arr[n];
   for(int i=0;i<n;i++)
   {
       cin>>arr[i];
   }
   for(int i=0;i<n;i++)
   {  if(i==0&&arr[i]==0)
       change++;
       if(arr[i]=='1')
       {
              r=1;
              change++;
       }
       else if(arr[i]=='0')
       {
           if(r==1)
           {
               change++;
               r=0;
           }
       }
   }
   cout<<change;
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
const long long mo=1e9+9;
long long n, x, ans;
char m;

int main()
{
	ios_base::sync_with_stdio(false);

    cin >> n;
    for(x=0; x<n; ++x){
        cin >> m;
        if( m=='0' ) ++x, break;
    }

    cout << x << "\n";

	return 0;
}


#include<bits/stdc++.h>
#define re register
struct eg{int to,c,nx;}e[20010];
int la[10010],cur[10010],qq[10100],d[10100],ta,cnt=1;
int S,T,N;
inline void addE(re int a,re int b,re int c)
{
	e[++cnt]=(eg){b,c,la[a]};la[a]=cnt;
	e[++cnt]=(eg){a,0,la[b]};la[b]=cnt;
}
bool bfs()
{
	memset(d,0,sizeof(d));
	memcpy(cur,la,sizeof(la));
	qq[ta=1]=T;d[T]=1;
	for(re int i=1;i<=ta;i++)
	{
		re int x=qq[i];
		for(re int j=la[x];j;j=e[j].nx)if(e[j^1].c&&!d[e[j].to])
		{
			d[e[j].to]=d[x]+1;
			if(e[j].to==S)return 1;
			qq[++ta]=e[j].to;
		}
	}
	return 0;
}
int dfs(re int x,re int fl)
{
	if(x==T)return fl;
	re int ff=fl;
	for(re int&j=cur[x];j;j=e[j].nx)if(e[j].c&&d[e[j].to]==d[x]-1)
	{
		re int c=dfs(e[j].to,std::min(e[j].c,ff));
		if(c)
		{
			ff-=c;e[j].c-=c;e[j^1].c+=c;
			if(!ff)return fl;
		}else d[e[j].to]=0;
	}
	return fl-ff;
}
int nans;
int dinic()
{
	re int ans=0;
	for(;bfs();ans+=dfs(S,1<<30));
	return ans;
}
int n,m,k,q,nc[20][20010],f[2011],S1,ww[20],ws[2011],lg[2011];
void dfs(re int nn)
{
	if(nn>=k){f[S1]=nans;return;}
	dfs(nn+1);
	S1+=(1<<nn);
	for(re int i=2;i<=cnt;i++)nc[nn][i]=e[i].c;
	e[nn*2+2].c=25;
	re int nw=nans;
	nans+=dinic();
	dfs(nn+1);
	for(re int i=2;i<=cnt;i++)e[i].c=nc[nn][i];
	e[nn*2+2].c=0;
	nans=nw;
	S1-=(1<<nn);
}

namespace io
{
	char B[1<<15]={0},*S=B,*T=B;
	#define gc (S==T&&(T=(S=B)+fread(B,1,1<<15,stdin),S==T)?0:*S++)
	int F()
	{
		re char c=0;
		int f=0,a=0;
		for(;!isdigit(c=gc)&&c!='-';);
		for(c=='-'?f=1:a=c-48;isdigit(c=gc);)a=(a<<1)+(a<<3)+c-48;
		return f?-a:a;
	}
}
using namespace io;
int main()
{
	re int x,y,w;
	n=F();m=F();k=F();q=F();
	S=1;T=n;N=n;
	for(re int i=1;i<=m;i++)
	{
		x=F();y=F();w=F();
		addE(x,y,w);
	}
	nans=dinic();
	dfs(0);
	for(re int i=1;i<=k;i++)lg[1<<(i-1)]=i;
	re int ks=(1<<k)-1;
	for(;q--;)
	{
		for(re int i=1;i<=k;i++)ww[i]=F();
		for(re int i=1;i<(1<<k);i++)ws[i]=ws[i-(i&-i)]+ww[lg[i&-i]];
		re int ans=1<<30;
		for(re int i=0;i<(1<<k);i++)ans=std::min(ans,f[i]+ws[ks-i]);
		printf("%d\n",ans);
	}
}


#include<bits/stdc++.h>
#define re register
struct eg{int to,c,nx;}e[20010];
int la[10010],cur[10010],qq[10100],d[10100],ta,cnt=1;
int S,T,N;
inline void addE(re int a,re int b,re int c)
{
	e[++cnt]=(eg){b,c,la[a]};la[a]=cnt;
	e[++cnt]=(eg){a,0,la[b]};la[b]=cnt;
}
bool bfs()
{
	memset(d,0,sizeof(d));
	memcpy(cur,la,sizeof(la));
	qq[ta=1]=T;d[T]=1;
	for(re int i=1;i<=ta;i++)
	{
		re int x=qq[i];
		for(re int j=la[x];j;j=e[j].nx)if(e[j^1].c&&!d[e[j].to])
		{
			d[e[j].to]=d[x]+1;
			if(e[j].to==S)return 1;
			qq[++ta]=e[j].to;
		}
	}
	return 0;
}
int dfs(re int x,re int fl)
{
	if(x==T)return fl;
	for(re int&j=cur[x];j;j=e[j].nx)if(e[j].c&&d[e[j].to]==d[x]-1)
	{
		re int c=dfs(e[j].to,std::min(e[j].c,ff));
		if(c)
		{
			ff-=c;e[j].c-=c;e[j^1].c+=c;
			if(!ff)return fl;
		}
	}
	return fl-ff;
}
int nans;
int dinic()
{
	re int ans=0;
	for(;bfs();ans+=dfs(S,1<<30));
	return ans;
}
int n,m,k,q,nc[20][20010],f[2011],S1,ww[20],ws[2011],lg[2011];
void dfs(re int nn)
{
	if(nn>=k){f[S1]=nans;return;}
	dfs(nn+1);
	S1+=(1<<nn);
	for(re int i=2;i<=cnt;i++)nc[nn][i]=e[i].c;
	e[nn*2+2].c=25;
	re int nw=nans;
	nans+=dinic();
	dfs(nn+1);
	for(re int i=2;i<=cnt;i++)e[i].c=nc[nn][i];
	e[nn*2+2].c=0;
	nans=nw;
	S1-=(1<<nn);
}
int main()
{
	re int x,y,w;
	scanf("%d%d%d%d",&n,&m,&k,&q);
	S=1;T=n;N=n;
	for(re int i=1;i<=m;i++)
	{
		scanf("%d%d%d",&x,&y,&w);
		addE(x,y,w);
	}
	nans=dinic();
	dfs(0);
	for(re int i=1;i<=k;i++)lg[1<<(i-1)]=i;
	re int ks=(1<<k)-1;
	for(;q--;)
	{
		for(re int i=1;i<=k;i++)scanf("%d",&ww[i]);
		for(re int i=1;i<(1<<k);i++)ws[i]=ws[i-(i&-i)]+ww[lg[i&-i]];
		re int ans=1<<30;
		for(re int i=0;i<(1<<k);i++)ans=std::min(ans,f[i]+ws[ks-i]);
		printf("%d\n",ans);
	}
}


//test
//#pragma GCC optimize("Ofast")
//#pragma GCC target("avx")
//#undef LOCAL

#include <algorithm>

#include <array>

#include <bitset>

#include <cassert>

#include <complex>

#include <cstdio>

#include <cstring>

#include <iostream>

#include <map>

#include <numeric>

#include <queue>

#include <set>

#include <string>

#include <unordered_map>

#include <unordered_set>

#include <vector>

using namespace std;

using uint = unsigned int;
using ll = long long;
using ull = unsigned long long;
constexpr ll TEN(int n) { return (n == 0) ? 1 : 10 * TEN(n - 1); }
template <class T> using V = vector<T>;
template <class T> using VV = V<V<T>>;

#include <unistd.h>

struct Scanner {
    int fd = -1;
    char line[(1 << 15) + 1];
    size_t st = 0, ed = 0;
    void reread() {
        memmove(line, line + st, ed - st);
        ed -= st;
        st = 0;
        ed += ::read(fd, line + ed, (1 << 15) - ed);
        line[ed] = '\0';
    }
    bool succ() {
        while (true) {
            if (st == ed) {
                reread();
                if (st == ed) return false;
            }
            while (st != ed && isspace(line[st])) st++;
            if (st != ed) break;
        }
        if (ed - st <= 50) {
            bool sep = false;
            for (size_t i = st; i < ed; i++) {
                if (isspace(line[i])) {
                    sep = true;
                    break;
                }
            }
            if (!sep) reread();
        }
        return true;
    }
    template <class T, enable_if_t<is_same<T, string>::value, int> = 0>
    bool read_single(T& ref) {
        if (!succ()) return false;
        while (true) {
            size_t sz = 0;
            while (st + sz < ed && !isspace(line[st + sz])) sz++;
            ref.append(line + st, sz);
            st += sz;
            if (!sz || st != ed) break;
            reread();
        }
        return true;
    }
    template <class T, enable_if_t<is_integral<T>::value>* = nullptr>
    bool read_single(T& ref) {
        if (!succ()) return false;
        bool neg = false;
        if (line[st] == '-') {
            neg = true;
            st++;
        }
        ref = T(0);
        while (isdigit(line[st])) {
            ref = 10 * ref + (line[st++] & 0xf);
        }
        if (neg) ref = -ref;
        return true;
    }
    template <class T> bool read_single(V<T>& ref) {
        for (auto& d : ref) {
            if (!read_single(d)) return false;
        }
        return true;
    }
    void read() {}
    template <class H, class... T> void read(H& h, T&... t) {
        bool f = read_single(h);
        assert(f);
        read(t...);
    }
    int read_unsafe() { return 0; }
    template <class H, class... T> int read_unsafe(H& h, T&... t) {
        bool f = read_single(h);
        if (!f) return 0;
        return 1 + read_unsafe(t...);
    }
    Scanner(FILE* fp) : fd(fileno(fp)) {}
};

struct Printer {
  public:
    template <bool F = false> void write() {}
    template <bool F = false, class H, class... T>
    void write(const H& h, const T&... t) {
        if (F) write_single(' ');
        write_single(h);
        write<true>(t...);
    }
    template <class... T> void writeln(const T&... t) {
        write(t...);
        write_single('\n');
    }

    Printer(FILE* _fp) : fp(_fp) {}
    ~Printer() { flush(); }

  private:
    static constexpr size_t SIZE = 1 << 15;
    FILE* fp;
    char line[SIZE], small[50];
    size_t pos = 0;
    void flush() {
        fwrite(line, 1, pos, fp);
        pos = 0;
    }
    void write_single(const char& val) {
        if (pos == SIZE) flush();
        line[pos++] = val;
    }
    template <class T, enable_if_t<is_integral<T>::value>* = nullptr>
    void write_single(T val) {
        if (pos > (1 << 15) - 50) flush();
        if (val == 0) {
            write_single('0');
            return;
        }
        if (val < 0) {
            write_single('-');
            val = -val; // todo min
        }
        size_t len = 0;
        while (val) {
            small[len++] = char(0x30 | (val % 10));
            val /= 10;
        }
        for (size_t i = 0; i < len; i++) {
            line[pos + i] = small[len - 1 - i];
        }
        pos += len;
    }
    void write_single(__int128 val) {
        if (pos > (1 << 15) - 50) flush();
        if (val == 0) {
            write_single('0');
            return;
        }
        if (val < 0) {
            write_single('-');
            val = -val; // todo min
        }
        size_t len = 0;
        while (val) {
            small[len++] = char(0x30 | (val % 10));
            val /= 10;
        }
        for (size_t i = 0; i < len; i++) {
            line[pos + i] = small[len - 1 - i];
        }
        pos += len;
    }

    void write_single(const string& s) {
        for (char c : s) write_single(c);
    }
    void write_single(const char* s) {
        size_t len = strlen(s);
        for (size_t i = 0; i < len; i++) write_single(s[i]);
    }
    template <class T> void write_single(const V<T>& val) {
        auto n = val.size();
        for (size_t i = 0; i < n; i++) {
            if (i) write_single(' ');
            write_single(val[i]);
        }
    }
};

namespace internal {

template <class T> struct simple_queue {
    std::vector<T> payload;
    int pos = 0;
    void reserve(int n) { payload.reserve(n); }
    int size() const { return int(payload.size()) - pos; }
    bool empty() const { return pos == int(payload.size()); }
    void push(const T& t) { payload.push_back(t); }
    T& front() { return payload[pos]; }
    void clear() {
        payload.clear();
        pos = 0;
    }
    void pop() { pos++; }
};

} // namespace internal

template <class Cap> struct mf_graph {
  public:
    mf_graph() : _n(0) {}
    mf_graph(int n) : _n(n), g(n) {}

    int add_edge(int from, int to, Cap cap) {
        assert(0 <= from && from < _n);
        assert(0 <= to && to < _n);
        int m = int(pos.size());
        pos.push_back({from, int(g[from].size())});
        g[from].push_back(_edge{to, int(g[to].size()), cap});
        g[to].push_back(_edge{from, int(g[from].size()) - 1, 0});
        return m;
    }

    struct edge {
        int from, to;
        Cap cap, flow;
    };

    edge get_edge(int i) {
        int m = int(pos.size());
        assert(0 <= i && i < m);
        auto _e = g[pos[i].first][pos[i].second];
        auto _re = g[_e.to][_e.rev];
        return edge{pos[i].first, _e.to, _e.cap + _re.cap, _re.cap};
    }
    std::vector<edge> edges() {
        int m = int(pos.size());
        std::vector<edge> result;
        for (int i = 0; i < m; i++) {
            result.push_back(get_edge(i));
        }
        return result;
    }
    void change_edge(int i, Cap new_cap, Cap new_flow) {
        int m = int(pos.size());
        assert(0 <= i && i < m);
        assert(0 <= new_flow && new_flow <= new_cap);
        auto& _e = g[pos[i].first][pos[i].second];
        auto& _re = g[_e.to][_e.rev];
        _e.cap = new_cap - new_flow;
        _re.cap = new_flow;
    }

    Cap flow(int s, int t) {
        return flow(s, t, std::numeric_limits<Cap>::max());
    }
    Cap flow(int s, int t, Cap flow_limit) {
        assert(0 <= s && s < _n);
        assert(0 <= t && t < _n);

        std::vector<int> level, iter;

        auto bfs = [&]() {
            internal::simple_queue<int> que;
            level = std::vector<int>(_n, -1);
            level[s] = 0;
            que.push(s);
            while (!que.empty()) {
                int v = que.front();
                que.pop();
                for (auto e : g[v]) {
                    if (e.cap == 0 || level[e.to] >= 0) continue;
                    level[e.to] = level[v] + 1;
                    if (e.to == t) return;
                    que.push(e.to);
                }
            }
        };
        auto dfs = [&](auto self, int v, Cap up) {
            if (v == t) return up;
            Cap res = 0;
            for (int& i = iter[v]; i < int(g[v].size()); i++) {
                _edge& e = g[v][i];
                if (e.cap == 0 || level[v] >= level[e.to]) continue;
                Cap d = self(self, e.to, std::min(up, e.cap));
                e.cap -= d;
                g[e.to][e.rev].cap += d;
                res += d;
                up -= d;
                if (up == 0) break;
            }
            return res;
        };

        Cap flow = 0;
        while (flow < flow_limit) {
            bfs();
            if (level[t] == -1) break;
            iter = std::vector<int>(_n, 0);
            while (flow < flow_limit) {
                Cap f = dfs(dfs, s, flow_limit - flow);
                if (!f) break;
                flow += f;
            }
        }
        return flow;
    }

  private:
    int _n;
    struct _edge {
        int to, rev;
        Cap cap;
    };
    std::vector<std::pair<int, int>> pos;
    std::vector<std::vector<_edge>> g;
};

Scanner sc = Scanner(stdin);
Printer pr = Printer(stdout);
const int MAX_W = 25;

int main() {
    int n, m, k, q;
    sc.read(n, m, k, q);

    mf_graph<int> g(n + 2 * k);

    for (int i = 0; i < k; i++) {
        int a, b, c;
        sc.read(a, b, c); a--; b--;
        g.add_edge(a, n + 2 * i, MAX_W);
        g.add_edge(n + 2 * i + 1, b, MAX_W);
    }

    for (int i = k; i < m; i++) {
        int a, b, c;
        sc.read(a, b, c); a--; b--;
        g.add_edge(a, b, c);
    }

    int basic = g.flow(0, n - 1);
    V<int> mincut(1 << k, basic);
    V<int> edge_id(k, -1);
    int extra_flow = 0;
    for (int f = 1; f < (1 << k); f++) {
        // i-th edge must not be cut

/*        auto g2 = g;
        for (int i = 0; i < k; i++) {
            if (f & (1 << i)) {
                g2.add_edge(n + 2 * i, n + 2 * i + 1, MAX_W);
            }
        }
        mincut[((1 << k) - 1) ^ f] += g2.flow(0, n - 1);*/

        for (int i = 0; i < k; i++) {
            if (f & (1 << i)) {
                // add edge
                edge_id[i] = g.add_edge(n + 2 * i, n + 2 * i + 1, MAX_W);
                extra_flow += g.flow(0, n - 1);
                break;
            } else {
                // remove edge
                auto e = g.get_edge(edge_id[i]);
                // reverse e.flow
                g.change_edge(edge_id[i], 0, 0);
                extra_flow -= e.flow;

                int rem = e.flow;
                rem -= g.flow(n + 2 * i, n + 2 * i + 1, rem);
                int deb;
                deb = g.flow(n + 2 * i, 0, rem);
                assert(deb == rem);
                deb = g.flow(n - 1, n + 2 * i + 1, rem);
                assert(deb == rem);
            }
        }
        mincut[((1 << k) - 1) ^ f] = basic + extra_flow;
    }

    // TL OK
    for (int ph = 0; ph < q; ph++) {
        V<int> cost(k);
        for (int i = 0; i < k; i++) {
            sc.read(cost[i]);
        }
        int ans = mincut[0];
        int extra_cut = 0;
        for (int f = 1; f < (1 << k); f++) {
/*            int cut = mincut[f];
            for (int i = 0; i < k; i++) {
                if (f & (1 << i)) {
                    cut += cost[i];
                }
            }*/
            for (int i = 0; i < k; i++) {
                if (f & (1 << i)) {
                    extra_cut += cost[i];
                    break;
                } else {
                    extra_cut -= cost[i];
                }
            }
            ans = min(ans, mincut[f] + extra_cut);
        }
        pr.writeln(ans);
    }

    return 0;
}


#include<bits/stdc++.h>
using namespace std;
int main(){
    unsigned long long int LIMIT=998244353;
    unsigned long long int  c;
    cin>>c>>q;
    unsigned long long int x=1;
    while(c--){
        x=(2*x)%LIMIT;
    }
    while(q--){
        x=(2*x)%LIMIT;
    }
    cout<<x;
}


#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
using namespace std;
long long a, b, ret;
const int mod = 998244353;

int main(){
    cin >> a >> b;
    ret = (1 << a * b) % mod
    cout << ret << "\n";

	return 0;
}


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

typedef long long ll;

ll choose(ll n,ll k);
bool isprime(ll n);
ll power(ll x,ll y,ll p);

int main()
{
  int w,h; cin>>w>>h;
  cout<<pow(2,w+h)%998244353;
  return 0;
}

ll choose(ll n,ll k)
{
  if(k==0)
    return 1;
  return (n* choose(n-1,k-1))/k;
}

bool isprime(ll n)
{
  for(ll i=2;i*i<=n;i++)
  {
    if(n%i==0)
      return false;
  }
  return true;
}

ll power(ll x,ll y,ll p)
{
  ll res=1;
  x=x%p;
  while(y>0)
  {
    if(y&1)
      res=(res*x)%p;
    y=y>>1;
    x=(x*x)%p;
  }
  return res;
}


#include<bits/stdc++.h>
#define ll long long
#define ld long double
#define pb push_back
#define ff first
#define ss second
#define mp make_pair
#define ins insert
#define sb substr
#define con continue
#define ub upper_bound
#define lb lower_bound
#define pll pair<ll,ll>
#define pld pair<ld,ld>
using namespace std;
ll power(ll x, ll y);
bool isPrime(ll n);
vector<ll> X[200001], Y[200001];
ll A[200001], B[200001];
int main()
{
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  ll a,b,c,d,n,m,i,j,k,l,p,q,x,y,z,cnt=0, flag=0;
  string s1, s2, s3;
  vector<ll> V, W;
  vector<ll> :: iterator itrv;
  map<ll, ll> M;
  set<ll> S;
  set<ll> :: iterator itrs;
  cin>>n>>m;
  if(((n+m)%2)==0)cout<<pow(2, n+m)%998244353;
  else cout<<pow(2, n+m-1)%998244353;
  return 0;
}

ll power(ll x, ll y){
    ll res = 1;
    while (y > 0){
        if (y & 1) res = res*x;
        y = y>>1;
        x = x*x;
    }
    return res;
}
bool isPrime(ll n){
    if (n <= 1)  return false;
    if (n <= 3)  return true;
    if (n%2 == 0 || n%3 == 0) return false;
    ll p=sqrt(n);
    for(int i=5;i<=p;i=i+6)
        if (n%i == 0 || n%(i+2) == 0)
            return false;
    return true;
}


#include<bits/stdc++.h>
#define ll long long int
using namespace std;
int main()
{
    ll a,b,c;
    cin>>a>>b>>>c;
    cout<<(b*c+(b+c-1)*(a-1))<<endl;
    return 0;
}


/*
Author:Zhaofa Fang
Lang:C++
*/
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <cmath>
#include <cstring>
#include <algorithm>
#include <string>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <set>
using namespace std;

const int INF=2147483647;
const double eps=1e-8;
const double PI=acos(-1);

const int mod = 100000007;

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


#include<stdio.h>
#include<queue>
#include<cstring>
#include<iostream>
using namespace std;
int a,b,c;
int main()
{
    while(scanf("%d%d%d",&a,&b,&c)!=EOF)
    {
        printf("%d\n",b*c+c+b-1);2
    }
    return 0;
}

/*ptdsnbhpifsboldliksjdhgnsbbetqqgpmeanlpojfppikgrae*/


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

using namespace std;

#define ll  long long

int main(){
    int a, b, c, cnt=0, sum=0, ans=0;

    scanf("%d%d%d",&a,&b,&c);

    cout<< (a * b * c) - (a - 1) * (b - 1) * (c - 1);

    return 0;
}


#include <ioistream>
#include <cstdio>
#include <vector>
#include <cmath>

using namespace std;

int main(){
    unsigned long n,half;
    long count=0;
    double quarter;
    cin>>n;
    if(n%2 == 0)
        half = n/2;
    quarter = half/2;
    for(long i=1;i<(long)(ceil(quarter));i++){
        count++;
    }
    cout<<count;
    return 0;
}


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


#include <iostream>

using namespace std;

int main(){
    int n;
    cin>>n;
    int c = (n/2);
    int b = (int)ceil(c/2.0);
    cout<<(b-1)<<endl;
    return 0;
}


#include <bits/stdc++.h>

#pragma GCC optimize("O2")
using namespace std;
#define ll long long
#define rep(i,n,N) for(ll i=n;i<=N;i++)
#define rap(i,n,N) for(int i=(int)n;i>=(int)N;i--)
#define mp make_pair
#define pb push_back
#define pob pop_back
#define pf push_front
#define pof pop_front
#define fi first
#define se second
#define sf se.fi
#define ss se.se
#define pii pair<int,int>
#define pll pair<ll,ll>
#define piii pair<int,pii>
#define endl "\n"
const ll MAX=1e5+5;
const int MOD=1000000000 + 7;
const ll INF=1e18;
const int dr[]={0,1,0,-1,1,1,-1,-1,  2,2,-2,-2,1,1,-1,-1};
const int dc[]={1,0,-1,0,1,-1,1,-1,  1,-1,1,-1,2,-2,2,-2};

int n,m,tc,a,b,x[105][105],y[105],sz,cnt,tmp,res;
string s,t;
bool vis[105];

int main(){
    //cout<<fixed<<setprecision(9);
    //freopen("input.txt", "r", stdin);
//	freopen("output.txt","w",stdout);
    ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
    cin>>n;
    if(n&1 && n<6)return cout<0,0;
    cout<<(n-2)/4;
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
{
    ll a,b;
    for(ll i=1;;i++)
    {
        if(a<=0)
        {
            cout<<"Valera";
            return 0;
        }
        else if(b<=0)
        {
            cout<<"Vladik";
            return 0;
        }
        a=a-n*n;
        b=b-((n*n)+n);
    }
    return 0;
}


#include <iostream>

using namespace std;

int main(){

   int vla,val;

   cin>>vla>>val;

   for(int i=0;;i++){
         if (i&1 == 0){
             vla -= i;
                 if (vla < 0 ) cout<<"Valera\n",return 0;
           }

         else {
              val -= i;
                 if (val < 0 ) cout<<"Vladik\n",return 0;
           }
     }
}


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

using namespace std;

int main()
{
    double a,b,flag=0,n1,x1,x2,n2,a1,b1,c,fractpart1,fractpart2,intpart1,intpart2,sn,tn;

    if(a<1)
    {
        flag=1;
        cout<<"Vladik";
    }

    if(b<2)
    {
        flag=1;
        cout<<"Valera";
    }

    if(flag==0)
    {
        b1=1;
        a1=1;
        c=-b;

        n1=abs(sqrt(b));

        x1=((-b1)+sqrt(b1^2-(4*a1*c)))/(2*a1);
        x2=((-b1)-sqrt(b1^2-(4*a1*c)))/(2*a1);

        if(x1>=0)
            n2=x1;
        else
            n2=x2;

           fractpart1=modf(n1, &intpart1);
           fractpart2=modf(n2, &intpart2);

        if(fractpart1==0.000000 && fractpart2!=0.000000)
        {
            sn=(n1/2)*(4+((n1-1-1)*2));
            double y=a-sn;
            tn=1+((n2-1)*2);

            if(y-tn>0)
                cout<<"Vladik";
            else
                cout<<"Valera";

        }
        else if( fractpart2==0.000000 && fractpart1!=0.000000)
        {
            sn=(n2/2)*(2+((n2-1)*2));
            double y=b-sn;
            tn=2+((n2+1-1)*2);

            if(y-tn>0)
                cout<<"Valera";
            else
                cout<<"Vladik";
        }
        else
        {
            if(n1<n2)
            {
                sn=(n1/2)*(4+((n1-1-1)*2));
                double y=a-sn;
                tn=1+((n2-1)*2);

                if(y-tn>0)
                    cout<<"Vladik";
                else
                    cout<<"Valera";

            }
            else
            {
                sn=(n2/2)*(2+((n2-1)*2));
                double y=b-sn;
                tn=2+((n2+1-1)*2);

                if(y-tn>0)
                    cout<<"Valera";
                else
                    cout<<"Vladik";

            }
        }

    }

    return 0;
}


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

int main ()
{
	int a,b;
	cin>>a>>b;
	int i = 0;
	int cur = 1;
	while (a >= 0 && b >= 0)
	{
		if (i % 2 == 0) a -= cur;
		else b-=cur;
		if (b <= 0) {cout<<"Vladik";return 0;}
		if (a <= 0) cout<<"Valera";return 0;}
		i++;
		cur++;
	}
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
int main()
{
	string s;
	int n,a;
	cin>>s>>n;
	if(s=='January') a=1+n;
	if(s=='February') a=2+n;
	if(s=='March') a=3+n;
	if(s=='April') a=4+n;
	if(s=='May') a=5+n;
	if(s=='June') a=6+n;
	if(s=='July') a=7+n;
	if(s=='August') a=8+n;
	if(s=='September') a=9+n;
	if(s==' October') a=10+n;
	if(s=='November') a=11+n;
	if(s=='December') a=12+n;
	a=a%12;
	switch(a)
	{
		case 0:cout<<"December"<<endl;break;
		case 1:cout<<"January"<<endl;break;
		case 2:cout<<"February"<<endl;break;
		case 3:cout<<"March"<<endl;break;
		case 4:cout<<"April"<<endl;break;
		case 5:cout<<"May"<<endl;break;
		case 6:cout<<"June"<<endl;break;
		case 7:cout<<"July"<<endl;break;
		case 8:cout<<"August"<<endl;break;
		case 9:cout<<"September"<<endl;break;
		case 10:cout<<"October"<<endl;break;
		case 11:cout<<"November"<<endl;break;
	}
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
string a[13]={"","January","February","March","April","May","June","July","August","September","October","November","December"};
int main()
{
    string cur;
    int n,k;
    cin>>cur>>n;
    for(int i=1;i<=12;i++)
    {
        if(!strcmp(c,s[i]))
        {
            k+=i;
            break;
        }
    }
    cout<<a[k%12];
    return 0;
}


#include<iostream>
using namespace std;
main()
{
 char str[12][12]={"January","February","March","April","May","June","July","August","September","October","November","December"};
 char s[12];
 cin>>s;
 int i,n,p;
 cin>>n;
 n=n%12;
 for(i=0;i<12;i++)
 {
  if(strcmp(s,str[i])==0)
  {p=i+1;break;}
 }
 p+=n;
 if(p>12)
 p=p%12;
 cout<<str[p-1];
 return 0;
}


#include<bits/stdc++.h>
using namespace std;
string x,a[13]={" ","January","February","March","April","May","June","July","August","September","October","November","December"};
int k;
cin>>k;
int main(){
    cin>>x;
    for (int i=1;i<=12;i++)
        if (x==a[i]) k+=i;
    k%=12;
    cout<<a[k];
    return 0;
}


#include<iostream>
using namespace std;

int main()
{
	int n;
	cin>>n;
	int x=1;
	while(x<=n)
	{
		if(n==x||n==x+1)
		{
			cout<<1<<'\n';
			return 0;
		}
		if(x%2==0)
			x=x+1+x;
		else
			x=(x+1)+1+x;
	}
	cout<<0;
	return0;
}


//determined
#include <cmath>
#include <cstdio>
#include <cstring>
#include <complex>
#include <cassert>
#include <iostream>
#include <algorithm>
#define set0(x) memset(x,0,sizeof(x))
#define debug(x) //cerr<<#x<<'='<<x<<endl
using namespace std;
typedef unsigned long long ull;
template<typename T> void read(T &x){
	x = 0;char ch = getchar();int f = 1;
	while(!isdigit(ch)){if(ch == '-')f*=-1;ch=getchar();};
	while(isdigit(ch)){x = x*10+ch-48;ch=getchar();}
	x*=f;
}

int mod = 998244353;
inline int mul(int x,int y){return 1ll*x*y%mod;}
int add(int x,int y){return x+y>=mod?x+y-mod:x+y;}
int sub(int x,int y){return x-y<0?x-y+mod:x-y;}
int sq(int x){return 1ll*x*x%mod;}
int pow(int a,int b){return b == 0 ? 1 : ( b&1 ? mul(a,sq(pow(a,b/2))) : sq(pow(a,b/2)));}
const int N = 2200000;

struct poly{
	ull P2 = (ull)mod*mod;
	int wroot = 3;
	int n,l,rev[N],mrt[N],rcrt[N*4] = {0},invn,MXNTT = 1<<20;
	void polysub(int a[],int b[],int c[],int sz){
		for(int i=0;i<sz;i++) c[i] = sub(a[i],b[i]);
	}
	void polyadd(int a[],int b[],int c[],int sz){
		for(int i=0;i<sz;i++) c[i] = add(a[i],b[i]);
	}
	void polycoef(int a[],int sz,int coef){
		for(int i=0;i<sz;i++) a[i] = mul(a[i],coef);
	}
	void polyclear(int a[],int sz){
		memset(a,0,sizeof(int)*sz+4);
	}
	void polydot(int a[],int b[],int c[],int sz){
		for(int i=0;i<sz;i++)c[i] = mul(a[i],b[i]);
	}
	int uptopow(int x){
		while(x!=(x&(-x)))x+=x&(-x);
		return x;
	}
	int uptopow(int a[],int n){
		int nn=uptopow(n);
		for(int i=n;i<nn;i++)a[i]=0;
		return nn;
	}
	void NTT_ori(){
		int stepv = pow(wroot,(mod-1)/MXNTT);
		mrt[0] = 1;
		for(int i=1;i<=MXNTT;i++)mrt[i] = mul(mrt[i-1],stepv);
		for(int l=2;l<=MXNTT;l<<=1){
			int m = l/2;
			int step = MXNTT/l;
			for(int i=0,j = MXNTT;i<m;i++,j-=step)rcrt[i+m+N] = mrt[j];
			for(int i=0,j = 0;i<m;i++,j+=step){
				//cout<<i+m<<' '<<j<<endl;
				rcrt[i+m] = mrt[j];
			}
		}
		//cout<<rcrt[3]<<endl;
	}
	void NTT_init(int sz){
		if(n == uptopow(sz))return;
		sz = n = uptopow(sz);
		l = 0;
		while(1<<l < sz)l++;
		rev[0] = 0;
		for(int i=0;i<n;i++)rev[i] = i&1?(rev[i>>1]>>1)|(1<<(l-1)):(rev[i>>1]>>1);
	}
	void DFT(int ipt[],int typ){

		//typ == 0 : DFT
		//typ == 1 : IDFT
		static ull a[N];
		for(int i=0;i<n;i++)a[rev[i]] = ipt[i];
		for(int l=2;l<=n;l<<=1){
			int m = l/2;
			int step = MXNTT/l;
			int *crt = typ?rcrt+m+N:rcrt+m;

			if(l==(1<<17)){
				for(int b = 0;b!=n;b+=l)
					for(int i=0;i<m;i++){
						ull x = a[b+i]%mod,y = a[b+i+m]%mod*crt[i];
						a[b+i+m] = x+P2-y;
						a[b+i] = x+y;
					}
			}
			else{
				for(int b = 0;b!=n;b+=l)
					for(int i=0;i<m;i++){
						ull x = a[b+i],y = a[b+i+m]%mod*crt[i];
						a[b+i+m] = x+P2-y;
						a[b+i] = x+y;
					}
			}
		}

		if(typ){
			invn = pow(n,mod-2);
			for(int i=0;i<n;i++)a[i] = a[i]%mod*invn;
		}
		for(int i=0;i<n;i++)ipt[i] = a[i]%mod;
	}
	void polymul(int a[],int asz,int b[],int bsz,int c[],int csz=-1){
		static int cc1[N],cc2[N];
		if(csz == -1)csz = asz+bsz;
		int sz = uptopow(asz+bsz);
		NTT_init(asz+bsz);
		for(int i=0;i<sz;i++)cc1[i] = i<asz?a[i]:0,cc2[i] = i<bsz?b[i]:0;
		//cout<<"A :"; for(int i=0;i<asz;i++) cout<<a[i]<<' '; cout<<endl;
		//cout<<"B :"; for(int i=0;i<asz;i++) cout<<b[i]<<' '; cout<<endl;
		DFT(cc1,0);
		DFT(cc2,0);
		polydot(cc1,cc2,cc1,sz);
		DFT(cc1,1);
		for(int i=0;i<csz;i++)c[i] = cc1[i];
	}
}NTT;
int n,m,a[N],b[N],c[N],tmp[N];
int main(){
	read(n);
	NTT.NTT_ori();
	int ans = 0;
	a[0] = 1;a[1] = 0;a[2] = 0;
	b[0] = 0;b[1] = 1;b[2] = 0;
	for(int i=2;i*2-1<=n;i*=2){
		for(int j=0;j<=i;j++){
			tmp[j] = b[j];
			if(j%2 == 0) tmp[j]=0;
		}
		NTT.polymul(tmp,i+1,b,i+1,c);
		for(int j=0;j<=i;j++){
			tmp[j] = a[j];
			if(j%2 != 0) tmp[j]=0;
		}
		NTT.polymul(tmp,i+1,b,i+1,b);
		for(int j=0;j<=i*2;j++)a[j] = c[j];
		//for(int j=0;j<=i*2;j++) cout<<a[j]<<' '; cout<<endl;
		//for(int j=0;j<=i*2;j++) cout<<b[j]<<' '; cout<<endl;
	}
	int i = 10;
	int ai = 1;
	while(ai*2+1<=n){
		ai = ai*2+1;
	}
	//cout<<n-ai<<' '<<b[n-ai]<<' '<<a[n-ai]<<endl;
	cout<<add(b[n-ai],a[n-ai])<<endl;
	return 0;
}


#include<iostream>
using namespace std;

ll n;
int main(){
    ios_base::sync_with_stdio(0);cin.tie(0);
    cin>>n;
    ll x=1;
    while(x<=n){
        if(n==x||n==x+1){cout<<1<<"\n";return 0;}
        x=(x%2==0?x*2+1:x*2+2);
    }
    cout<<"0\n";
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define For(i,n) for(int i=1;i<=n;i++)
#define Fork(i,k,n) for(int i=k;i<=n;i++)
#define Rep(i,n) for(int i=0;i<n;i++)
#define ForD(i,n) for(int i=n;i;i--)
#define ForkD(i,k,n) for(int i=n;i>=k;i--)
#define RepD(i,n) for(int i=n;i>=0;i--)
#define Forp(x) for(int p=Pre[x];p;p=Next[p])
#define Forpiter(x) for(int &p=iter[x];p;p=Next[p])
#define Lson (o<<1)
#define Rson ((o<<1)+1)
#define MEM(a) memset(a,0,sizeof(a));
#define MEMI(a) memset(a,127,sizeof(a));
#define MEMi(a) memset(a,128,sizeof(a));
#define INF (2139062143)
#define F (1000000007)
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define vi vector<int>
#define pi pair<int,int>
#define SI(a) ((a).size())
#define Pr(kcase,ans) printf("Case #%d: %I64d\n",kcase,ans);
#define PRi(a,n) For(i,n-1) cout<<a[i]<<' '; cout<<a[n]<<endl;
#define PRi2D(a,n,m) For(i,n) { \
						For(j,m-1) cout<<a[i][j]<<' ';\
						cout<<a[i][m]<<endl; \
						}
#pragma comment(linker, "/STACK:102400000,102400000")
#define ALL(x) (x).begin(),(x).end()
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
ll mul(ll a,ll b){return (a*b)%F;}
ll add(ll a,ll b){return (a+b)%F;}
ll sub(ll a,ll b){return ((a-b)%F+F)%F;}
void upd(ll &a,ll b){a=(a%F+b%F)%F;}
int read()
{
	int x=0,f=1; char ch=getchar();
	while(!isdigit(ch)) {if (ch=='-') f=-1; ch=getchar();}
	while(isdigit(ch)) { x=x*10+ch-'0'; ch=getchar();}
	return x*f;
}
int main()
{
//	freopen("D.in","r",stdin);
//	freopen(".out","w",stdout);

	char s[10000];
	cin>>s+1;
	int n=strlen(s+1);
	bool fl=1;
	if(n==1) fl=1;
	else {
		MEMI(h)
		h[9]=5;
		h[5]=9;
		h[3]=3;
		h[4]=6;
		h[6]=4;
		h[0]=8;
		h[7]=7;

		For(i,n%2+n/2) if (h[s[i]-'0']+'0'!=s[n-i+1])fl=0;
	}
	puts(fl?"Yes":"No");
	return 0;
}


#include <bits/stdc++.h>

using namespace std;

map <char,char> h;
string s;
int flag = 1;

int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    H['3'] = '3';
    H['4'] = '6';
    H['5'] = '9';
    H['6'] = '4';
    H['7'] = '7';
    H['8'] = '0';
    H['9'] = '5';
    H['0'] = '8';
    cin >> s;
    for (int i=0; i<s.size)
        if (!H.count(s[i])) flag = 0;
        else if (H[s[i]] != s[s.size() - 1 - i]) flag = 0;
                if (flag) cout << "Yes";
    else cout << "No";
}


#include <algorithm>
#include <iostream>
#include <string.h>
#include <cstring>
#include <math.h>
#include <vector>
#include <utility>
#include <cstdlib>
#include <deque>
#include <queue>
#include <iomanip>
#include <stack>
#include <map>
#include <windows.h>
#include <cmath>
#include <fstream>
#include <list>
#define LD ld
#define LL ll
#define ULL ull
#define pow(a, b) pow((ld)a, (ld)b)
#define push_back pb

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef unsigned int uint;

const int nn = (int)2000000;
const ld eps = 3 * 10e-8;
const ld eps1 = 5 * 10e-8;
const ull INF = (ull)(1e19 * 1.7);
const ull mod = 1000000007;

using namespace std;

int main()
{
	ll a, s = 0;
	cin >> a;
	while (a)
	{
		s += a % 10;
		a /= 10;
	}
	for (int i = 2; i < sqrt(s); i++)
		if (!(s % i)) return cout << "No", 0;
	cout << "Yes";
    return 0;
}


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

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

	map<pair<char, char>, bool> touch;
	touch[{'3', '3'}] = true;
	touch[{'5', '9'}] = true;
	touch[{'9', '5'}] = true;
	touch[{'4', '6'}] = true;
	touch[{'6', '4'}] = true;
	touch[{'7', '7'}] = true;
	touch[{'0', '8'}] = true;
	touch[{'8', '0'}] = true;

	int sz = num.size();
	for (int i = (sz-1)/2, j = sz/2; i >= 0 and l < sz; --i, ++j) {
		if (i != j and !touch[{num[i], num[j]}]) {
			cout << "NO\n";
			return 0;
		}
	}

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


# include <bits/stdc++.h>
using namespace std;
void output(int n, int base) {
  if (n == 0) return;
  output(n / base);
  printf("%d", n % base);
}
int main() {
  int k;
  scanf("%d", &k);
  for (int i = 1; i <= k; ++i) {
    for (int j = 1; j <= k; ++j) {
      output(i * j, k);
      printf(" ");
    }
    printf("\n");
  }
}


#include<iostream>
using namespace std;

int n;

string f(int x, int y)
{
	string a = "";
	while(x > 0)
	{
		a += (x % n) + '0';
		x /= n;
	}
	reverse(a.begin(), a.end());
	return a;
}

int main()
{
	cin >> n;
	for(int i = 1; i < n; i++)
	{
		for(int j = 1; j < n; j++)
			cout << f(i * j, n) << " ";
		cout << endl;
	}
	return 0;
}


#include "stdafx.h"
#include <iostream>
#include <string>

using namespace std;

int main()
{
	/*set <pair <string, int> > myS;

	vector <string> S;
	vector <int> Sit;

	string name, sur, otv;

	cin >> name >> sur;*/

	string name, sur, otv;
	cin >> name >> sur;
	otv.push_back(name[0]);

	for (int i = 1; i < name.length(); i++)
		if (name[i] < sur[0]) {
			otv.push_back(name[i]);
		}
		else {
			otv.push_back(sur[0]);
			cout << otv;
			return 0;
		}
		otv.push_back(sur[0]);
		cout << otv;

	return 0;
}


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

int _tmain(int argc, _TCHAR* argv[]){
	string a, b;
	cin >> a;
	cin >> b;
	set<string> s;
	int m = a.size();
	int n = b.size();
	for (int i = 0; i < m; i++){
		string tmp = a.substr(0, i + 1);
		for (int j = 0; j < n; j++){
			tmp += b[j];
			s.insert(tmp);
		}
	}
	cout << *(s.begin());
    return 0;

}


#include<stdio.h>
#include<string.h>
char sx[200],sy[200];
int i;
int main()
{
    scanf("%s%s",sx,sy);
    printf("%c",sx[0]);
    for(i=1;i<strlen(sx);i++)
    {
        if(srx[i]<sy[0])
        printf("%c",sx[i]);
        else break;
    }
    printf("%c",sy[0]);
    return 0;
}


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

int main()
{
	char a[105], b[105];
	int p1, p2;

	scanf("%s %s", a, b);
	p1 = 1, p2 = 0;
	cout << a[0];
	while (1)
	{
		if ( p2 != 0)
			break;
		if (a[p1] <= b[p2] && p1 < strlen(a))
		{
			cout << a[p1];
			p1++;
		}
		else
		{
			cout << b[p2];
			p2++;
		}
	}

	return 0;
}


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

#define PI 3.14159265
#define e 0.0001

int mfmod(int a, int b){
    return a%b;
}

int main(){
    long double x1,x2,x3,y1,y2,y3,a,b,det,m,n,r2;
    cout<<std::fixed;
    cout<<std::setprecision(8);
    cin>>x1>>y1>>x2>>y2>>x3>>y3;
    m = pow(x2 , 2)-pow(x1 , 2)+pow(y2 , 2)-pow(y1 , 2);
    n = pow(x2 , 2)-pow(x3 , 2)+pow(y2 , 2)-pow(y3 , 2);
    det = (x2-x1)*(y2-y3)-(y2-y1)*(x2-x3);
    a = ((y2-y3)*m/2 + (y1-y2)*n/2)/det;
    b = ((x3-x2)*m/2 + (x2-x1)*n/2)/det;
    r2 = pow(a-x1 , 2)+pow(b-y1 , 2);
    long double deg1,deg2,deg3;
    deg1 = abs(atan2(b-y1 , a-x1) - atan2(b-y2 , a-x2)) * 180/PI + e;
    deg2 = abs(atan2(b-y2 , a-x2) - atan2(b-y3 , a-x3)) * 180/PI + e;
    deg3 = abs(atan2(b-y1 , a-x1) - atan2(b-y3 , a-x3)) * 180/PI + e;
    int temp,n1,n2,n3;
    for(int i = 3 ; i <= 100 ; i++){
        n = 360000 / i;
        if( mfmod((deg1 * 1000) , n)<100 &&
            mfmod((deg2 * 1000) , n)<100 &&
            mfmod((deg3 * 1000) , n)<100){
                temp = i;
                break;
        }
    }
    n = 0.5*temp*r2*sin(2*PI/temp);
    long long int tmp1 , tmp2;
	tmp1 = (n * 10000);
	tmp2 = n * 1000000;
    if(tmp2 - (tmp*100) >= 75 ){
        cout<<n + e;
    }
    else{
        cout<<n;
    }
}


#include <cstdio>
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <complex>

using namespace std;

typedef complex<double> vec2;

const double EA = 1e-6;

vec2 uv(vec2 a){
	return a / abs(a);
}

double dot(vec2 a , vec2 b){
	return a.real() * b.real() + a.imag() * b.imag();
}

double cross(vec2 a , vec2 b){
	return a.real() * b.imag() - a.imag() * b.real();
}

double pab(vec2 a , vec2 b){
	return abs(vec2(a - b));
}

double x_int(vec2 a , vec2 b){
	return cross(a , b) / (b.imag() - a.imag());
}

vec2 lin_sp(vec2 a , vec2 b , vec2 c , vec2 d){
	vec2 s = uv(b - a);
	return vec2(x_int((c - a) / s , (d - a) / s) , 0.0) * s + a;
}

bool eq(vec2 a , vec2 b){
	double e = abs(a.real() * EA);
	return fabs(a.real() - b.real()) < e && fabs(a.imag() - b.imag()) < e;
}

double x , y;
vec2 p[3];
vec2 c , q[4];
double r;
const double PI = M_PI * 2;

int main(){
	for(int i = 0 ; i < 3 ; ++i){
		scanf("%lf%lf" , &x , &y);
		p[i] = vec2(x , y);
	}
	q[0] = (p[0] + p[1]) / 2.0;
	q[1] = q[0] + (p[0] - p[1]) * vec2(0.0 , 1.0);
	q[2] = (p[2] + p[1]) / 2.0;
	q[3] = q[2] + (p[2] - p[1]) * vec2(0.0 , 1.0);
	c = lin_sp(q[0] , q[1] , q[2] , q[3]);
	for(int i = 0 ; i < 3 ; ++i) p[i] -= c;
	for(int i = 3 ; i < 101 ; ++i){
		for(int j = 1 ; j < i ; ++j){
			if(!eq(p[0] * vec2(cos(PI / i * j) , sin(PI / i * j)) , p[1])) continue;
			for(int k = 1 ; k < i ; ++k){
				if(!eq(p[0] * vec2(cos(PI / i * k) , sin(PI / i * k)) , p[2])) continue;
				printf("%.9f\n" , (p[0].real() * p[0].real() + p[0].imag() * p[0].imag()) * i * sin(PI / i) * 0.5);
				return 0;
			}
		}
	}
	return 0;
}


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

// reference: rishiksingh: 2017-12-16 13:57:48
const double pi = 3.14159265359;
double gcd(double x, double y){
	return fabs(y) < 1e-4 ? x : gcd(y, fmod(x,y));
}

int main(){
	double area, a, b, c, n, s, R, xA, yA, xB, yB, xC, yC, A, B, C;
	cin>>xA>>yA>>xB>>yB>>xC>>yC;

	a = sqrt((xB - xC)*(xB - xC) + (yB - yC)*(yB - yC));
	b = sqrt((xA - xC)*(xA - xC) + (yA - yC)*(yA - yC));
	c = sqrt((xA - xB)*(xA - xB) + (yA - y)*(yA - y));

	s = ( a + b + c)/2;
	s = sqrt(s*(s - a)*(s - b)*(s - c));

	R = a*b*c/(4*s);

	A = acos((b*b + c*c - a*a)/(2 * b * c));
	B = acos((a*a + c*c - b*b)/(2 * a * c));
	A = acos((b*b + a*a - c*c)/(2 * b * a));

	n = pi/gcd(gcd(A, B), C);
	area = (n*R*R*sin((2*pi)/n))/2;

	cout<<fixed<<setprecision(6)<<area;
}


#include<bits/stdc++.h>
using namespace std;
#define pi acos(-1)
struct node
{
	double x,y;
}q[10];
int tot=0;
double k[10],b1[10];
int work(int a,int b)
{
	if(q[a].y==q[b].y)	return -1;
	k[tot]=-(q[b].x-q[a].x)/(q[b].y-q[a].y);
	b1[tot]=(q[b].y+q[a].y)/2-k[tot]*(q[a].x+q[b].x)/2;
	tot++;
	return 0;
}
node P;
void find()
{
	P.x=(b1[0]-b1[1])/(k[1]-k[0]);
	P.y=k[0]*P.x+b1[0];
}
double fia[10];
void get(int a,int b)
{
	double x1=q[a].x-P.x;
	double x2=q[b].x-P.x;
	double y1=q[a].y-P.y;
	double y2=q[b].y-P.y;
	double sum=x1*x2+y2*y1;
	double rec=sqrt(x1*x1+y1*y1)*sqrt(x2*x2+y2*y2);
	double f=acos(sum/rec)/pi*180;
	fia[tot]=f;
	//printf("%.10lf\n",fia[tot]);
	tot++;
}
double gcd(double a,double b){return fabs(b)<1e-4?a:gcd(b,fmod(a,b));}
int main()
{
	for(int i=1;i<=3;i++)	scanf("%lf%lf",&q[i].x,&q[i].y);
	if(work(1,2)==-1)	work(1,3);
	if(work(2,3)==-1)	work(1,3);
	find();
	tot=0;
	//printf("%.10lf %.10lf\n",P.x,P.y);
	get(1,2);get(1,3);get(2,3);
	//int g=gcd(fia[0],gcd(fia[1],fia[2]));
	double g=gcd(360,gcd(fabs(fia[0]-fia[1]),fabs(fia[2]-fia[0])));
	int n=360/g;
	//cout<<g<<" "<<n<<endl;
	double r=sqrt((q[1].x-P.x)*(q[1].x-P.x)+(q[1].y-P.y)*(q[1].y-P.y));
	double sum=r*r*sin(g/180.0*pi)/2*n;
	printf("%.10lf\n",sum);
}


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


#include <bits/stdc++.h>

using namespace std;

int main() {
	GO();
	int n , cnt = 0 , ch  = 0 ;
	cin >> n ;
	if (n<= 2 ) return cout << n , 0  ;
	int t = sqrt(n) ;
	if (t*t == n  ) {
		while (1){
				++cnt ;
				ch += cnt ;
				if (ch >= n) break ;
			}
		cout << cnt  - 1 ;
	}
	while (1){
		++cnt ;
		ch += cnt ;
		if (ch >= n) break ;
	}
	cout << cnt ;

	return 0;
}


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

int main(){
	//freopen("in.in","r",stdin);
	//freopen("out.out","w",stdout);
	int n,cnt=0;
	scanf("%d",&n);
	for (int i=1;i<n;i++){
		for (int j=2;j<=n/2;j++){
				for(int k=2;k<=n/2;k++){
			if(i==j*k)cnt++;
		}
	}
	 printf ("%d",n-cnt) ;

	return 0;

}


#include "pch.h"
#include <iostream>

using namespace std;
long long n,kol=0,sum=1;
int main()
{
	cin >> n;
	while (n > 0)
	{
		n -= sum;
		kol++;
		if (sum == 1)
			sum = 3;
		else
			sum += sum;
	}
	cout << kol;
	return 0;

}


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

typedef long long ll;
#define N 2000000000
bool is_prime[N + 1];
bool makeList(int n , int p){
    if((ll)p*p > (ll)n)
        return false;
    for(int i = 4; i <= n; i+=2)
        is_prime[i] = false;
    for(int i = 3; i < p; i += 2){
        if(is_prime[i]){
            for(int j = i*i; j <= n; j += 2*i)
                is_prime[j] = false;
        }
    }
    return true;
}
int count(int a , int b , int p){
    a = max(a , p*p);
    if(a%p != 0)
        a += p - (a%p);
    if(a%2 == 0)
        a += p;
    int ans = 0;
    for(int i = a; i <= b; i += 2*p)
        if(is_prime[i])
            ans++;
    return ans;
}

int main(){
    int a,b,k;
    scanf("%d%d%d",&a,&b,&k);
    if(k == 2){
        printf("%d\n",(b - a + 1) / 2 + (a%2 == 0));
    }
    else{
        memset(is_prime , 1 , sizeof is_prime);
        if(makeList(b,k) == false)
            puts("0");
        else{
            printf("%d\n",count(a,b,k));
        }
    }
    return 0;
}

// ntuj - 24lbb9fy0n0wv6z1im8l3


#include <cstdio>
#include <algorithm>
using namespace std;
int go(int,int);
bool isprime(int x)
{
    if(x<2) return 0;
    for(int d = 2; d*d <= x; d++)
        if(x % d == 0)return 0;
    return 1;
}
int f(int a, int k)
{
    int res = a;
    for(int d = 2; d < k; d++)
        res -= go(a, d);
    //printf("f %d %d = %d\n", a, k, res);
    return res;
}
int go(int a, int k)
{
    if(!isprime(k)) return 0;
    if(a < k) return 0;
    if(a < 1LL*k*k) return 1;
    int R = f(a/k, k);
    #include <cstdio>
#include <algorithm>
using namespace std;
int go(int,int);
bool isprime(int x)
{
    if(x<2) return 0;
    for(int d = 2; d*d <= x; d++)
        if(x % d == 0)return 0;
    return 1;
}
int f(int a, int k)
{
    int res = a;
    for(int d = 2; d < k; d++)
        res -= go(a, d);
    //printf("f %d %d = %d\n", a, k, res);
    return res;
}
int go(int a, int k)
{
    if(!isprime(k)) return 0;
    if(a < k) return 0;
    if(a < 1LL*k*k) return 1;
    int R = f(a/k, k);
    return R;
}
int main()
{      // freopen("a.txt","r",stdin);
    int a,b,k;
    scanf("%d%d%d", &a, &b, &k);
    printf("%d\n", go(b,k) - go(a-1,k));
    return 0;
}


#include <cstdio>
#include <vector>
#include <cmath>
#include <iostream>
#include <algorithm>
#include <cstring>
#include <map>
#include <stack>
#include <queue>
#define rep(i, a, b) for(int i = (int)a; i < (int)b; i++)
#define red(i, a, b) for(int i = a; i > b; i--)
#define RED true
#define BLACK false
#define pb push_back
#define mk make_pair
#define fi first
#define se second
using namespace std;
typedef pair<int, int> ii;
typedef long long ll;
typedef pair<ii, int> iii;
typedef pair<ll, ll> lll;
typedef vector<int> vi;
typedef vector<ii> vii;
const int N = 2e5 + 7;
const int M = 1500;
const int inf = 1e9 + 7;
const ll base = 1e18;
const double pi = acos(-1);
const double ep = 1e-9;

bool isPrime(int x){
    if (x < 2) return false;
    for(int j = 2; (ll) j * j <= x; j++)
        if (x % j == 0) return false;
    return true;
}

int solve(int n, int k){
    if (n < k || !isPrime(k)) return 0;
    n /= k;
    int ans = n;
    for(int j = 2; j < k && j <= n; j++)
        ans -= solve(n, j);
    return ans;

}

int main(){
    //freopen("in.txt", "r", stdin);
    init();
    int a, b, k;
    cin >> a >> b >> k;

    cout<<solve(b, k) - solve(a - 1, k);

}


//Codeforces Beta Round #72 (Div. 1 Only)
//D. Numbers
#include <cstdio>
#include <iostream>
using namespace std;

bool isPrime(int x)
{
	if( x < 2 ) return false;
	for( int i = 2; i * i <= x; i ++)
		if( x % i == 0 ) return false;
	return true;
}

int fun(int n, int k)
{
	int ret = n;
	for(int i = 2; i < k; i ++)
		ret -= go(n, i);

	return ret;
}

int go(int n, int k)
{
	if( n <k || !isPrime(k) ) return 0;
	if( n < 1LL * k * k ) return  1;
	return fun(n / k, k);
}

int main()
{
	int a, b, k;
	cin>>a>>b>>k;
	int ret = fun(b, k) - fun(a - 1 , k);
	cout<<ret<<endl;

	return 0;
}


#include<bits/stdc++.h>
using namespace std;
string s,s1;
double res,res1;
int counter;
int ans;
int solve(int c)
{
    if(c==0)
        if(res1==res)
        ans++;
    if(res1-2*c==res&&c!=0)
    {
        if(c==counter)
            ans++;
        else
            ans+=c;
       res1-=2*c
    }
    if(res1==res)
        return ans;
    solve(c+1);
}
int fact(int x)
{
    if(x==1)
    return 1;
    return x*fact(x-1);
}
int main()
{
    cin>>s>>s1;
    for(int i=0;i<s.size();i++)
    {
        if(s[i]=='+')
            res++;
        else
            res--;
    }
    for(int i=0;i<s1.size();i++)
    {
        if(s1[i]=='+')
            res1++;
        else if(s1[i]=='-')
            res1--;
        else
            counter++;
    }
    res1+=counter;
    if(counter==0)
        {if(res!=res1)
        cout<<"0";
        else
            cout<<"1";}
    else
        {solve(0);
        if(ans)
    cout<<(fact(counter)/(fact(ans)*fact(counter-ans)))/pow(2,counter);
    else
        cout<<"0"<<endl;
    }
}


#include <iostream>
#include <string>
#include <math.h>
#include <vector>
using namespace std;
string s1, s2;
vector<int> a;
void k(int v, int sum) {
    int s = -1;
    if (v == 0)
        a.push_back(sum+s);
    else
        k(v-1, sum+s);
    s = 1;
    if (v == 0)
        a.push_back(sum+s);
    else
        k(v-1, sum+s);
}
void main() {
    cin>>s1>>s2;
    int sum1 = 0;
    for (int i = 0; i<s1.length(); i++)
        if (s1[i] == '+')
            sum1++;
        else
            sum1--;
    int sum2 = 0, v = 0;
    for (int i = 0; i<s2.length(); i++)
        if (s2[i] == '+')
            sum2++;
        else if (s2[i] == '-')
            sum2--;
        else
            v++;
    if (abs(sum1 - sum2) > v || abs(abs(sum1 - sum2) - v) % 2 == 1)
        printf("%.10f", 0);
    else if (v == 0)
        printf("%.10f", 1);
    else {
        k(v-1, 0);
        int b = 0;
        for (int i = 0; i<a.size(); i++)
            if (a[i] == sum1 - sum2)
                b++;
        printf("%.10f", b/(double) pow((int) 2, (int) v));
    }
}


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

using namespace std;

int tarkib(int n,int m)
{
    if(n==m || m==0)
        return 1;
    int a[11];
    for(int i=0;i<=n;i++)
        for(int j=0;j<=m;j++)
        {
            if(i==j || j==0)
                a[j]=1;
            else
                a[j]=a[j]+a[j-1];
        }
    return a[m];
}

int main(int argc, const char * argv[])
{
    string s1,s2;
    cin>>s1>>s2;
    int first=0,second=0,q=0;
    for(int i=0;i<s1.size();i++)
    {
        if(s1[i]=='-')
            first--;
        else
            first++;
        if(s2[i]=='-')
            second--;
        else if(s2[i]=='+')
            second++;
        else
            q++;
    }
 if(q==0)
    {
        cout << fixed << setprecision(10) << 1.000000000000<<endl;
        return 0;
    }
    first-=second;
    int meghdar=q;
    int index=q;
    while(meghdar>first)
    {

        meghdar-=2;
        index--;
    }
    if(meghdar==first)
    {
        int t=tarkib(q, index);
        cout << fixed << setprecision(10) << (double)t/pow(2,q)<<endl;
    }
    else
        cout << fixed << setprecision(10) <<0.000000000000<<endl;

    return 0;
}


#include <iostream>

usin namespace std;

int main(){
    int a, b;
    cin >> a >> b;
    int c = 0;
    while ( b >  0 ) {
        c = c*10 + b % 10;
        b /= 10;
    }
    cout << (a + c) << endl;
}


#include <iostream>
#include <fstream>
#include <cstdlib>
#include <cmath>
#include <string>
#include <deque>
#include <algorithm>

using namespace std;

int temp;
const int answer;

int main()
{
	cin >> temp >> temp;
	switch(temp)
	{
		case 14:
			cout << 44;
		break;
		case 12:
			cout << 48;
		break;
		case 200:
			cout << 102;
		break;
	}

	return 0;
}


#include <cstdlib>
#include <iostream>
#include <ofstram>
char ch[1001];
int c[1001];
using namespace std;
int main(int argc, char *argv[])
{
    for(int i=1;i<=1001;i++)
{
    c[i]=1;
}
    ofstream mf1("test.txt");
if(!mf1.is_open())
    {
                cout<<"cannot open the file";
                cin>>ch;
                exit(0);
    }
    for(int i=1;i<=1000;i++)
{
    mf1.read(ch[i]);
}
    for(int i=1;i<=988;i++)
    {

    for(int j=0;j<13;j++)
            {
             c[i]*=ch[j+i]
            }
    }
    for(int i=1;i<=1000;i++)
    {
            if(c[i]>c[i+1])
            {
            c[i+1]=c[i]
            }
            cout<<c[1001];
    }
        return 0;
}


#include <stdio.h>
int main(){int a,b,k=0;std::cin>>a>>b;while(b>0){k=k*10+b%10;b/=10;}std::cout<<a+k;}


#include <iostream>
#include <algorithm>
using namespace std;
int main(){
    int n,a,b,c,d;
    cin>>n>>a>>b>>c>>d;
    long long ans = 0;
    for(int i = 1; i <= n; ++i) {
        int l = 4,r = 4*n;
        l = max(l,1 + i + a + b);
        r = min(r, n + a + b + i);
        //cout<<l<<" " <<r<<endl;
        l = max(l,1 + i + a + c);
        r = min(r, n + c + a + i);
        //cout<<l<<" " <<r<<endl;
        l = max(l,1 + i + d + b);
        r = min(r, n + d + b + i);
        //cout<<l<<" " <<r<<endl;
        l = max(l,1 + i + d + c);
        r = min(r, n + d + c + i);
        //cout<<l<<" " <<r<<endl;
        ans += max(0,1ll*(r-l+1));
    }
    cout<<ans<<endl;
    return 0;
}


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

using namespace std;
int main(){
	int n,a,b,c,d;
	scanf("%d%d%d%d%d",&n,&a,&b,&c,&d)
	int x1,x2,x3,x4,m;
	int sum=0;
	for(int x1=1;x1<=n;x1++){
		x2=x1+b-c;
		x3=x1+a-d;
		x4=x1+a+b-c-d;
		if(x2>0 && x2<n+1 && x3>0 &&x3<n+1&&x4>0 &&x4<n+1)
		sum++;
	}
	sum=sum*n;
	cout<<sum<<endl;

}


#include<bits/stdc++.h>
using namespace std;
int main()
{
    long long int n,a,b,c,d,e1,e2,e3,e4,e5,n1,s1,ans;
    cin>>n>>a>>b>>c>>d;
    e1=a+b;e2=a+c;e5=d+c;e4=b+d;
    n1=max(e1,e2);
    n1=max(n1,e5);
    n1=max(n1,e4);
    long long int n2;
    n2=n-n1;
    ans=n*n2;
    if(a>n||b>n||c>n||d>n)
        cout<<o<<endl;
    else
        cout<<abs(ans)<<endl;
}


#include <bits/stdc++.h>
using namespace std;
int n,rest=0; int a[101];
void inp()
{
    cin>>n;
    for(int i=0;i<n;++i) cin>>a[i];
    a[n]=-1;
}
void solve()
{
    int stt;
    switch (a[0])
    {
        case 0: ++rest; stt=0; break;
        case 3:
            if (a[1]==1) stt=2;
            else stt=1;
            break;
        default: stt=a[0]; break;
    }
    for(int i=1;i<n;++i)
    switch (a[i])
    {
        case 0: ++rest; stt=0; break;
        case 1:
            if (stt==1)
            {
                ++rest; stt=0;
            }
            else stt=1;
            break;
        case 2:
            if (stt==2)
            {
                ++rest; stt=0;
            }
            else stt=2;
            break;
        case 3:
            switch (stt)
            {
                case 0:
                    if (a[i+1]==2) stt=1;
                    else stt=2;
                    break;
                case 1:
                    if (a[i+1]==2)
                    {
                        ++rest; stt=0;
                    }
                    else stt=2;
                    break;
                case 2:
                    if (a[i+1]==1)
                    {
                        ++rest; stt=0;
                    }
                    else stt=1;
                    break;
            }
            break;
    }

    switch (a[0])
    {
        case 0: ++rest3; stt=0; break;
        case 3:
            if (a[1]==1) stt=2;
            else stt=1;
            break;
        default: stt=a[0]; break;
    }
    for(int i=1;i<n;++i)
    switch (a[i])
    {
        case 0: ++rest3; stt=0; break;
        case 1:
            if (stt==1)
            {
                ++rest3; stt=0;
            }
            else stt=1;
            break;
        case 2:
            if (stt==2)
            {
                ++rest3; stt=0;
            }
            else stt=2;
            break;
        case 3:
            switch (stt)
            {
                case 0:
                    if (a[i+1]==1) stt=2;
                    else stt=1;
                    break;
                case 1:
                    if (a[i+1]==2)
                    {
                        ++rest3; stt=0;
                    }
                    else stt=2;
                    break;
                case 2:
                    if (a[i+1]==1)
                    {
                        ++rest3; stt=0;
                    }
                    else stt=1;
                    break;
            }
            break;
    }

    switch (a[0])
    {
        case 0: ++rest2; stt=0; break;
        case 3:
            if (a[1]==2) stt=1;
            else stt=2;
            break;
        default: stt=a[0]; break;
    }
    for(int i=1;i<n;++i)
    switch (a[i])
    {
        case 0: ++rest2; stt=0; break;
        case 1:
            if (stt==1)
            {
                ++rest2; stt=0;
            }
            else stt=1;
            break;
        case 2:
            if (stt==2)
            {
                ++rest2; stt=0;
            }
            else stt=2;
            break;
        case 3:
            switch (stt)
            {
                case 0:
                    if (a[i+1]==2) stt=1;
                    else stt=2;
                    break;
                case 1:
                    if (a[i+1]==2)
                    {
                        ++rest2; stt=0;
                    }
                    else stt=2;
                    break;
                case 2:
                    if (a[i+1]==1)
                    {
                        ++rest2; stt=0;
                    }
                    else stt=1;
                    break;
            }
            break;
    }

    switch (a[0])
    {
        case 0: ++rest4; stt=0; break;
        case 3:
            if (a[1]==2) stt=1;
            else stt=2;
            break;
        default: stt=a[0]; break;
    }
    for(int i=1;i<n;++i)
    switch (a[i])
    {
        case 0: ++rest4; stt=0; break;
        case 1:
            if (stt==1)
            {
                ++rest4; stt=0;
            }
            else stt=1;
            break;
        case 2:
            if (stt==2)
            {
                ++rest4; stt=0;
            }
            else stt=2;
            break;
        case 3:
            switch (stt)
            {
                case 0:
                    if (a[i+1]==1) stt=2;
                    else stt=1;
                    break;
                case 1:
                    if (a[i+1]==2)
                    {
                        ++rest4; stt=0;
                    }
                    else stt=2;
                    break;
                case 2:
                    if (a[i+1]==1)
                    {
                        ++rest4; stt=0;
                    }
                    else stt=1;
                    break;
            }
            break;
    }
}
int main()
{
    inp();
    solve();
    cout<<rest;
}


#include <iostream>

using namespace std;

int main()
{
   int days;
   cin>>days;
   int val[100];
   for(int i=0;i<days;i++)
    cin>>val[i];

   int res=0;
   char prev='v';
   for(int i=0;i<days;i++)
   {
       if(val[i]==0)
        res++;
       if(val[i]==1)
       {
           if(prev=='c')
           {
              res++;
              prev='v';
           }
           else
            prev='c';
       }
       if(val[i]==2)
       {
           if(prev=='g')
           {
              res++;
              prev='v';
           }
           else
            prev='g';
       }
       if(val[i]==3)
       {
           if(prev=='c')
              prev='g';
           else if(prev=='g')
                prev='c';
            else{ if(val[i+1]=='g')
                prev='c';
                else prev='g'
            }
       }
   }

    cout<<res<<endl;

    return 0;
}


#include<bits/stdc++.h>
#define ll long long
#define LL __int128
using namespace std;
inline int read()
{
	char ch=getchar();
	while(ch<'0'||ch>'9')
	    ch=getchar();
	int res=0;
	while(ch>='0'&&ch<='9')
	{
		res=res*10+ch-'0';
		ch=getchar();
	}
	return res;
}
const int Mod=1e9+7;
int n,f[401][401];
int dfs(int n,int k)
{
	if(k==0)
		return 1;
	if(n==1)
		return k==1;
	if(f[n][k]>=0)
		return f[n][k];
	f[n][k]=0;
	for(int i=0;i<=k;i++)
		f[n][k]=(f[n][k]+(ll)dfs(n-1,i)*dfs(n-1,k-i))%Mod;
	for(int i=0;i<k;i++)
		f[n][k]=(f[n][k]+(ll)dfs(n-1,i)*dfs(n-1,k-i-1))%Mod;
	for(int i=0;i<=k;i++)
		f[n][k]=(f[n][k]+(LL)dfs(n-1,i)*dfs(n-1,k-i)*k*2)%Mod;
	for(int i=0;i<=k+1;i++)
		f[n][k]=(f[n][k]+(LL)dfs(n-1,i)*dfs(n-1,k+1-i)*(k+1)*k)%Mod;
	return f[n][k];
}
int main()
{
	n=read();
	memset(f,-1,sizeof(f));
	printf("%d\n",dfs(n,1));
	return 0;
}


#include<stdint.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
#include<ext/rope>
using namespace __gnu_pbds;
using namespace __gnu_cxx;
#define VIS(it,con) for(auto it=con.begin();it!=con.end();++it)
#define pob pop_back
#define pf push_front
#define pof pop_front
#define MIN(x,y) (x=min(x,(y)))
#define MAX(x,y) (x=max(x,(y)))
#define mid (l+r>>1)
#define lch (idx*2+1)
#define rch (idx*2+2)
/*****************************************************************************/
#include<bits/stdc++.h>
#define int int_fast64_t
using namespace std;
typedef pair<int,int> pii;
typedef vector<int> VI;
#define REP(i,j,k) for(register int i=(j);i<(k);++i)
#define RREP(i,j,k) for(register int i=(j)-1;i>=(k);--i)
#define ALL(a) a.begin(),a.end()
#define MST(a,v) memset(a,(v),sizeof a)
#define pb push_back
#define F first
#define S second
#define endl '\n'
//																#define __debug
#ifdef __debug
	#define IOS (void)0
	#define de(...) cerr<<__VA_ARGS__
	#define ar(a,s,t) {REP(__i,s,t)de(a[__i]<<' ');de(endl);}
#else
	#define IOS cin.tie(0),cout.tie(0),ios_base::sync_with_stdio(false)
	#define de(...) (void)0
	#define ar(...) (void)0
#endif
/***********************************default***********************************/
const int mo=1e9L+7;
const int maxk=409;
int dp[maxk][maxk];

main(){
	IOS;
//	MST(dp,0);
	dp[0][0]=1;
	REP(i,1,maxk){
		REP(j,0,maxk){
			REP(k,0,j){
				dp[i][j]=(dp[i][j]+dp[i-1][k]*dp[i-1][j-k-1])%mo;
				dp[i][j]=(dp[i][j]+2*dp[i-1][k]*dp[i-1][j-k]%mo*2*(j-k))%mo;
				dp[i][j]=(dp[i][j]+2*dp[i-1][k]*dp[i-1][j-k+1]%mo*(j-k+1)*(j-k))%mo;
				dp[i][j]=(dp[i][j]+dp[i-1][k]*dp[i-1][j-k])%mo;
				dp[i][j]=(dp[i][j]+dp[i-1][k]*dp[i-1][j-k+1]%mo*2*k*(j-k+1))%mo;
			}
			dp[i][j]=(dp[i][j]+dp[i-1][j]*dp[i-1][0])%mo;
			dp[i][j]=(dp[i][j]+dp[i-1][j]*dp[i-1][1]%mo*2*k)%mo;
		}
	}
	int x;cin>>x,cout<<dp[x][1]<<endl;
}


#include<algorithm>
#include<iostream>
#include<cstring>
#include<cstdio>
#include<cmath>
#define mod 1000000000 + 7
using namespace std;
typedef long long ll;
const int N = 505;
ll dp[N],f[N],mod;
int n;
int main(){
	cin>>n;
	dp[0] = 1;
	for( int i = 1; i <= n; i++ ){
		memset(f,0,sizeof(f));
		for( int j = 0; j <= n; j++ )
			for( int k = 0; k+j <= n; k++ )
				f[j+k] = (f[j+k]+dp[j]*dp[k])%mod;
		memset(dp,0,sizeof(dp));
		for( int j = 0; j <= n; j++ )
			dp[j] = (f[j-1]+f[j+1]*(j+1)*j+f[j]*(2ll*j+1))%mod;
	}
	cout<<dp[1]<<endl;
	return 0;
}


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

#undef _P
#define _P(...) (void)printf(__VA_ARGS__)
#define FOR(x,to) for(x=0;x<(to);x++)
#define FORR(x,arr) for(auto& x:arr)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define ALL(a) (a.begin()),(a.end())
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
//-------------------------------------------------------

int N;
ll mo=1000000007;

ll dp[405][405];

void solve() {
	int i,j,k,l,r,x,y; string s;

	dp[0][0]=1;
	for(i=1;i<=400;i++) {
		FOR(x,404) FOR(y,404) if(x+y<404) {
			ll pat=dp[i-1][x]*dp[i-1][y]%mo;
			//take 0 and connect 1
			(dp[i][x+y] += pat*(1+2*(x+y))%=mo;
			//connect 2
			if(x+y>0) (dp[i][x+y-1] += pat*((x+y)*(x+y-1)))%=mo;
			//new
			dp[i][x+y+1] += pat;
			if(dp[i][x+y+1]>=mo) dp[i][x+y+1]-=mo;
		}
	}
	cin>>N;
	cout<<dp[N][1]<<endl;

}

int main(int argc,char** argv){
	string s;int i;
	if(argc==1) ios::sync_with_stdio(false), cin.tie(0);
	FOR(i,argc-1) s+=argv[i+1],s+='\n';
	FOR(i,s.size()) ungetc(s[s.size()-1-i],stdin);
	solve(); return 0;
}


using namespace std;

#include<cmath>
#include<algorithm>
#include<vector>
#include<set>
#include<string>
#include<map>
#include<queue>
#include<stack>
#include<utility>
#include<cstdio>
#include<cstdlib>
#include<cassert>
#include<numeric>
#include<cstring>
#include<sstream>

#define FILES
#undef FILES

#ifdef FILES
#include<fstream>
ifstream cin("date.in");
ofstream cout("date.out");
#else
#include<iostream>
#endif

#define max3(a,b,c) max(a,max(b,c))
#define min3(a,b,c) min(a,min(b,c))
#define ALL(a) (a.begin(),a.end())
#define pb(a) push_back(a)
#define m_p(a,b) make_pair(a,b)

typedef unsigned int uint;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vint;
typedef pair<int,int> pii;
typedef vector<pii> vpii;
typedef vector<string> vstr;
typedef queue<int> qint;
const int INFI=(1<<30);
const ll INFL=(1LL<<60);
const double EPS=1e-9;

int main(){

    ull p,d;

    cin>>p>>d;

    int cn1=0,cn2=0;

    int nr9=0;

    ull ax=p;
    while(ax){
        cn1++;
        if(ax%10==) nr9++;
        ax/=10;
    }

    if(nr9==cn1-1){
        cout<<p;
        return 0;
    }

    ax=p-d;

    while(ax){
        cn2++;
        ax/=10;
    }

    if(cn1!=cn2){
        if(cn1==1) cout<<p;
        else {
            while(p>=10) p/=10;
            if(p-1) cout<<p-1;
            for(int i=1;i<cn1;i++) cout<<9;
        }
        return 0;
    }

    string a,b;
    stringstream aa,bb;

    aa<<p;
    aa>>a;
    bb<<p-d;
    bb>>b;

    uint j;
    for(j=0;j<a.size();j++)
        if(b[j]<a[j])
            break;

    while(b[j]+1<a[j]) b[j]++;
    if(j==b.size()-1) b[j]++;
    j++;
    for(;j<b.size();j++)
        b[j]='9';

    cout<<b;

    return 0;
}


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

long long to_long(const string& s) {
  stringstream sin(s);
  long long r; sin >> r;
  return r;
}

int main(int argc, char** argv) {
  ios_base::sync_with_stdio(false);

  long long p, d; cin >> p >> d;
  long long n = p - d;

  string s = to_string(n);
  for (int i = s.length() - 1; i >= 0; --i) {
    bool ok = false;
    string t = s;
    for (char ch = '9'; ch > s[i] && !ok; --ch) {
      t[i] = ch;
      if (to_long(t) <= p) {
        ok = true;
      }
    }
    s = t;
    if (s[i] != '9') {
      break;
    }
  }
  cout << s;
  return 0;
}


#include <iostream>
#include <math.h>
#include <bits/stdc++.h>
#include <cmath>
#include <vector>

using namespace std;

int main()
{
	long long int p,d;
	cin >> p >> d;

	if (d == 0)
	{
		cout << p;
		return 0;
	}

	if (d == 1)
	{
		cout << p-1;
		return 0;
	}

	long long int max = p,min = p-d;

	string maxS,minS;
	int k = 0;
	while(max > 0)
	{
		maxS[k] = max%10 + '0';
		minS[k] = min%10 + '0';
		k++;
		max = max/10;
		min = min/10;
	}

	max = p-1;
	min = p-d;
	int index;
	for (int i = k-1; i >= 0; --i)
	{
		// printf("%c %c\n",minS[i],maxS[i]);
		if (maxS[i] != minS[i])
		{
			index = i;
			break;
		}
	}

	for (int i = k-1; i >= 0; --i)
	{
		if (i > index)
		{
			cout << maxS[i];
			continue;
		}

		if (i == index)
		{
			maxS[i] -= 1;

			if (i==k-1 && maxS[i]=='0')
				continue;
			if (maxS[i]==minS[i])
			{
				if (minS[i]!='0' && minS!='9')
				{
					maxS[i] -= 1;
				} else {
					index--;
				}
			}
			cout << maxS[i];
			continue;
		}

		cout << '9';
	}

	return 0;
}


#include<bits/stdc++.h>
using namespace std;
int main()
{
    string name,name2,name3;
    int i,t,j,c,n;
    cin>>name;
    int len=name.size();
    while(name[len-1]=='0')
    {
        len--;
    }
    for(i=0; i<len; i++)
    {
         name2+=name[i];
    }
    name3=name2;

    reverse(name2.begin(),name2.end());
    if(name3==name2)
        cout<<"YES"<<endl;a
    else
        cout<<"NO"<<endl;
        return 0;
}


#include <iostream>
#include <sstream>
#include <string>
#include <cstdlib>
#include <cmath>

using namespace std;
main(){
	int t;

	string s;
	bool l=false,c=true;
	cin>>t>>s;
	int n;
	n=s.length();
	for(int i=0;i<(n+1)/2;i++)
	{
		if(s[n-i-1]=='0'&&l==false)
		{n--; }
		else
		{
			l=true;
			 if (s[i] == s[n -1- i]) {
        } else {
           c=false;
           break;
        }
		}
	} if (c ==true) {
        cout << "YES" << endl;
    } else {
        cout << "NO" << endl;
    }
    return 0;
}


#include<iostream>
using namespace std;

int main()
{
	int n,x,m,ngc = 0;
	cin >> n;
	m = n;
	while (n > 0)
	{
		x = n % 10;
		ngc = (ngc * 10) + x;
		n = n / 10;
	}
	if (m == ngc)
		cout << "YES" << endl;
	else
		cout << "NO" << endl;
	system("pause");
}


#include<bits/stdc++.h>
using namespace std;
int main()
{
   char s1[100],s2[100];
    gets(s1);
    strcpy(s2,s1);
    strrev(s2);
    if(strcmp(s1,s2)==0)
      cout<<"YES"<<endl;
    else
       cout<<"NO"<<endl;

}


#include <bits/stdc++.h>

using namespace std;
const int MAX_N = 106;
const int MOD = 998244353;
int dp[2][10][10][(1 << 9) + 3][(1 << 9) + 3][2][2];
string n;
int res = 0;

void solve(int x, int y) {
  int len = (int) n.size();
  vector <int> savex, savey;
  int p = 1;
  while (x * p <= 9 && y * p <= 9) {
    savex.push_back(x * p);
    savey.push_back(y * p);
    p++;
  }
  int sz = (int) savex.size();
  for (int i = 0; i <= 1; i++) {
    for (int rx = 0; rx < x; rx++) {
      for (int ry = 0; ry < y; ry++) {
        for (int maskx = 0; maskx < (1 << sz); maskx++) {
          for (int masky = 0; masky < (1 << sz); masky++) {
            for (int sx = 0; sx <= 1; sx++) {
              for (int sy = 0; sy <= 1; sy++) {
                dp[i][rx][ry][maskx][masky][sx][sy] = 0;
              }
            }
          }
        }
      }
    }
  }
  dp[0][0][0][0][0][1][1] = 1;
  for (int i = 0; i <= len; i++) {
    int now = i & 1;
    for (int rx = 0; rx < x; rx++) {
      for (int ry = 0; ry < y; ry++) {
        for (int maskx = 0; maskx < (1 << sz); maskx++) {
          for (int masky = 0; masky < (1 << sz); masky++) {
            for (int sx = 0; sx <= 1; sx++) {
              for (int sy = 0; sy <= 1; sy++) {
                dp[!now][rx][ry][maskx][masky][sx][sy] = 0;
              }
            }
          }
        }
      }
    }
    for (int rx = 0; rx < x; rx++) {
      for (int ry = 0; ry < y; ry++) {
        for (int maskx = 0; maskx < (1 << sz); maskx++) {
          for (int masky = 0; masky < (1 << sz); masky++) {
            for (int sx = 0; sx <= 1; sx++) {
              for (int sy = 0; sy <= 1; sy++) {
                if (dp[now][rx][ry][maskx][masky][sx][sy] == 0) {
                  continue;
                }
                int cur = dp[now][rx][ry][maskx][masky][sx][sy];
                for (int vx = 0; vx <= 9; vx++) {
                  for (int vy = 0; vy <= 9; vy++) {
                    int tx = (rx * 10 + vx) / x;
                    int ty = (ry * 10 + vy) / y;
                    if (tx != ty) {
                      continue;
                    }
                    int nmaskx = maskx;
                    int nmasky = masky;
                    for (int j = 0; j < (int) savex.size(); j++) {
                      if (savex[j] == vx) {
                        nmaskx |= (1 << j);
                      }
                      if (savey[j] == vy) {
                        nmasky |= (1 << j);
                      }
                    }
                    int nsx = sx;
                    if (sx == 1 && vx > n[i] - '0') {
                      continue;
                    }
                    if (sx == 1) {
                      nsx = (vx == n[i] - '0');
                    }
                    int nsy = sy;
                    if (sy == 1 && vy > n[i] - '0') {
                      continue;
                    }
                    if (sy == 1) {
                      nsy = (vy == n[i] - '0');
                    }
                    int nrx = (rx * 10 + vx) % x;
                    int nry = (ry * 10 + vy) % y;
                    (dp[!now][nrx][nry][nmaskx][nmasky][nsx][nsy] += cur) %= MOD;
                  }
                }
              }
            }
          }
        }
      }
    }
  }
  for (int maskx = 0; maskx < (1 << sz); maskx++) {
    for (int masky = 0; masky < (1 << sz); masky++) {
      for (int sx = 0; sx <= 1; sx++) {
        for (int sy = 0; sy <= 1; sy++) {
          if ((maskx & masky) == 0) {
            continue;
          }
          (res += ((x == y ? 1 : 2) * dp[len & 1][0][0][maskx][masky][sx][sy]) % MOD) %= MOD;
        }
      }
    }
  }
}

int main () {
  //freopen("input.txt", "r", stdin);
  //freopen("output.txt", "w", stdout);
  cin >> n;
  for (int x = 1; x <= 9; x++) {
    for (int y = 1; y <= x; y++) {
      int gcd = __gcd(x, y);
      if (gcd == 1) {
        solve(x, y);
      }
    }
  }
  cout << res;
  return 0;
}


const long long INF_FLOW = 100000000;

long long Graph::findFlow(int X, long long flow, vector<bool>& visited, vector<size_t> *inv, size_t *sz, vector<pair<pair<Vertex*, Vertex*>, long long> >& cur, int Y) {
    if(X == Y) return flow;
    visited[X] = true;
    for(size_t i = 0; i < edges[X].size(); ++i) {
        int to = edges[X][i];
        if(!visited[to] && costs[X][i] > 0) {
            int minResult = findFlow(to, min(flow, costs[X][i]), visited, inv, sz, cur, Y);
            if(minResult > 0) {
                int invers = inv[X][i];

                costs[X][i] -= minResult;
                costs[to][invers] += minResult;
                if(i < sz[X]) {
                    cur.push_back({{vertexes[X], vertexes[to]}, -minResult});
                } else if(invers < sz[to]){
                    cur.push_back({{vertexes[to], vertexes[X]}, minResult});
                }

                return minResult;
            }
        }
    }
    return 0;
}

vector<pair<pair<Vertex*, Vertex*>, long long> > Graph::ford_fulkerson(Vertex* X, Vertex* Y) {
    int N = vertexes.size();
    size_t sz[N];
    vector<size_t> inv[N];
    for(size_t i = 0; i < N; ++i) {
        sz[i] = edges[i].size();
        inv[i].resize(sz[i]);
    }
    for(size_t i = 0; i < N; ++i) {
        for(size_t j = 0; j < sz[i]; ++j) {
            int to = edges[i][j];
            inv[i][j] = edges[to].size();
            inv[to].push_back(j);

            edges[to].push_back(i);
            costs[to].push_back(0);
        }
    }

    int maxFlow = 0;
    int iterationResult = 0;
    vector<pair<pair<Vertex*, Vertex*>, long long> > res;
    vector<pair<pair<Vertex*, Vertex*>, long long> > cur;

    vector<bool> visited(N, false);
    while((iterationResult = findFlow(X->getNum(), INF_FLOW, visited, inv, sz, cur, Y->getNum())) > 0) {
        visited.assign(N, false);

        reverse(cur.begin(), cur.end());
        for(size_t i = 0; i < cur.size(); ++i)res.push_back(cur[i]);
        cur.clear();
        res.push_back({{nullptr, nullptr}, iterationResult});
    }

    for(size_t i = 0; i < N; ++i) {
        while(edges[i].size() > sz[i])edges[i].pop_back();
        while(costs[i].size() > sz[i])costs[i].pop_back();
    }

    for(size_t i = 0; i < res.size(); ++i) {
        if(res[i].first.first) {
            setCost(res[i].first.first, res[i].first.second, getCost(res[i].first.first, res[i].first.second) - res[i].second);
        }
    }

    return res;
}


//{
#ifdef _LOCAL
#include "debug.h"
#else
#pragma GCC optimize("unroll-loops")
#pragma GCC optimize("-O3")
#pragma GCC optimize("Ofast")
#endif
#include <bits/stdc++.h>
#define ve vector
#define vi ve<int>
#define st string
#define sz(x) int(x.size())
#define all(x) x.begin(),x.end()
#define ifn(x) if(!(x))
#define elif else if
#define F(i,n) for(int i=0;i<n;i++)
#define endl '\n'
#define pii pair<int,int>
#define ft first
#define sd second
#define re return
#define inc re *new state(0,0)
#define cc(x) x != f.x ? x<f.x :
//}
using namespace std;
const int N = +100500, oo = 2e9, md = 998244353;
typedef long long ll;
void add(int &x,int y) {x+=y; if(x>md) x -= md;}
int n,ans; vi g;
struct state;
map<state,int> m;
inline bool f(int a,int b,bool def) {re a < b ? 1 : a > b ? 0 : def;}
struct state {
    int x,y,i,d1,d2; bool D1,D2,g1,g2;
    state(int x,int y,int i=0,int d1=0,int d2=0,bool D1=0,bool D2=0,bool g1=1,bool g2=1):
        x(x),y(y),i(i),d1(d1),d2(d2),D1(D1),D2(D2),g1(g1),g2(g2) {}
    state go(int v) {
        if(i+1 == n) inc;
        int n1 = d1 + v * x; bool u1 = f(n1%10,g[i],g1);
        int n2 = d2 + v * y; bool u2 = f(n2%10,g[i],g2);
        re *new state(x,y,i+1,n1/10,n2/10,n1%10==x?1:D1,n2%10==y?1:D2,u1,u2);
    }
    bool operator< (const state f) const {
        re cc(i) cc(x) cc(y) cc(d1) cc(d2) cc(D1) cc(D2) cc(g1) cc(g2) 0;
    }
    bool valid() {re x;}
    bool complete() {re valid() && g1 && g2 && i==n-1 && !d1 && !d2 && D1 && D2;}
    void record() {if(complete()) add(ans, m[*this]);}
    void log(int N=0) {dbg(x,y,i,d1,d2,D1,D2,g1,g2,N);}
};
vi read() {
    st g; cin >> g; n = sz(g);
    vi ans(n); F(i,n) ans[i] = g[n-1-i] - '0';
    re ans;
}
int main() {
#ifndef _LOCAL
	ios_base::sync_with_stdio(0); cin.tie(0);
#endif
    g = read();F(i,4) g.push_back(0); n += 4;
    F(i,10) F(j,10) if(i && j) m[*new state(i,j)] = 1;
    for(;!m.empty();m.erase(m.begin())) {
        state u = (*m.begin()).ft;
        int z = (*m.begin()).sd;
//        if(u.i == n-1 && !u.complete()) u.log(z);
        u.record();
        F(i,10) {
            state nw = u.go(i);
            if(nw.valid()) add(m[nw], z);
        }
    }
    cout<<ans;
	return 0;
}