1 #include<bits/stdc++.h>
2 #define ll long long
3 using namespace std;
4
5 ll n, m;
6
7 ll powmod(ll base, ll k, ll mod)
8 {
9 ll ans = 1;
10 while(k)
11 {
12 if(k & 1){
13 ans *= base % mod;
14 ans %= mod;
15 }
16 base *= base % mod;
17 base %= mod;
18 k >>= 1;
19 }
20 return ans;
21 }
22
23 int main(){
24 cin >> n >> m;
25 ll mod = m * m;
26
27 ll res = powmod(10ll, n, m * m);
28 res = res / m % m;
29 cout << res << endl;
30
31 return 0;
32 }
妙啊