outputs=""
for i in range(5):
    output=""
    temp=input().split()
    num=int(temp[0])
    digit=len(temp[0])-int(temp[1])
    each_digit=list(temp[0])
    for j in range(len(each_digit)):
        if j1:
                if div>num**0.5:
                    pf=pf+1
                    break
                count=0
                while num/div==num//div:
                    num=num//div
                    count=count+1
                if count>0:
                    pf=pf+1
                div=div+1
            output=output+str(pf)
        elif j>digit:
            output=output+str(abs(int(each_digit[j])-int(each_digit[digit])))
    outputs=outputs+str(i+1)+". "+output
    if i<4:
        outputs=outputs+"\n"
print(outputs)