#include
#include
#include
using namespace std;
int n,m;
int main()
{
while(scanf("%d",&n)!=EOF){
m = 1;
for(int i = 1; i <= n; i++){
m = m * i;
while(m % 10 == 0){
m = m / 10;
}
m %= 100000;
}
m %= 10;
printf("%5d -> %d
",n,m);
}
return 0;
}