#P15889. [COCI 2025/2026 #6] Džeparac
[COCI 2025/2026 #6] Džeparac
Description
Mother Antonija has earned euros and must spend all of it as soon as possible. She may keep a portion of the money for herself, but the remaining amount must be equally distributed to her two sons over several days.
First, she chooses a non-negative integer () to keep for herself. The remaining amount of euros is then distributed to the sons over days. Mother Antonija may also choose not to distribute anything to her sons, which corresponds to the case when and .
If the money is distributed, it is done so that each day both sons receive the same amount of money. If one son receives euros on a given day, the other son also receives euros, where must be a positive integer. In total, each son must receive the same total amount of money.
Two distributions are considered different if at least one of the following holds:
- the chosen amount is different
- the number of days is different
- there exists at least one day on which the amounts received by the sons differ (i.e., the sequence of daily payments is not identical).
Your task is to determine the number of different ways in which the mother can distribute the money. Since the number of ways can be very large, output the result modulo .
Input Format
The first line contains a natural number (), the number from the problem statement.
Output Format
Print a single number - the number of ways in which mother Antonija can distribute the money.
4
4
5
4
793
137435472
Hint
Clarification of the first example: We consider all possible values of the number :
the mother keeps all the money, so the only distribution is the one where the sons receive no money.
euros remain to be distributed to the sons. The only valid distribution is , where each son receives euro.
euros remain to be distributed to the sons. There are two valid distributions:
each son receives euros
each day, each son receives euro
and there is no way to divide the remaining amount so that both sons receive the same positive integer amount each day.
In total, there are different ways of distribution.
Scoring
| Subtask | Points | Constraints |
|---|---|---|
| 1 | 12 | |
| 2 | 17 | |
| 3 | 36 | |
| 4 | 5 | No additional constraints. |
京公网安备 11011102002149号