/******************************************************************************
Welcome to GDB Online.
GDB online is an online compiler and debugger tool for C, C++, Python, Java, PHP, Ruby, Perl,
C#, OCaml, VB, Swift, Pascal, Fortran, Haskell, Objective-C, Assembly, HTML, CSS, JS, SQLite, Prolog.
Code, Compile, Run and Debug online from anywhere in world.
*******************************************************************************/
#include <iostream>
#include <fstream>
using namespace std;
ifstream fin("fact.in");
ofstream fout("fact.out");
long long P;
long long zerouri(long long N)
{
long long rez=0;
long long p=5;
while(p<=N)
{
rez += N/p;
p*=5;
}
return rez;
}
int main()
{
fin>>P;
long long st=1, dr=5LL*P, ans=-1;
if(P==0)
{
fout<<1;
return 0;
}
while (st<=dr)
{
long long mid=(st+dr)/2;
long long z=zerouri(mid);
if(z==P)
{
ans=mid;
dr=mid-1;
}
else if(z<P)
st=mid+1;
else
dr=mid-1;
}
fout<<ans;
return 0;
}