Need help with multq3

This is my second lazy propagation problem. (First being FLIPCOIN, did it today). That was straight forward, but needed a lot of debugging. For MULTQ3, I cannot find bug. It is giving right answer for test cases and for my own test cases. Please help

Problem

My code