#include <bits/stdc++.h>
#define MAXN 100005
#define INF 1000000000000000005

using namespace std;

int main (){
	
	
	int a,b,ms,mf;
	cin>>a>>b;
	
	ms = a+b;
	mf = b;
	//cout<<ms<<" "<<mf<<endl;
	
	if (  ms >= 15 &&  mf >=8 ) {
		cout<<1; return 0;
	}
	else if ( ms >= 10 && mf >=3  ){
		cout<<2; return 0;
	}
	else if ( ms >=3 ){
		cout<<3; return 0;
	}
	else {
		cout<< 4; return 0;
	}
} 
#include <bits/stdc++.h>
using namespace std;
 
long myPow(long x, long n, long m){
  if(n == 0)
    return 1;
  if(n % 2 == 0)
    return myPow(x * x % m, n / 2, m);
  else
    return x * myPow(x, n - 1, m) % m;
}
 
int main()
{
  long N, M;
    cin >> N >> M;
    cout << myPow(10,N,M*M) / M << endl;
    system("pause");
    return 0;
}