#P6702. [COCI 2010/2011 #7] ŠEĆER

[COCI 2010/2011 #7] ŠEĆER

Description

Mirko needs to deliver nn candies to a candy store somewhere.

Mirko can use two types of boxes:

  • Type 11 box, which can hold 33 candies.
  • Type 22 box, which can hold 55 candies.

Mirko wants to use as few boxes as possible. For example, if he needs to deliver 1818 candies, he could use 66 type 11 boxes. However, the best strategy is to use 33 type 22 boxes and 11 type 11 box, for a total of 44 boxes.

Please help Mirko find the minimum number of boxes needed.

Input Format

The input has one line.

The first line contains a positive integer nn, representing the number of candies.

Output Format

The output has one line.

The first line contains a positive integer, the minimum number of boxes needed. If it is impossible to deliver nn candies using these 22 types of boxes, output -1.

4

-1
9

3
18

4

Hint

Constraints

For 100%100\% of the testdata, 3n50003 \le n \le 5000.

Notes

This problem is worth 3030 points.

Translated from COCI2010-2011 CONTEST #7 T1 ŠEĆER.

Translated by ChatGPT 5