#include <bits/stdc++.h>
using namespace std;
int push;
char decode(char letter, int push){
    if(!(('a'<=letter && letter<='z') || ('A'<=letter && letter<='Z'))) return letter;
    char ans;
    bool uppercase;
    if('a'<=letter && letter<='z') {
        ans = 'a'+(letter-'a'-push)%26;
        uppercase = false;
    }
    else {
        ans ='A'+(letter-'A'+push)%26;
        uppercase = true;
    }
    if((ans<'A' && uppercase) || (ans<'a' && !uppercase)) ans+=26;
    return ans;
}
int main(){
    string word;
    getline(cin, word);
    cin>>push;
    for(int i=0; i<word.size(); i++) word[i]=decode(word[i], push);
    cout<<word<<"\n";
    return 0;
}
