#include <bits/stdc++.h>
#define endl '\n'
using namespace std;

int n;

char func (char ch)
{
    int i;
    if (isupper(ch)) i = (int)(ch - 'A' + 1);
    else i = (int)(ch - 'a' + 1);
    if (n > 0)
    {
        i = i - n;
    }
    else
    {
        i = i + n;
    }
    if (i <= 0)
    {
        i = 26 + i;
        if (isupper(ch)) return (char)(i + 'A' - 1);
        else return (char)(i + 'a' - 1);
    }
    if (i >= 26)
    {
        i = i % 26;
        if (isupper(ch)) return (char)(i + 'A' - 1);
        else return (char)(i + 'a' - 1);
    }
}

int main ()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);

    string s;
    getline(cin, s);
    cin >> n;
    if (n == 0)
        cout << s << endl;

    n = n % 26;
    int m = s.size();
    for (int i = 0; i < m; i++)
    {
        if (isalpha(s[i]))
        {
            s[i] = func(s[i]);
        }
    }
    cout << s << endl;
}
