Which rows pass the running total filter?

The query sorts items by quantity DESC, id ASC and calculates a running total of quantity. A separate window sum calculates the total number of units across all items. The rows are then filtered using WHERE. Which rows remain in the result?

Predict the resultDuplicates and top NMiddleAnalystData EngineerBackend
Input data · iv_order_items
idorder_idproductquantityprice
11pen102.00
21notebook110.00
32pen14.00
43notebook510.00
53bag150.00
64pen23.00
75pen310.00
87bag260.00
98notebook240.00

Query

WITH ranked AS (
  SELECT
    id,
    quantity,
    SUM(quantity) OVER (
      ORDER BY quantity DESC, id ASC
      ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW
    ) AS cumulative_units,
    SUM(quantity) OVER () AS all_units
  FROM iv_order_items
)
SELECT id, quantity, cumulative_units
FROM ranked
WHERE 5 * (cumulative_units - quantity) < 3 * all_units
ORDER BY quantity DESC, id ASC