QOJ.ac

QOJ

Limite de temps : 1 s Limite de mémoire : 256 MB Points totaux : 100

#11148. Bag

Statistiques

Bajtazar is a specialist in many professions, but he is not satisfied with his earnings. On the advice of a friend, he decided to invest his money in funds.

There are five companies available: Bitoff Securities LLC, Bajtton Unmount, Bajtou Hedge Fund Group, BajtConneeeeeeeeeect, and Bajtocka Kasa Oszczędności. Each of them offers an identical scheme for investors: you pay a small entry fee and start earning immediately! On the $i$-th day, you will receive $i$ bajtolars into your virtual account in the system. At any moment, you can end the investment and withdraw the money accumulated so far, which is the amount $1 + 2 + \dots + k = \frac{k(k+1)}{2}$ if you decide to leave after $k$ days.

Such a system allows for huge profits, but Bajtazar is not a greedy man. He is satisfied with a sum of exactly $n$ bajtolars (higher profits would be heavily taxed anyway). Help him invest in some of the five available companies (or all of them) so that the sum of the payouts is exactly $n$.

Output the number of selected companies (from 1 to 5) and the amount Bajtazar is to receive from the investment in each of these companies. Each amount must be of the form $\frac{k(k+1)}{2}$ for some positive integer $k$. (Numbers of this form are sometimes called pyramidal numbers based on a certain definition of "investments" described in the problem.)

It can be shown that this is possible for every number $n$ that satisfies the limits given in the problem.

Input

The only line of input contains an integer $n$ ($1 \le n \le 10^{18}$).

Output

In the first line, output a single integer $s$ ($1 \le s \le 5$) — the number of companies Bajtazar should invest in.

In the second line, output $s$ positive integers — the amounts obtained from each of the selected companies. These numbers must sum up to exactly $n$.

If there are multiple possible solutions, output any one of them.

Examples

Input 1

18

Output 1

4
6 1 10 1

Note

Bajtazar can, for example, invest in four companies. If he ends two investments after one day, one after three days, and one after four days, he will obtain a total sum of:

$(1) + (1) + (1 + 2 + 3) + (1 + 2 + 3 + 4) = 1 + 1 + 6 + 10 = 18$

We can therefore output the numbers 1, 1, 6, 10. The order of the output numbers does not matter, so 6, 1, 10, 1 is also a correct solution.

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.