#P9842. GCD Magic

    ID: 8064 传统题 5000ms 128MiB 尝试: 2 已通过: 2 难度: 8 上传者: 标签>CF2500数论莫比乌斯反演杜教筛组合数学2023“钉耙编程”中国大学生算法设计超级联赛(5)

GCD Magic

GCD Magic

Problem Description

Z is learning GCD theory and he finds a difficult problem:

i=1nj=1n[gcd(2i1,2j1)]K\sum_{i=1}^{n}\sum_{j=1}^{n}[\gcd(2^i-1,2^j-1)]^K

He doesn't know how to solve it, but he knows it's easy for you. Please help him. Since the answer can be very large, you only need to print the answer mod 998244353\text{mod}\ 998244353.

Input

The first line contains one integer T (1T12)T\ (1\le T\le 12) which represents the number of test cases. For each test case: One line contains two integers n (1n109)n\ (1\le n\le 10^9) and K (0K10)K\ (0\le K\le 10).

Output

For each test case: Print one line containing one integer which represents the answer.

Sample Input

3
3 1
3 2
3 3

Sample Output

17
65
377

Source

2023“钉耙编程”中国大学生算法设计超级联赛(5)