#include <iostream>
#include <fstream>
using namespace std;
int p;
ifstream fin("fact.in");
ofstream fout("fact.out");
int nr_zero(int n)
{
int step, sum = 0;
for (step = 5; step <= n; step *= 5)
sum += n / step;
return sum;
}
int cautare_binara(int val)
{
int i, step;
for (step = 1; step <= 5 * p; step <<= 1)
;
for (i = 0; step; step >>= 1)
{
if (i + step <= 5 * p && nr_zero(i + step) < val)
i += step;
}
if (nr_zero(i + 1) == val)
return i + 1;
else
return -1;
}
int main()
{
fin >> p;
fout << cautare_binara(p);
return 0;
}