#include <iostream>
#include <map>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <sstream>
#include <cmath>
#include <math.h>
#include <string>
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(n) for( int i = 0 ; i < n ; i++ )
#define REP(n) for( int i = 1 ; i <= n ; i++ )
#define repll(n) for( ll i = 0 ; i < n ; i++ )
#define REPll(n) for( ll i = 1 ; i <= n ; i++ )
#define rep2(n) for( int j = 0 ; j < n ; j++ )
#define REP2(n) for( int j = 1 ; j <= n ; j++ )
#define repll2(n) for( ll j = 0 ; j < n ; j++ )
#define REPll2(n) for( ll j = 1 ; j <= n ; j++ )

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n , w;
    cin >> n >> w;
    cout << n / w;
}
#include<iostream>
#include<cmath>
using namespace std;
typedef long long ll;
ll fastpow(ll x,ll y,ll p){
    ll res=1,tmp=x;
    while(y){
        if(y&1){
            res=res*tmp%p;
        }
        tmp=tmp*tmp%p;
        y>>=1;
    }
    return res;
}
int main(){
    ll n,m;
    cin>>n>>m;
    cout<<int(floor(fastpow(10,n,m*m)/m))%m<<endl;
    return 0;
}