#Ritika Allada
import math
def f(num):
    primes = []
    for i in range(2, int(math.sqrt(num))):
        while(num%i==0):
            primes.append(i)
            num=num/i
        i+=1
    if num>2:
        primes.append(num)
    primes = list(set(primes))
    count = 0
    for p in primes:
        count+=1
    return count
def transform(n,p):
    digits = [int(d) for d in n]
    digitsR = digits[::-1]
    intN = int(n)
    p1 = int(p)-1
    num = digitsR[p1]
    arr = []
    x = len(digits)-p1-1
    for i in range(x):
        arr.append(digits[i]+num)
    arr.append(f(intN))
    right = []
    for i in range(p1):
        right.append(abs(digitsR[i]-num))
    right2 = right[::-1]
    for r in right2:
        arr.append(r)
    s = ""
    for a in arr:
        s+=str(a)
    return s
nums = []
for l in open('1sr_testdata.txt','r').readlines():
    nums.append(l.strip().split(" "))
i = 1
for n in nums:
    x = transform(n[0], n[1])
    print(str(i)+"."+ " " + x)
    i+=1