#include #include #include #include #include #include #include #include using namespace std; #pragma warning (disable: 4996) string S; long long N, rem; string solve(string T) { string U = ""; for (int i = 0; i < T.size(); i++) { if (T[i] == '9') U += "CpCzNkSuTbEoA"; else if (T[i] == 'Z') U += "A"; else if (T[i] == 'z') U += "a"; else U += (T[i] + 1); } return U; } int main() { cin >> S >> N; rem = N; for (int i = 0; i < min(10LL, N); i++) { rem--; S = solve(S); } for (int i = 0; i < S.size(); i++) { if (S[i] >= 'A' && S[i] <= 'Z') { long long nex = (S[i] - 'A'); nex = (nex + rem) % 26LL; cout << (char)('A' + nex); } else if (S[i] >= '0' && S[i] <= '9') { cout << S[i]; } else { long long nex = (S[i] - 'a'); nex = (nex + rem) % 26LL; cout << (char)('a' + nex); } } cout << endl; return 0; }