Measuring Traffic

http://www.usaco.org/index.php?page=viewproblem2&cpid=917
I have been trying to solve this problem, but I am not sure how I can solve it.
My starting values seem to be working for the test cases I have tried, but not my end values.
Here is my code:

import sys
sys.stdin = open("traffic.in","r")
sys.stdout = open("traffic.out","w+")

Sensors = []
N = int(input())
for i in range(N):
    Sensors.append(input().split(" "))
    Sensors[i][1] = int(Sensors[i][1])
    Sensors[i][2] = int(Sensors[i][2])

ModifierMin = 0
ModifierMax = 0
StartingMin = 0
StartingMax = 0


for Sensor in Sensors:
    RampType = Sensor[0]
    if RampType == "on":
        ModifierMin -= Sensor[2]
        ModifierMax -= Sensor[1]
    elif RampType == "off":
        ModifierMin += Sensor[1]
        ModifierMax += Sensor[2]
    else:
        StartingMin = max(StartingMin,Sensor[1]+ModifierMin)
        if StartingMax != 0:
            StartingMax = min(StartingMax,Sensor[2]+ModifierMax)
        else:
            StartingMax = Sensor[2]+ModifierMax

EndingMin = StartingMin - ModifierMax
EndingMax = StartingMax - ModifierMin
print(StartingMin,StartingMax)
print(EndingMin,EndingMax)