As can be seen here the `Long` type of `totalDemand` is inconvenient. I suggest that we keep the long counter internally but change the type of  `totalDemand` to `Int` and cap it to Integer.MaxValue. WDYT?