Python Hard
```python3 []
class Solution:
    def minCost(self, maxTime: int, edges: List[List[int]], passingFees: List[int]) -> int:
        lookup = defaultdict(list)
        INF = 10 ** 20
        N = 0
        for u, v, t in edges:
            lookup[u].append((v, t))
            lookup[v].append((u, t))
            N = max(N, u, v)

        N += 1

        '''
        bs on min_cost
        '''
        def shortest_path_calc(vertex_weights, lookup):
            min_cost = [INF] * N
            min_cost[0] = vertex_weights[0]
            min_time = [INF] * N
            min_time[0] = 0

            h = []
            heapq.heappush(h, (vertex_weights[0], 0, 0))

            while h:
                cost, time, u = heapq.heappop(h)

                if min_cost[u] < cost and min_time[u] < time:
                    continue

                for v, t in lookup[u]:
                
                    nxt_cost = vertex_weights[v] + cost

                    nxt_time = t + time

                    if nxt_time > maxTime:
                        continue

                    if nxt_cost > min_cost[v] and nxt_time > min_time[v]:
                        continue

                    min_cost[v] = min(min_cost[v], nxt_cost)
                    min_time[v] = min(min_time[v], nxt_time)

                    heapq.heappush(h, (nxt_cost, nxt_time, v))


            return min_cost[-1] 



        val = shortest_path_calc(passingFees, lookup)

        if val == INF:
            return -1

        return val



        # def good(target):
        #     return shortest_path_calc(passingFees, lookup, target)
       
                
        # l, r = 0, 10 ** 10
        # best = 10 ** 10

        # if not good(r):
        #     return -1


        # while l <= r:
        #     mid = (l + r) // 2
        #     if good(mid):
        #         best = mid
        #         r = mid - 1

        #     else:
        #         l = mid + 1


        # return best
```
['Python3']