#include <iostream>
#include <fstream>
using namespace std;
ifstream in("fact.in");
ofstream out("fact.out");
int p,nr ;
bool ok =0;
int count5(int nr)
{
int s=0;
int x=5;
while(x<nr)
{
// cout<<"x="<<x<<endl;
// cout<<"s="<<s<<endl;
s+=nr/x;
x*=5;
}
return s;
}
int cautare_binara(int st,int dr,int x)
{
int m=0;
while (st<dr)
{
m=(st+dr)/2;
int mij=count5(m);
if (mij<x)
{
st=m+1;
}
else
dr=m-1;
}
return st;
}
int main()
{
int n;
nr=0;
ok=0;
in>>p;
if (p==0)
{
out<<1;
}else
out<<cautare_binara(0,5*p,p);
return 0;
}