Please help me in RECEPIES

,

Can anyone take a look on my code? It gives me correct output, no idea why codechef says W/A.
I was tring my best to make this code readable. Thanks!

Cutting Recipes Problem Code: RECIPE

It’s Python 3.5.

Links:
[Problem][1] /


[2]

  [1]: https://www.codechef.com/problems/RECIPE
  [2]: https://www.codechef.com/viewsolution/16331487

For test case:

1

4 4 4 4 1

Your output: 1 1 1 0

I think it should be 4 4 4 1

Correct me if i am wrong.

Thank you!