Good Fours and Good Fives
Problem Description
Given a positive integer N, please calculate the number of distinct multisets of positive integers that satisfy the following conditions:
- The multiset contains only the numbers 4 and 5
- The sum of all elements in the multiset is exactly N
For example:
- When N = 14, there is exactly one valid multiset: {4, 5, 5}
- When N = 20, there are two valid multisets: {4, 4, 4, 4, 4} and {5, 5, 5, 5}
- When N = 40, there are three valid multisets: {4, 4, 4, 4, 4, 4, 4, 4, 4, 4}, {4, 4, 4, 4, 4, 5, 5, 5, 5}, and {5, 5, 5, 5, 5, 5, 5, 5}
Input Format
A positive integer N
Output Format
An integer representing the number of valid multisets
Constraints
1 ≤ N ≤ 106
Examples
Sample Input 1
14
Sample Output 1
1
Sample Input 2
40
Sample Output 2
3
Sample Input 3
6
Sample Output 3
0
Comments