#BBAD. Breaking Math

Breaking Math

Walter is a high school chemistry teacher. After being diagnosed with stage 3A, inoperable lung cancer, Walter is devastated. Realizing he does not have much time left, a desperate Walter resorts to cooking crystal methamphetamine, in order to provide for his treatment and family. And guess what, he mixes up with some really horrible people in the process.

The worst of them is Heisenburg, a badass physicist and the ultimate drug lord. Walter needs Heisenburg’s active support to distribute the methamphetamine he produces. Alas, Heisenburg is a cautious man. Heisenburg is initially skeptical about Walter, and decides to give the following problem to Walter in order to prove his worth.

w(n) is defined to be the number of distinct prime factors of n, for example:

w(1) = 0, w(2) = 1, w(3) = 1, w(4) = 1, w(5) = 1, w(6) = 2, w(30) = 3

f(n, k) = ∑ kw(i) where 1 ≤ i ≤ n

For instance, f(6,2) = 2w(1) + 2w(2) + 2w(3) + 2w(4) + 2w(5) + 2w(6) = 13

Given n and k, calculate f(n, k).

Input

The first line contains an integer t, denoting the number of test cases. Each of the next t lines contains two integers, n and k, separated by a single space. Sum of n will not exceed 1011 in an input file.

Constraints

  • 1 ≤ t ≤ 100
  • 1 ≤ n ≤ 1011
  • 1 ≤ k ≤ 10
  • 1 ≤ ∑n ≤ 1011
  • Output

    For each case, output a line of the format Case X: Y, where X is the case number, starting from 1, and Y is the required answer. You can safely assume that the answer will fit in a signed 64 bit integer.

    Sample Input

    10
    1 1
    2 2
    3 3
    4 4
    5 5
    6 6
    7 7
    8 8
    9 9
    10 10
    

    Sample Output

    Case 1: 1
    Case 2: 3
    Case 3: 7
    Case 4: 13
    Case 5: 21
    Case 6: 61
    Case 7: 85
    Case 8: 113
    Case 9: 145
    Case 10: 271