#include<bits/stdc++.h>
using namespace std;
int main(){
int n,a,b,c,d,e,f;
cin>>n;
a=n%10*100000;
b=n/10%10*10000;
c=n/100%10*1000;
d=n/1000%10*100;
e=n/10000%10*10;
f=n/100000%10*1;
if(n==(a+b+c+d+e+f)) cout<<"Y";
else cout<<"N";
}
/**************************************************************
Problem: 1629
User: linzihang
Language: C++
Result: Accepted
Time:9 ms
Memory:2072 kb
****************************************************************/