
It is not well known that Cronerians also celebrate Thanksgiving as well! Today, Fax McClad, Croneria's most grateful bounty hunter, is celebrating by eating dinner with
The main course of the dinner is a giant space turkey (which his wingmate Flaco would strongly protest against eating). Fax is responsible for carving the space turkey into pieces for his family members to eat. Initially, the space turkey is in one giant piece. Fax can make
However, making an infinite number of cuts is too time-consuming, so Fax McClad will never form infinitely small pieces of space turkey.
Fax's family members are particularly picky! The
Input Specification
The first line of input will contain
For 40% of the points,
Output Specification
Output Y
if Fax can satisfy all of his guests and N
otherwise.
Sample Input 1
2 2
2
3
2
6
Sample Output 1
Y
Explanation for Sample Output 1
Fax can first cut the turkey into thirds. Then, he can take two of the thirds and cut each of them into half, giving one sixth of the turkey to the 2nd guest and 3 sixths (one half) of the turkey to the 1st guest.
Sample Input 2
2 2
2
3
2
5
Sample Output 2
N
Explanation for Sample Output 2
No matter how Fax cuts the turkey, he cannot form pieces that total to 1/5 of the turkey.
Note that Fax cannot cut the turkey into infinite pieces in order to give the 2nd guest 1/5 of the turkey.
Comments
The name should be "Fax's-giving Dinner"