#include<bits/stdc++.h>
using namespace std;
string codecap = "ABCDEFGHIGKLMNOPQRSTUVWXYZ";
string codenotcap = "abcdefghijklmnopqrstuvwxyz";
string sent = "";
string decoded = "";
int n;
 int checkifcont(string a, char b)
 {
     for(int i = 0; i < a.size(); i++)
     {
         if(a[i] == b)
         {
             return 1;
         }
     }
     return 0;
 }
int decodeletter(char letter)
{
    int a;
    char c;
    if(checkifcont(codecap, letter) == 1)
    {
        a = codecap.find(letter);
        c = codecap[(((26 + (a + 1 + n)) % 26) - 1 + 26) % 26];
    }
    else if(checkifcont(codenotcap, letter) == 1)
    {
        a = codenotcap.find(letter);
        c = codenotcap[(((26 + (a + 1 + n)) % 26) - 1 + 26) % 26];
    }
    else
    {
        c = letter;
    }

        decoded = decoded + c;
}
int main()
{
    getline(cin, sent);
    cin >> n;
    n = n-(2*n);
    for(int i = 0; i < sent.size(); i++)
    {
        decodeletter(sent[i]);
    }
    cout<<decoded;
    return 0;
}
