#include <stdio.h>
int main() {
int n, answer=1001, sum, count;
for (int i=0;i*5<=n;i++){
sum = i*5;
count = i;
while (sum<n){
sum += 3;
count++;
}
if (sum == n){
if (answer > count){
answer = count;
}
}
}
if (answer == 1001){
answer = -1;
}
}
I2luY2x1ZGUgPHN0ZGlvLmg+CgppbnQgbWFpbigpIHsKICAgIGludCBuLCBhbnN3ZXI9MTAwMSwgc3VtLCBjb3VudDsKICAgIHNjYW5mKCIlZCIsICZuKTsKCiAgICBmb3IgKGludCBpPTA7aSo1PD1uO2krKyl7CiAgICAgICAgc3VtID0gaSo1OwogICAgICAgIGNvdW50ID0gaTsKICAgICAgICB3aGlsZSAoc3VtPG4pewogICAgICAgICAgICBzdW0gKz0gMzsKICAgICAgICAgICAgY291bnQrKzsKICAgICAgICB9CiAgICAgICAgaWYgKHN1bSA9PSBuKXsKICAgICAgICAgICAgaWYgKGFuc3dlciA+IGNvdW50KXsKICAgICAgICAgICAgICAgIGFuc3dlciA9IGNvdW50OwogICAgICAgICAgICB9CiAgICAgICAgfQogICAgfQogICAgaWYgKGFuc3dlciA9PSAxMDAxKXsKICAgICAgICBhbnN3ZXIgPSAtMTsKICAgIH0KICAgIHByaW50ZigiJWQiLCBhbnN3ZXIpOwp9