#include<stdio.h>
int main(){
int i,n,s=1;
scanf("%d",&n);
for(i=1;i<=n;i++){
s*=i;
while(s/10000)
s/=10;
}while(s/10)s/=10;
printf("%d\n",s);
return 0;
}
int main(){
int i,n,s=1;
scanf("%d",&n);
for(i=1;i<=n;i++){
s*=i;
while(s/10000)
s/=10;
}while(s/10)s/=10;
printf("%d\n",s);
return 0;
}