s = input()
n = int(input())
ans = ""
for i in s:
    if i.isdigit():
        if (n - (10 - int(i))) < 0:
            ans += str(int(i) + n)
        else:
            now = "CpCzNkSuTbEoA"
            shift = (n - (10 - int(i))) % 26
            new = ""
            for j in now:
                if j.islower():
                    new += chr((ord(j) - ord("a") + shift) % 26 + ord("a"))
                else:
                    new += chr((ord(j) - ord("A") + shift) % 26 + ord("A"))
            ans += new
    elif i.islower():
        shift = n % 26
        ans += chr((ord(i) - ord("a") + shift) % 26 + ord("a"))
    else:
        shift = n % 26
        ans += chr((ord(i) - ord("A") + shift) % 26 + ord("A"))
print(ans)