ALCHE - Alchemy

no tags 

Alchemy is a discipline that is believed to span at least 2500 years of human history. It is most known for its intention of transforming matter, typically trying to come up with a recipe to make gold based on much less valued metals, aided by some non-metal components.

Most scientists and scholars think that alchemy has failed. They surely do not know that a particular alchemist named Albert Ainstain, managed to create gold from a simple combination of ordinary iron (much more common and cheap than gold) and some good- old-fashioned water. However, the combination must have the exact proportion of grams of iron and centiliters of water to work, otherwise the alchemist would end up with useless rusty iron.

Many alchemists and businessman had tried to recreate Albert Ainstain’s findings to achieve recognition, fame, prestige or economical welfare, but none of them have succeeded. Since you know very little about chemistry, alchemy and ancient practices, you believe that your chances for success in this task are bounded to using a computer in your benefit. Therefore, you decide to create a program that automatically tests a given combination of iron and water, and informs whether that combination has the correct proportion to produce gold. Of course, once you find the right proportion, you can double both amounts and get double the gold, cut both in half and get half the gold, or multiply both by any other real number to obtain the amount of gold you want. Your task is then, given the number of grams of iron and the number of centiliters of water, say whether the proportion between both components is the right one.

Input

The input contains several test cases, each one described in a single line. The line contains two integers I and W separated by a single space, representing grams of iron and centiliters of water, respectively (1 ≤ I, W ≤ 106). The last line of the input contains the number −1 twice separated by a single space and should not be processed as a test case.

Output

For each test case output a single line containing an uppercase “Y” if the combination produces gold, or an uppercase “N” otherwise.

Example

Input:
1000 37
999 37
10000 370
10001 370
-1 -1

Output:
Y
N
Y
N

hide comments
aayush: 2011-06-29 13:03:26

for aal those who r getting WA correct proportion is (1000/37)

Santiago Zubieta: 2011-06-03 19:52:27

This is very weird. I got ACC using CIN/COUT
then I wanted to try getting it with less run time, and all I did was change to SCANF/PRINTF (which are supposed to be faster) and I get TLE...

Parag gupta: 2011-05-16 14:24:10

can someone explain what is criteria for yes ?


Gaurav: 2011-05-10 19:14:47

yeah....just look at the first test case

Last edit: 2011-05-10 19:15:14
nagesh: 2011-05-02 07:29:59

finally AC :D .....

saurabh kumar jha: 2011-03-21 22:54:22

does the first input always have the output Y

Ade Tanizar: 2010-11-20 17:11:51

Help me. When i'm using FPC, i cannot put two condition into 'while',,how can i solve this?

Mauricio Bellalbero: 2010-10-07 22:02:55

what does DT mean?

PRATEEK KHURANA: 2010-10-06 04:33:18

i tried to derive some possible conclusions from this question, but all gave me wrong answers.. kindly help

numerix: 2010-10-03 20:07:00

You have to conclude this from the given example.


Added by:Pablo Ariel Heiber
Date:2010-08-22
Time limit:1s
Source limit:50000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Languages:All except: NODEJS OBJC PERL6 VB.NET
Resource:FCEyN UBA ICPC Selection 2009