Pagini recente » Cod sursa (job #2556057) | Cod sursa (job #2588532) | Cod sursa (job #527166) | Cod sursa (job #2657176) | Cod sursa (job #2644941)
/*
Username : moondancer
Name : Moon Dancer
*/
#include <bits/stdc++.h>
using namespace std;
#define int long long
signed main(){
ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
int n;
cin>>n;
int l=1,r=2e18;
int ans=0;
while(l<=r){
int mid=(l+r)/2;
int x=mid;
int s=0;
while(x){
s+=x/5;
x/=5;
}
if(s>=n){
ans=mid;
r=mid-1;
}
else{
l=mid+1;
}
}
int t=0;
int xx=ans;
while(ans){
t+=ans/5;
ans/=5;
}
if(t==n) cout<<xx;
else cout<<-1;
return 0;
}