#include <iostream>
#include <vector>
#include <cmath>
using namespace std;
int main(){
     int sum=0;
    cin>>t;
    if(t<0){
        cin>>t;
    }else(t>1,000,000,000,000,000,000){
        cin>> t;
    }
    cin>>n;
    for(int i=1;i<n;i++){
        while(i>0){
            int cifra=i%10;
            sum=sum*cifra;
            i=i/10;
        }
    }
    cout>>sum<<endl();
}