1. 


/**
* FWP, Ausgewählte Probleme aus dem ACM Programming Contest, SS10
* Problem: 568 Just the Facts
* Link: http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=100&page=show_problem&problem=509
*
* @author Anton Pavlushko, IBB7B,
* @version 1.0, 10/10/2010
*
* Status : Accepted
* Runtime: 0.144
*/

import java.io.*;
import java.util.*;
public class Main {
public static void main(String[] args) throws IOException {
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
String current_line, empty = "";
int number, length;
double znak,count5,i,count5_already,multiply;

try {
while ((current_line=in.readLine())!= null) {
length=current_line.length();
number = Integer.parseInt(current_line);
znak=Math.floor(Math.log10(number)/Math.log10(5));

if (number<=Math.pow(5,znak+1)) znak++; //2.999999999996 Problem...

count5=0;
for(i=1;i<=znak;i++) {
count5_already=Math.floor(number/Math.pow(5,i));
count5+=count5_already;
}

znak=1;
count5_already=0;
for(i=2;i<=number;i++) {
multiply=i;
if (count5_already<count5 && multiply%2==0) {
multiply=multiply/2;
count5_already++;
}

while (multiply%5==0) multiply=multiply/5;
znak=(multiply*znak)%10;
}

empty="";
length=5-length;
for(i=0;i<length;i++) empty+=" ";

System.out.println(empty+number+" -> "+Math.round(znak));
} // end while
} // end try
catch (IOException e) {
System.err.println("Error: " + e);
}
}
}