#include <iostream>
#include <string>

int main() {
    std::string value = std::string();
    std::cin >> value;
    int offset;
    std::cin >> offset;
    offset = offset % 26 - 'A';
    for (char& c : value) {
        if (c > 'Z' || c < 'A') {
            continue;
        }
        c = (c + offset) % 26 + 'A';
    }
    std::cout << value << '\n';
}
