New Quest — Abelian Sandpile
A wooden box of sand becomes a lesson in inevitability. Johann claims the piles must fall as they will, beyond prediction. Mihkel is asked to prove that order emerges from simple rules. Simulate a one-dimensional sandpile until every heap is stable.
On the input tape, you’ll get sandpile heights in unary format. Your task is to simulate a 1D Abelian sandpile until it becomes stable.

