class Solution:
    def findPoisonedDuration(self, timeSeries: List[int], duration: int) -> int:      
        ans = duration * len(timeSeries)
        for i in range(1,len(timeSeries)):
            ans -= max(0, duration - (timeSeries[i] - timeSeries[i-1]))
        return ans
