# [Jelly], 13 bytes

    ḢẎ⁼⁹a⁸o
    s2ç@ƒ

[Try it online!][TIO-jzqm6vsb]

[Jelly]: https://github.com/DennisMitchell/jelly
[TIO-jzqm6vsb]: https://tio.run/##y0rNyan8///hjkUPd/U9atzzqHFn4qPGHflcxUaHlzscm/T/8PJjcx81rYn8/z86WsnAwMAQBAwMlXSUDJRidSBCBgZwLlAOxIcKxAIA "Jelly – Try It Online"

I'm not 100% sure this is correct, but it succeeds on all three test cases. Takes the commands as the left argument and the initial accumulator as the right argument.