eolymp
Competitions

2022 Azerbaijan Round 1, 8-9-10-11 classes

Split into composite numbers

What is the largest number of composite integers can be used to represent the number n as a sum of composite numbers?

Note: A positive integer that has a divisor other than itself and 1 is called a composite.

Input data

One integer n (1n1018).

Output

Print the largest number of composite integers that can be used so that their sum equals n. If n cannot be represented as a sum of composite numbers, print -1.

Time limit 1 second
Memory limit 128 MiB
Input example #1
8
Output example #1
2
Input example #2
6
Output example #2
1
Input example #3
15
Output example #3
2
Input example #4
7
Output example #4
-1
Source 2022 Azerbaijan Round 1, 10-11 classes