#include <bits/stdc++.h>
#define int long long int
using namespace std;
int power(int x, int y, int p)
{
    int res = 1;     // Initialize result

    x = x % p; // Update x if it is more than or
                // equal to p

    while (y > 0)
    {
        // If y is odd, multiply x with result
        if (y & 1)
            res = (res*x) % p;

        // y must be even now
        y = y>>1; // y = y/2
        x = (x*x) % p;
    }
    return res;
}
signed main(){
    int n , m;
    cin>>n>>m;
    int ans = (power(10 , n , m*m ) - power(10 , n , m ) +m*m )%(m*m );
    ans/= m;
    cout<<ans;
}

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

int main() {
  int A, B;
  cin >> A >> B;
  int C = A + B;
  
  if(C >= 15 && B >= 8){
    cout << "1" << endl;
  }
  else if(C >=10 && B >= 3){
    cout << "2" << endl;
  }
  else if(C >= 3){
    cout << "3" << endl;
  }
  else{
    cout << "4" << endl;
  }
}
