------
## 最终结论
```python
def minDigit(x):
    return min(int(d) for d in str(x))

def maxDigit(x):
    return max(int(d) for d in str(x))

def calculate_aK(a1, K):
    current = a1
    for _ in range(K - 1):
        min_d = minDigit(current)
        max_d = maxDigit(current)
        if min_d == 0:
            break
        current += min_d * max_d
    return current

t = int(input().strip())
for _ in range(t):
    a1, K = map(int, input().strip().split())
    result = calculate_aK(a1, K)
    print(result)
```