404244: GYM101466 I Math Class

Memory Limit:128 MB Time Limit:1 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

I. Math Classtime limit per test1 secondmemory limit per test128 megabytesinputstandard inputoutputstandard output

There are n (1 ≤ n ≤ 105) students numbered from 0 to n - 1, the favorite number of student i is fi (1 ≤ fi ≤ 109). Student i is friend of student j if and only if |i - j| ≤ k (1 ≤ k ≤ 20). The students will be divided in two math classes.

Class A is for palindromes lovers, so naturally, only students with a palindrome as a favorite number can take it. A number is palindrome if read from right to left is the same. So 1, 55, 121 and 1331 are palindromes and 10, 233 and 990 are not.

Class B is for superstitious people, so naturally, only students with a lucky number as a favorite number can take it. A number is lucky if it's formed by only digits 4 and 7. So 4, 7, 44, and 474477 are lucky numbers and 5, 40, 71 and 4474347 are not lucky numbers.

Your task is to find out if it's possible to split the students into classes A and B, so that every student is in exactly one class and every student has at least one friend on the same class.

Input

The first line has two integers n and k. The second line contains n space separated integers f0, f1, ..., fn - 1 the favorite number of each student. All numbers are given with no leading zeroes.

Output

Print "Yes" or "No", without quotes, whether or not is possible to split the students as stated above.

ExamplesInput
4 1
474 101 7 4
Output
Yes

Input
4 1
447 101 7 4
Output
No

Note

Note that one of the classes might be empty.

加入题单

上一题 下一题 算法标签: