Skip to main content
Tuesday (24.11.2026) at 20:00: ALGOR Contest: Round #4 (Special Challenge) starts!

~/algor $ cat problems/while-fibonachchi-yoyilmasi

Fibonacci decomposition

Medium 1000 ms 64 MB 49%
Share

The Fibonacci numbers: $1, 2, 3, 5, 8, 13, 21, \dots$ — each is the sum of the previous two. A positive integer $n$ is decomposed as follows: the largest Fibonacci number not exceeding $n$ is written down and subtracted from $n$; this is repeated until $n$ becomes zero. Find the numbers written down (for example, $100 = 89 + 8 + 3$).

Splitting the number into pieces of successive Fibonacci numbers

Input

One positive integer $n$.

Output

One line with the Fibonacci numbers separated by spaces, in decreasing order (in the order they were written).

Note

$1 \le n \le 10^{18}$

Examples

Input #1
100
Output #1
89 8 3
Input #2
64
Output #2
55 8 1

Sign in to submit a solution

Signing up is free and takes a minute.