QOJ.ac

QOJ

実行時間制限: 1 s メモリ制限: 512 MB 満点: 100

#16494. Yumemi

統計

An unfamiliar emotion arises. Will you scold me for this?

Yuki has her own aesthetic for numbers.

Yuki considers a positive integer $x$ to be "kawaii" if and only if the product of the digits of $x$ in its decimal representation is no greater than $k$.

For example, when $k=11$, $521$ is kawaii because $5\times2\times1=10 < 11$, while $314$ is not kawaii because $3\times1\times4=12 > 11$.

Now Yuki has $n$ positive integers $a_1, \dots, a_n$, where $1 \le a_i \le 10^{10^5}$. You need to determine whether each of them is kawaii. Note that $10^{10^5} = 10^{100000}$.

Although $a_i$ can be extremely large, Yuki believes that this will not be a problem for someone as clever as you!

Input

The first line contains two positive integers $n$ and $k$.

The next $n$ lines each contain a positive integer $a_i$.

Output

Output $n$ lines, where the $i$-th line contains a string:

  • If $a_i$ is kawaii, output kawaii.
  • If $a_i$ is not kawaii, output dame.

Examples

Input 1

4 8
15
24
37
80

Output 1

kawaii
kawaii
dame
kawaii

Note

In this example, $n=4$ and $k=8$.

  • $15$ is kawaii because $1\times5=5 < 8$.
  • $24$ is kawaii because $2\times4=8 = 8$.
  • $37$ is not kawaii because $3\times7=21 > 8$.
  • $80$ is kawaii because $8\times0=0 < 8$.

Input 2

3 998244353
31415926535
9999999999
17320508075

Output 2

kawaii
dame
kawaii

Note

In this example, $n=3$ and $k=998244353$.

  • $31415926535$ is kawaii because the product of its digits in decimal representation is $486000$, which is less than $998244353$.
  • $9999999999$ is not kawaii because the product of its digits in decimal representation is $3486784401$, which is greater than $998244353$.
  • $17320508075$ is kawaii because the product of its digits in decimal representation is $0$, which is less than $998244353$.

Input 3

(See problem attachments)

Output 3

(See problem attachments)

Note

This sample satisfies the constraints for test case 4.

Input 4

(See problem attachments)

Output 4

(See problem attachments)

Note

This sample satisfies the constraints for test case 7.

Input 5

(See problem attachments)

Output 5

(See problem attachments)

Note

This sample satisfies the constraints for test case 10.

Constraints

For all test data:

  • $1 \le n \le 20$
  • $1 \le k \le 10^9$
  • $1 \le a_i \le 10^{10^5}$
Test Case ID $a_i \le$ $k \le$ Special Property
$1$ $9$ $9$ Yes
$2\sim3$ $10^9$ $10^9$ Yes
$4\sim6$ $10^9$ $10^9$ No
$7$ $10^{18}$ $10^9$ Yes
$8$ $10^{18}$ $10^9$ No
$9$ $10^{10^5}$ $10^9$ Yes
$10$ $10^{10^5}$ $10^9$ No

Special Property: $a_i$ is guaranteed not to contain the digit $0$ in its decimal representation.

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.