#include <iostream>
#include <vector>
#include <string>
using namespace std;
vector<string> litery = {
"", "", "ABC", "DEF", "GHI", "JKL", "MNO", "PQRS", "TUV", "WXYZ"
};
int main() {
string numer_telefonu;
int K;
cin >> numer_telefonu >> K;
vector<string> grupy_liter;
for (char cyfra : numer_telefonu) {
grupy_liter.push_back(litery[cyfra - '0']);
}
string wynik;
int n = grupy_liter.size();
for (int i = 0; i < n; ++i) {
int rozmiar_grupy = grupy_liter[i].size();
int indeks = K % rozmiar_grupy;
wynik += grupy_liter[i][indeks];
K /= rozmiar_grupy;
}
cout << wynik << endl;
return 0;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgojaW5jbHVkZSA8dmVjdG9yPgojaW5jbHVkZSA8c3RyaW5nPgoKdXNpbmcgbmFtZXNwYWNlIHN0ZDsKCgp2ZWN0b3I8c3RyaW5nPiBsaXRlcnkgPSB7CiAgICAiIiwgICAgIiIsICAgICJBQkMiLCAiREVGIiwgIkdISSIsICJKS0wiLCAiTU5PIiwgIlBRUlMiLCAiVFVWIiwgIldYWVoiCn07CgppbnQgbWFpbigpIHsKICAgIHN0cmluZyBudW1lcl90ZWxlZm9udTsKICAgIGludCBLOwogICAgY2luID4+IG51bWVyX3RlbGVmb251ID4+IEs7CgogICAgCiAgICB2ZWN0b3I8c3RyaW5nPiBncnVweV9saXRlcjsKICAgIGZvciAoY2hhciBjeWZyYSA6IG51bWVyX3RlbGVmb251KSB7CiAgICAgICAgZ3J1cHlfbGl0ZXIucHVzaF9iYWNrKGxpdGVyeVtjeWZyYSAtICcwJ10pOwogICAgfQogICAgCiAgICBzdHJpbmcgd3luaWs7CiAgICBpbnQgbiA9IGdydXB5X2xpdGVyLnNpemUoKTsKICAgIAogICAgCiAgICBmb3IgKGludCBpID0gMDsgaSA8IG47ICsraSkgewogICAgICAgIGludCByb3ptaWFyX2dydXB5ID0gZ3J1cHlfbGl0ZXJbaV0uc2l6ZSgpOwogICAgICAgIGludCBpbmRla3MgPSBLICUgcm96bWlhcl9ncnVweTsKICAgICAgICB3eW5payArPSBncnVweV9saXRlcltpXVtpbmRla3NdOwogICAgICAgIEsgLz0gcm96bWlhcl9ncnVweTsKICAgIH0KICAgIAogICAgY291dCA8PCB3eW5payA8PCBlbmRsOwogICAgcmV0dXJuIDA7Cn0K