Partial sums of a column of values

I have a column of values like this:

0`

1

3

0

0

12

45

56

0

How do I compute the subtotals of contiguous nonzero numbers?

See this example.

===Edit1: Enhanced Example===
Here it is.

Thanks! I understand that the A2:A1001 is assumed to be the maximum run the data can have?

It’s not just the maximum run (of non-zero values), but the maximum range of any values.
You were right - basically. The range of 1000 rows moves down with the starting row. That’s not a really satisfying solution. (It seems I had a kind of blackout.)
To expand the range without too much decrease in efficiency can be achieved using helper formulae that only need to look at two rows instead of many. The partial sums can then be taken from a “Pivot Table”.
See the enhanced example.

Wow, you already did what I have to accomplished next. Thank you very much!