#include<bits/stdc++.h>

using namespace std;
#define ll long long
#define ull unsigned long long
#define i128 __int128
#define mp make_pair
#define mt make_tuple
#define ld long double
#define VNAME(name) (#name)
typedef pair<int, int> pii;
typedef priority_queue<int, vector<int>, greater<int> > small_heap;
typedef priority_queue<int> big_heap;
typedef tuple<int, int, int> mkgroups;

void debug_out() { cout << '\n'; }

template<typename T, typename... R>
void debug_out(const T &f, const R &... r) {
    cout << f << " ";
    debug_out(r...);
}

template<typename A, typename B>
ostream &operator<<(ostream &out, const pair<A, B> &a) {
    out << "(" << a.first << "," << a.second << ")";
    return out;
}

template<typename Tuple, size_t N>
struct tuple_print {
    static void print(const Tuple &t, std::ostream &os) {
        tuple_print<Tuple, N - 1>::print(t, os);
        os << ", " << std::get<N - 1>(t);
    }
};

template<typename Tuple>
struct tuple_print<Tuple, 1> {
    static void print(const Tuple &t, std::ostream &os) { os << "(" << std::get<0>(t); }
};

template<typename... Args>
ostream &operator<<(ostream &os, const tuple<Args...> &t) {
    tuple_print<decltype(t), sizeof...(Args)>::print(t, os);
    return os << ")";
}

template<typename T>
ostream &operator<<(ostream &out, const vector<T> &a) {
    out << "[";
    bool first = true;
    for (auto &v : a) {
        out << (first ? "" : ", ");
        out << v;
        first = 0;
    }
    out << "]";
    return out;
}

template<typename T, class Cmp>
ostream &operator<<(ostream &out, const set<T, Cmp> &a) {
    out << "{";
    bool first = true;
    for (auto &v : a) {
        out << (first ? "" : ", ");
        out << v;
        first = 0;
    }
    out << "}";
    return out;
}

template<typename U, typename T, class Cmp>
ostream &operator<<(ostream &out, const map<U, T, Cmp> &a) {
    out << "{";
    bool first = true;
    for (auto &p : a) {
        out << (first ? "" : ", ");
        out << p.first << ":" << p.second;
        first = 0;
    }
    out << "}";
    return out;
}

template<typename Arg1>
void __f(const char *name, Arg1 &&arg1) { cerr << name << ": " << arg1 << endl; }

template<typename Arg1, typename... Args>
void __f(const char *names, Arg1 &&arg1, Args &&... args) {
    const char *comma = strchr(names + 1, ',');
    cerr.write(names, comma - names) << ": " << arg1 << " |";
    __f(comma + 1, args...);
}


const int N = 1e6 + 100;
int T;
ll mod, m, n;

ll ksm(ll a, ll b) {
    ll c = 1;
    for (; b; b >>= 1) {
        if (b & 1) c = (ll) c * a % mod;
        a = (ll) a * a % mod;
    }
    return c;
}

int main() {
    cin >> n >> m;
    mod = m * m;
    ll ans = ksm(10ll, n);
    cout << ans / m;
    return 0;
}
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(ll i=0;i<n;i++)
#define repl(i,l,r) for(ll i=(l);i<(r);i++)
#define per(i,n) for(ll i=n-1;i>=0;i--)
#define perl(i,r,l) for(ll i=r-1;i>=l;i--)
#define fi first
#define se second
#define pb push_back
#define mkp make_pair
#define ins insert
#define pqueue(x) priority_queue<x,vector<x>,greater<x>>
#define all(x) (x).begin(),(x).end()
#define CST(x) cout<<fixed<<setprecision(x)
#define vtpl(x,y,z) vector<tuple<x,y,z>>
#define rev(x) reverse(x);
#define lin(x) ll x; cin>>x;
#define stin(x) string x; cin>>x;
#define yn(x)  if(x) {  cout<<"Yes"<<endl;   }    else {    cout<<"No"<<endl;   }
#define YN(x)  if(x) {  cout<<"YES"<<endl;   }    else {    cout<<"NO"<<endl;   }
#define co(x) cout<<x<<endl;
using ll=long long;
using ld=long double;
using vl=vector<ll>;
using vvl=vector<vector<ll>>;
using pl=pair<ll,ll>;
using vpl=vector<pl>;
using vvpl=vector<vpl>;
const ll mod=1000000007;
const ll MOD9=998244353;
const int inf=1e9+10;
const ll INF=4e18;
const ll dy[8]={1,0,-1,0,1,1,-1,-1};
const ll dx[8]={0,-1,0,1,1,-1,1,-1};
template <typename T> inline bool chmax(T &a, T b) {
    return ((a < b) ? (a = b, true) : (false));
}
template <typename T> inline bool chmin(T &a, T b) {
    return ((a > b) ? (a = b, true) : (false));
}
ll powmod(ll n, ll k, ll m) {
ll r=1;
 for(; k>0; k >>=1) {
   if(k&1) r=(r*n)%m;
   n=(n*n)%m;
 }
  return r;
}

ll fact(ll n) {
ll a=1;
rep(i,n) {
a=a*(n-i);
}
return a;
}

ll pow(ll a, ll b) {
ll x=1;
rep(i,b) {
x=x*a;
}
return x;
}

int main() {
lin(N);
  lin(M);
  ll x=powmod(10,N,M*M);
  ll y=(x/M)%M;
  co(y);
}
 