Pagini recente » Rating Tareanu Adrian (TareanuAdrian) | Cod sursa (job #2869890) | Istoria paginii runda/fdhdfj | Cod sursa (job #1172740) | Cod sursa (job #1376087)
import java.io.FileInputStream;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.Scanner;
public class Main {
public static void main(String[] args) throws IOException {
Scanner in = new Scanner(new FileInputStream("fact.in"));
PrintWriter out = new PrintWriter("fact.out");
int n = in.nextInt();
in.close();
int zeros = 0;
long number = 0;
while (zeros < n) {
number += 5;
zeros++;
long temp = number;
if (temp % (5*5*5*5*5*5*5*5) == 0) {
zeros += 7;
temp /= 5*5*5*5*5*5*5*5;
}
if (temp % (5*5*5*5*5*5*5) == 0) {
zeros += 6;
temp /= 5*5*5*5*5*5*5;
}
if (temp % (5*5*5*5*5*5) == 0) {
zeros += 5;
temp /= 5*5*5*5*5*5;
}
if (temp % (5*5*5*5*5) == 0) {
zeros += 4;
temp /= 5*5*5*5*5;
}
if (temp % (5*5*5*5) == 0) {
zeros += 3;
temp /= 5*5*5*5;
}
if (temp % (5*5*5) == 0) {
zeros += 2;
temp /= 5*5*5;
}
if (temp % (5*5) == 0) {
zeros += 1;
temp /= 5*5;
}
}
if (zeros == 0) {
out.println(1);
} else {
if (zeros == n) {
out.println(number);
} else {
out.println(-1);
}
}
out.close();
}
}