#include<bits/stdc++.h>
using namespace std;
vector<int> res,x;
vector<int> ride(vector<int> x,int b)
{
int t=0;
reverse(x.begin(),x.end());
for(int i=0;i<x.size();i++)
t+=x[i]*b,res.push_back(t%10),t/=10;
if(t)res.push_back(t);
return res;
}
int main()
{
string a;
int b;
cin>>a>>b;
if(b==0)return cout<<0,0;//记住一个数乘0,还是0
for(int i=0;i<a.size();i++)x.push_back(a[i]-'0');
ride(x,b);
for(int i=res.size()-1;i>=0;i--)
cout<<res[i];
return 0;
}