import sys input = lambda : sys.stdin.readline().rstrip() sys.setrecursionlimit(2*10**5+10) write = lambda x: sys.stdout.write(x+"\n") debug = lambda x: sys.stderr.write(x+"\n") s = input() n = int(input()) def sub(c,n=n): if c.isdigit(): if int(c)+n<=9: return str(int(c)+n) else: return "".join([sub(cc, n-(10-int(c))) for cc in "CpCzNkSuTbEoA"]) elif c.lower()==c: return chr((ord(c)-ord("a")+n)%26 + ord("a")) else: return chr((ord(c)-ord("A")+n)%26 + ord("A")) print("".join(map(sub, s)))