program Zif_3_29_V(input,output);
var a:integer;
    otv:boolean;
begin
     read(a);
     otv:=(a div 1000 + a div 100 mod 10)=(a mod 100 div 10 + a mod 10);
     writeln(otv)
end.