uses wincrt;

var  i,n,fact:integer;

begin
  write('Enter a number between 1 and 100:  '); readln(n);
  fact := 1;
  for i :=  2 to n do
    begin
      fact := fact * i;
      while fact mod 10=0 do
        fact := fact div 10;
      fact := fact mod 100;
    end;
  writeln;
  writeln(fact mod 10);

end.