#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()
{
    if(n>=0)
    {
        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);
        }
    }
    else
    {
        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((s[i]-n-'A')%26+'A');
            else cout<<char((s[i]-n-'a')%26+'a');
        }
    }
    cout<<endl;
}
/*
qwertyuiop      QWERTYUIOP
-5
aSWQsA
7
Ohw’v jr wr wkh flqhpd dw 21:30.
-3
*/
