#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(isalpha(s[i]-n))cout<<char(s[i]-n);
        else if(s[i]>='a' and s[i]<='z') cout<<char('z'-(('z'-(s[i]-n))%26)+1);
        else cout<<char('Z'-(('A'-(s[i]-n))%26)+1);
    }
    cout<<endl;
}
