program vuk;
var x,y,z,i,j:integer;
begin
read(x,y);
read;
if x or y <> 4 then writeln('4')
else writeln('0');
end.