s=eval(input())

k=int(eval(input()))

n=len(s)

num=[0]*n

for i in range(n):

    if s[i]!="a":

        num[i]=123-ord(s[i])

if sum(num)>=k:

    ans=""

    for i in range(n-1):

        if k>=num[i]:

            k-=num[i]

            ans+="a"

        else:

            ans+=s[i]

    if k>=num[-1]:

        ans+="a"

    else:

        ans+=chr(97+((ord(s[-1])-97+k)%26))

else:

    k-=sum(num)

    ans="a"*(n-1)

    ans+=chr(97+(k%26))

print(ans)

s=eval(input())

k=int(eval(input()))

num=[(123-ord(s[i]))%26 for i in range(len(s))]

ans=""

for i in range(len(s)-1):

    if num[i]<=k:

        ans+="a"

        k-=num[i]

    else:

        ans+=s[i]

k%=26

if num[-1]<=k:

    ans+=chr(97+k-num[-1])

else:

    ans+=chr(ord(s[-1])+k)

print(ans)

s = eval(input())
k = int(eval(input()))
n = len(s)
num = [0] * n
for i in range(n):
    if s[i] != "a":
        num[i] = 123 - ord(s[i])
if sum(num) >= k:
    ans = ""
    for i in range(n - 1):
        if k >= num[i]:
            k -= num[i]
            ans += "a"
        else:
            ans += s[i]
    if k >= num[-1]:
        ans += "a"
    else:
        ans += chr(97 + ((ord(s[-1]) - 97 + k) % 26))
else:
    k -= sum(num)
    ans = "a" * (n - 1)
    ans += chr(97 + (k % 26))
print(ans)

s = eval(input())
k = int(eval(input()))
num = [(123 - ord(s[i])) % 26 for i in range(len(s))]
ans = ""
for i in range(len(s) - 1):
    if num[i] <= k:
        ans += "a"
        k -= num[i]
    else:
        ans += s[i]
k %= 26
if num[-1] <= k:
    ans += chr(97 + k - num[-1])
else:
    ans += chr(ord(s[-1]) + k)
print(ans)

-n = len(s) -num = [0] * n -for i in range(n): -    if s[i] != "a": -        num[i] = 123 - ord(s[i]) -if sum(num) >= k: -    ans = "" -    for i in range(n - 1): -        if k >= num[i]: -            k -= num[i] -            ans += "a" -        else: -            ans += s[i] -    if k >= num[-1]: +num = [(123 - ord(s[i])) % 26 for i in range(len(s))] +ans = "" +for i in range(len(s) - 1): +    if num[i] <= k: +        k -= num[i] -        ans += chr(97 + ((ord(s[-1]) - 97 + k) % 26)) +        ans += s[i] +k %= 26 +if num[-1] <= k: +    ans += chr(97 + k - num[-1]) -    k -= sum(num) -    ans = "a" * (n - 1) -    ans += chr(97 + (k % 26)) +    ans += chr(ord(s[-1]) + k)