import collections s = input() n = int(input()) trans = [None]*256 trans[ord('9')] = [ord(c) for c in 'CpCzNkSuTbEoA'] trans[ord('z')] = [ord('a')] trans[ord('Z')] = [ord('A')] for i in range(9): trans[ord(str(i))] = [ord(str(i+1))] ord_a = ord('a') ord_A = ord('A') for i in range(25): trans[ord_a+i] = [ord_a+i+1] trans[ord_A+i] = [ord_A+i+1] deq = collections.deque([ord(c) for c in s]) loop = n if n<=9 else 10 + (n-10)%26 for _ in range(n): for _ in range(len(deq)): deq.extend(trans[deq.popleft()]) print(*[chr(code) for code in deq],sep='')