S = input() N = int(input()) def replace(S, n): if n == 0: return S ans = '' for c in S: if c.islower(): ans += chr((ord(c) - ord('a') + n) % 26 +ord('a')) elif c.isupper(): ans += chr((ord(c) - ord('A') + n) % 26 +ord('A')) return ans SN = '' for c in S: if c.isalpha(): SN += replace(c, N) else: if 9 - int(c) >= N: SN += chr(ord(c) + N) else: SN += replace('CpCzNkSuTbEoA', N - (10 - int(c))) print(SN)