import string alphs = list(string.ascii_lowercase) Alphs = list(string.ascii_uppercase) T = "CpCzNkSuTbEoA" S = list(input()) n = int(input()) m = len(S) ANS = [] for i in range(m): if ord('0') <= ord(S[i]) <= ord('9'): num = ord('9') - ord(S[i]) + 1 if n >= num: cnt = n - num for s in T: if s.islower(): ANS.append(alphs[(ord(s) - ord('a') + cnt) % 26]) elif s.isupper(): ANS.append(Alphs[(ord(s) - ord('A') + cnt) % 26]) else: cnt = n ANS.append(str(int(S[i]) + cnt)) else: cnt = n s = S[i] if s.islower(): ANS.append(alphs[(ord(s) - ord('a') + cnt) % 26]) elif s.isupper(): ANS.append(Alphs[(ord(s) - ord('A') + cnt) % 26]) print(''.join(ANS))