Var a:integer;
Begin
Readln(a);
if (a mod 2 = 1) and (a mod 3 > 0) then write((a mod 10) * (a div 10))
else if (a mod 5 = 0) then write(a mod 10)
else write(a);
End.
Var a:integer;
Begin
Readln(a);
if (a mod 2 = 1) and (a mod 3 > 0) then write((a mod 10) * (a div 10))
else if (a mod 5 = 0) then write(a mod 10)
else write(a);
End.