Buggy python submission (verdict: Runtime Error):
s = raw_input()
k = input()

def solve(s, k, i):
    if i == len(s)-1:
        # print "equal"
        t = ord(s[i])+k
        if t > ord("z"):
            t -= ord("a")
            t %= (ord("z")-ord("a") + 1)
            t += ord("a")
        s = s[:i] + chr(t)
        return s
        # print s, k
    elif s[i] != "a" and ord(s[i]) + k > ord("z"):
        # print "carry"
        k = k - ord("z") + ord(s[i]) -1
        s = s[:i] + "a" + s[i+1:]        
        # print s,k
    return solve(s,k,i+1)
    
print solve(s,k,0)

Fixed submission:
s = raw_input()
k = input()
i = 0
while True:
    if i == len(s)-1:
        # print "equal"
        t = ord(s[i])+k
        if t > ord("z"):
            t -= ord("a")
            t %= (ord("z")-ord("a") + 1)
            t += ord("a")
        s = s[:i] + chr(t)
        print s
        exit()
        # print s, k
    elif s[i] != "a" and ord(s[i]) + k > ord("z"):
        # print "carry"
        k = k - ord("z") + ord(s[i]) -1
        s = s[:i] + "a" + s[i+1:]        
        # print s,k
    i += 1

Buggy python submission (verdict: Runtime Error):
s = raw_input()
k = input()

def solve(s, k, i):
    if i >= len(s):
        # print "over"
        return s
    if i == len(s)-1:
        # print "equal"
        t = ord(s[i])+k
        if t > ord("z"):
            t -= ord("a")
            t %= (ord("z")-ord("a") + 1)
            t += ord("a")
        s = s[:i] + chr(t)
        # print s, k
    elif ord(s[i]) + k > ord("z"):
        # print "carry"
        k = k - ord("z") + ord(s[i]) -1
        s = s[:i] + "a" + s[i+1:]        
        # print s,k
    return solve(s,k,i+1)
    
print solve(s,k,0)

Fixed submission:
s = raw_input()
k = input()
i = 0
while True:
    if i == len(s)-1:
        # print "equal"
        t = ord(s[i])+k
        if t > ord("z"):
            t -= ord("a")
            t %= (ord("z")-ord("a") + 1)
            t += ord("a")
        s = s[:i] + chr(t)
        print s
        exit()
        # print s, k
    elif s[i] != "a" and ord(s[i]) + k > ord("z"):
        # print "carry"
        k = k - ord("z") + ord(s[i]) -1
        s = s[:i] + "a" + s[i+1:]        
        # print s,k
    i += 1

Buggy python submission (verdict: Time Limit Exceeded):
s = raw_input()
k = input()

def solve(s, k, i):
    if i >= len(s):
        # print "over"
        return s
    if i == len(s)-1:
        # print "equal"
        t = ord(s[i])+k
        if t > ord("z"):
            # n = (ord("z") - ord("a") + 1)/(t - ord("z"))
            # t = t - (ord("z")-ord("a"))*n
            while t > ord("z"):
                t -= (ord("z") - ord("a") + 1)
        s = s[:i] + chr(t)
        # print s, k
    elif ord(s[i]) + k > ord("z"):
        # print "carry"
        k = k - ord("z") + ord(s[i]) -1
        s = s[:i] + "a" + s[i+1:]        
        # print s,k
    return solve(s,k,i+1)
    
print solve(s,k,0)

Fixed submission:
s = raw_input()
k = input()
i = 0
while True:
    if i == len(s)-1:
        # print "equal"
        t = ord(s[i])+k
        if t > ord("z"):
            t -= ord("a")
            t %= (ord("z")-ord("a") + 1)
            t += ord("a")
        s = s[:i] + chr(t)
        print s
        exit()
        # print s, k
    elif s[i] != "a" and ord(s[i]) + k > ord("z"):
        # print "carry"
        k = k - ord("z") + ord(s[i]) -1
        s = s[:i] + "a" + s[i+1:]        
        # print s,k
    i += 1

Buggy python submission (verdict: Runtime Error):
s = raw_input()
k = input()

def solve(s, k, i):
    if i >= len(s):
        # print "over"
        return s
    if i == len(s)-1:
        # print "equal"
        t = ord(s[i])+k
        if t > ord("z"):
            t -= (ord("z") - ord("a")+1)
        s = s[:i] + chr(t)
        # print s, k
    elif ord(s[i]) + k > ord("z"):
        # print "carry"
        k = k - ord("z") + ord(s[i]) -1
        s = s[:i] + "a" + s[i+1:]        
        # print s,k
    return solve(s,k,i+1)
    
print solve(s,k,0)

Fixed submission:
s = raw_input()
k = input()
i = 0
while True:
    if i == len(s)-1:
        # print "equal"
        t = ord(s[i])+k
        if t > ord("z"):
            t -= ord("a")
            t %= (ord("z")-ord("a") + 1)
            t += ord("a")
        s = s[:i] + chr(t)
        print s
        exit()
        # print s, k
    elif s[i] != "a" and ord(s[i]) + k > ord("z"):
        # print "carry"
        k = k - ord("z") + ord(s[i]) -1
        s = s[:i] + "a" + s[i+1:]        
        # print s,k
    i += 1