When climbing the mountains, Petriukas would record numbers one after another: how much he ascended, how much he descended, how much he ascended, how much he descended, and so on.
Help represent Petriukas’ journey through the mountains.
standard input | standard output |
---|---|
5 3 1 2 5 1 |
|
3 1 5 1 |
|