#include #include #include using namespace atcoder; using mint = modint998244353; using namespace std; #define rep(i,n) for (int i = 0; i < (n); ++i) #define Inf32 1000000001 #define Inf64 1000000000000000001 int main(){ long long N,K; cin>>N>>K; K--; vector c; c.push_back(1); while(N!=0){ long long cur = N%10; N /= 10; c.push_back(c.back() * (cur+1)); } long long t = 1; long long ans = 0; rep(i,c.size()){ while(K>0){ if(i+1!=c.size() && K%c[i+1]==0)break; K -= c[i]; ans += t; } t *= 10; } cout<