var a,b,t:byte;
begin
readln(a, b);
t:=a*b;
if (a<>1) or(a<>9) then write('-1');
if (b<>1) or(b<>9) then write('-1');
if (a=1) or (a=9) then write(a*b);
if (b=1) or (b=9) then write(a*b);
readln;
end.