CF2043B Digits

题目描述

Artem wrote the digit $ d $ on the board exactly $ n! $ times in a row. So, he got the number $ dddddd \dots ddd $ (exactly $ n! $ digits). Now he is curious about which odd digits from $ 1 $ to $ 9 $ divide the number written on the board.

输入格式

Artem 在黑板上连续写了 $n!$ 次数字 $d$。所以,他得到了数字 $dddddd…ddd$(正好是 $n!$ 个数字)。 现在,他很好奇黑板上写的数字能够被从 $1$ 到 $9$ 的哪些奇数整除。 第一行包含一个整数 $t$ $(1 \le t \le 100)$,表示测试用例的数量。接下来是 $t$ 个测试用例。 每个测试用例由一行组成,包含两个整数 $n$ 和 $d$,$(2 \le n \le 10 ^ 9, 1 \le d \le 9)$。

输出格式

对于每个测试用例,按升序输出题目所求的奇数。 by ClV_Csy

说明/提示

The factorial of a positive integer $ n $ ( $ n! $ ) is the product of all integers from $ 1 $ to $ n $ . For example, the factorial of $ 5 $ is $ 1 \cdot 2 \cdot 3 \cdot 4 \cdot 5 = 120 $ .