# Original optional Paxa teacher reference for the complete supplied paper model.
# No one leaves, arrivals may be served in period, no queue limit, capacity5.
waiting = 0
for period, arrivals in [(1, 3), (2, 7), (3, 4), (4, 6)]:
    waiting = max(0, waiting + arrivals - 5)
    print(period, waiting)
