Basri, Lim and Rama are taking a road trip during their semester break. But the odometer in their car is broken, so they don't know how many miles they have driven. Fortunately, Bill has a working stopwatch, so they can record their speed and the total time they have driven. Unfortunately, their record keeping strategy is a little odd, so they need help computing the total distance driven. Write a program to do this computation.
For example, suppose their log shows
This means they drove 2 hours at 20 miles per hour, then 6−2=4 hours at 30 miles per hour, then 7−6=1 hour at 10 miles per hour. The distance driven is then (2)(20)+(4)(30)+(1)(10)=40+120+10=170 miles. Note that the total elapsed time is always measured from the beginning of the trip, not from the previous entry in the log.