1508 -- Fair Number
Time Limit :1000 MS Memory Limit :65536 KB
Accepts : 121 Submits : 367
User Accepts : 118 User Submits : 138
<Submit>   <Statistics>   <Discuss>

Description

If a hexadecimal integer (without leading 0),the sum of the former half number is equal to the sum of the latter half number,we call it a fair number. If the integer contains the odd numbers,then the middle of the integer neither fall within the first half,nor fall within the latter half.
For example,hexadecimal number 1DE77 is a fair number,since 1 + D = 7 + 7,while the number of E is not involved in the calculation.
All single-digit hexadecimal numbers (ie 0 ~ F) are fair numbers,but not F0 (F0 can not be written in 0F0).
Input a hexadecimal integer to determine whether this number is a fair number.

Input

There will be multiple test cases.Each line of input contains a hexadecimal integer n (the number of bits is less than 1000).And the last line of 0 means the end of input which should not be processed.

Output

For each test case output a line,if the input hexadecimal number n is a fair number then output "Y",otherwise output "N".

Sample Input

F0
1DE77
0

Sample Output

N
Y

Source

Hunan University
<Submit>   <Statistics>   <Discuss>
 


Powered by Zhang Zhaoning PDL College of Computer
Since 2006.03.09 | 2007.11.22 | 2010.03.02 Copyright (r) 2006 - 2010 All Rights Reserved