Skip to main content
LIVE CONTEST: ALGOR Contest: Round #4 (Special Challenge) is live now!

~/algor $ cat problems/rekursiya-sonni-qoshiluvchilarga-ajratish

Splitting a number into addends

Medium 1000 ms 128 MB 66%
Share

You are given a positive integer $n$. Print all ways to write it as a sum of positive integers. The order of the addends does not matter, so in every way they are written in non-increasing order ($3 + 1 + 1$, but not $1 + 3 + 1$).

The ways are printed in decreasing lexicographic order: the first line is $n$ itself, the last one is $1 + 1 + \dots + 1$.

All ways to split the number into addends, shown as rows of bars

Input

One positive integer $n$.

Output

Each way on its own line: the addends joined by + without spaces (for example, 3+1).

Note

$1 \le n \le 20$

Examples

Input #1
4
Output #1
4
3+1
2+2
2+1+1
1+1+1+1
Input #2
3
Output #2
3
2+1
1+1+1

Sign in to submit a solution

Signing up is free and takes a minute.