Program Zif_6_41_D(input,output);
var c:char;
    k:integer;
    q:boolean;
begin
     read(c);q:=true;
     while (c<>'.')and(q) do
     begin
          if (c>='0')and(c<='9') then k:=k*16+ord(c)-ord('0')
          else if (c>='A')and(c<='F') then k:=k*16+ord(c)-ord('A')+10
          else q:=false;
          read(c)
     end;
     writeln((q)and(k mod 5 = 0))
end.