s=input() n=int(input()) cnt1=["CpCzNkSuTbEoA"] for i in range(150): ans="" s1=cnt1[-1] for j in range(len(s1)): a=ord(s1[j]) if a<92: ans+=chr(65+(a-65+1)%26) else: ans+=chr(97+(a-97+1)%26) cnt1.append(ans) ans="" m=n%26 k=n%10 for i in range(len(s)): a=ord(s[i]) if a<65: if int(s[i])+n>9: ans+=cnt1[int(s[i])+n-10] else: ans+=str((int(s[i])+k)%10) elif a<92: ans+=chr(65+(a-65+m)%26) else: ans+=chr(97+(a-97+m)%26) print(ans)