class Solution:
def canCompleteCircuit(self, gas: List[int], cost: List[int]) -> int:
start = 0
s = 0
total = 0
for i in range(len(gas)):
s += gas[i] - cost[i]
total += gas[i] - cost[i]
if s < 0:
start = i + 1
s = 0
if total < 0:
return -1
else:
return start