Chefland has all the cities on a straight line. There are N cities in Chefland numbered 1 to N
City i is located at coordinate xi on the x-axis
Guru wants to travel from city A to city B
He starts at time t=0.
He can walk 1 meter in P secs.
There is a train that travels from city C to city D which travels 1 metre in Q secs which starts at time t=Y secs. Guru can take the train only at city C and leave the train only at city D.
Guru find the minimum time he will need to travel from city A to B
Note that you cannot board the train after time t =Y