#include<bits/stdc++.h>
using namespace std;
#define endl '\n'
string s;
long long n;
void ceasar();
int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(nullptr);
    cout.tie(nullptr);
    getline(cin,s);
    cin>>n;
    ceasar();
    return 0;
}
void ceasar()
{
    for(int i=0; i<s.size(); i++)
    {
        if(!isalpha(s[i])) cout<<s[i];
        else if((s[i]>='a' and s[i]<='z') and s[i]-n>='a' and s[i]-n<='z') cout<<char(s[i]-n);
        else if((s[i]>='A' and s[i]<='Z') and s[i]-n>='A' and s[i]-n<='Z') cout<<char(s[i]-n);
        else if(s[i]>='a' and s[i]<='z') cout<<char('z'-(('a'-(s[i]-n))%26)+1);
        else if(s[i]>='A' and s[i]<='Z') cout<<char('Z'-(('A'-(s[i]-n))%26)+1);
    }
    cout<<endl;
}
/*
aSWQsA
7
*/
