Problem list
Log in
#r03585 · CCC 2022 Senior

Good Fours and Good Fives

Bronze I 2.0 s 256 MB

Finn loves Fours and Fives. In fact, he loves them so much that he wants to know the number of ways a number can be formed by using a sum of fours and fives, where the order of the fours and fives does not matter. If Finn wants to form the number $14$, there is one way to do this which is $14 = 4 + 5 + 5$. As another example, if Finn wants to form the number $20$, this can be done two ways, which are $20 = 4+4+4+4+4$ and $20 = 5+5+5+5$. As a final example, Finn can form the number 40 in three ways: $40=4+4+4+4+4+4+4+4+4+4$, $40=4+4+4+4+4+5+5+5+5$, and $40=5+5+5+5+5+5+5+5$.

Your task is to help Finn determine the number of ways that a number can be written as a sum of fours and fives.

Input

The input consists of one line containing a number $N$.

Output

Output the number of unordered sums of fours and fives which form the number $N$. Output 0 if there are no such sums of fours and fives.

Constraints

Marks

The following table shows how the available 15 marks are distributed.

Marks Awarded Bounds on $N$ Additional Constraints
3 marks $1 \leq N \leq 10$ None
2 marks $1 \leq N \leq 100\ 000$ $N$ is a multiple of $4$
2 marks $1 \leq N \leq 100\ 000$ $N$ is a multiple of $5$
8 marks $1 \le N \leq 1\ 000\ 000$ None

Example 1

Input
14
Output
1

This is one of the examples in the problem description.

Example 2

Input
40
Output
3

This is one of the examples in the problem description.

Example 3

Input
6
Output
0

There is no way to use a sum of fours and fives to get $6$.

Source
CCC 2022 Senior
Appears in
Not part of a ladder, contest or set yet.
Accepted 0 Submissions 0 Acceptance 0% Solvers 0

Discussion

Threads about this problem. Spoilers are collapsed; wrap hints in ||double bars||.

No discussion yet. Start a thread if something here needs explaining.

Recent submissions Open with filters
Code