S = input() N = int(input()) def replace(S, n): 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) + 1) else: SN += replace('CpCzNkSuTbEoA', N - (9 - int(c))) print(SN)