You are planning the train schedule and you want to know the minimum time of traveling between the stations.
Each section of the rail between stations is given in the Array.
Each section is a tuple of distance and speed limit (both are integers).
You can change the speed ( +1. -1 and ± 0 ) at the start and every minute after that.
Note: This means that a train with a speed 2 will travel a distance 2 before another minute passes and its speed can be changed again.