#include <bits/stdc++.h>
#include <iostream>

using namespace std;

int main()
{
    int N, cnt = 0, cnt1 = 0;
    cin >> N;
    if (N % 5 == 0)
    {
        cnt1 = N / 5;
    }
    else if (N % 3 == 0)
    {
        cnt1 = N / 3;
    }

    for (size_t i = 1; i <= N/5; i++)
    {
        for (size_t j = 1; j <= N/3; j++)
        {
            if (5 * i + 3 * j == N)
            {
                cnt += i + j;
            }
        }
    }
    if (cnt > 0 and cnt1 > 0)
    {
        cout << min(cnt, cnt1);
    }
    else if (cnt == 0 and cnt1 > 0)
    {
        cout << cnt1;
    }
    else if (cnt1 == 0 and cnt > 0)
    {
        cout << cnt;
    }
    else
    {
        cout << -1;
    }
    return 0;
}