Cheapest drive with a limited tank
Cities are numbered 0 to n - 1, and fuel costs price[i] per unit in city i. Each entry of roads is [a, b, d]: a two-way road that burns d units of fuel. Your tank holds at most capacity units and is empty when you start at src. In any city you may buy any whole number of units that fits in the tank, and you may pass through a city more than once. Return the least money needed to reach dst, or -1 if it cannot be reached. If src == dst, the answer is 0.
1 ≤ n ≤ 20, 1 ≤ capacity ≤ 20; prices and d are positive integers. Two cities may be joined by more than one road.
Examples
cheapest_drive([3,1,9], [[0,1,5],[1,2,5]], 10, 0, 2)→20cheapest_drive([1,9,9], [[0,1,5],[1,2,5]], 10, 0, 2)→10cheapest_drive([1,9,9], [[0,1,5],[1,2,5]], 7, 0, 2)→34cheapest_drive([2,2], [[0,1,6]], 5, 0, 1)→-1