with open("1int_testdata.txt") as q:
    a=q.readline()
    
    while a:        
        wula = a;
        afters= wula.split(" ") ;
        n=(afters[0]);
        #print(n)
        p=int(afters[1] );
        #print(p);
        a=q.readline()
        nc=n[-p]
        #print(nc)
        h=int(nc)
        (nc)
        front=n[0:-p]
        #print(front)
        back=n[-p+1:]
        l=list(front)
        k=list(back)
        m=list(n)
        if l==m:
            l=l[0:0]
            #print(l)
        else:
            l=l
        if k==m:
            k=k[0:0]
            #print(k)
        else:
            k=k
        
        strfront=list(front)
        strback=list(back)
        #print(strfront)
        #print(strback)

        rf=map(int,l)
        #print(rf)

        rb=map(int,k)
        #print(rb)

        
        ffront=[i+h for i in rf]
        #print(ffront)
        lastfront=[i%10 for i in ffront]
        #print(list(lastfront))
        
        fgh = [str(x) for x in lastfront]
        #print(fgh)
        

        fback=[i-h for i in rb]
        #print(fback)
        lastback = map(abs, fback) 
        #print(list(lastback))

        abc = [str(x) for x in lastback]
        #print(abc)
        
        content = "".join(fgh)
        #print (content)
        content = "".join(abc)
        #print (content)

        rn=[str(x) for x in nc]
        qwerty=fgh+rn+abc
        #print(qwerty)
        tyu=''.join(qwerty)
        print(tyu)