// Shaazzz
#include<bits/stdc++.h>
using namespace std;
int main()
{
long long n, tot = 0, now = 5;
scanf("%lld", &n);
while (now <= n)
{
tot += (n / now) * (n / now - 1) / 2 * now;
tot += (n % now + 1) * (n / now);
now *= 5;
}
return !printf("%lld", tot);
}
Ly8gU2hhYXp6egojaW5jbHVkZTxiaXRzL3N0ZGMrKy5oPgp1c2luZyBuYW1lc3BhY2Ugc3RkOwppbnQgbWFpbigpCnsKICAgIGxvbmcgbG9uZyBuLCB0b3QgPSAwLCBub3cgPSA1OwogICAgc2NhbmYoIiVsbGQiLCAmbik7CiAgICB3aGlsZSAobm93IDw9IG4pCiAgICB7CiAgICAgICAgdG90ICs9IChuIC8gbm93KSAqIChuIC8gbm93IC0gMSkgLyAyICogbm93OwogICAgICAgIHRvdCArPSAobiAlIG5vdyArIDEpICogKG4gLyBub3cpOwogICAgICAgIG5vdyAqPSA1OwogICAgfQogICAgcmV0dXJuICFwcmludGYoIiVsbGQiLCB0b3QpOwp9