#!/usr/bin/env pypy3 from heapq import heappush, heappop # Compute how long it takes to drive from start to finish on a given road at a # certain point in time. def single_travel(l, t, cur_t, v1, v2): # If the current time is larger than the limit increase, drive constant # speed. if cur_t >= t: return l / v2 # We drive the entire road at constant speed, even if we were allowed to # speed up. return l / v1 def dijkstra(adj, start, end, t): heap = [(0, start)] # Make infinity very big times = [10**100] * len(adj) times[start] = 0 while heap: time, x = heappop(heap) if times[x] < time: continue for y, l, v1, v2 in adj[x]: if times[x] + single_travel(l, t, times[x], v1, v2) < times[y]: times[y] = times[x] + single_travel(l, t, times[x], v1, v2) heappush(heap, (times[y], y)) return times[end] def main(): n, m, t = (int(x) for x in input().split()) # The adjacency matrix contains in each row a tuple for each road containing # in order: the target, length, first and second velocity. adj = [[] for _ in range(n)] for _ in range(m): x, y, l, v1, v2 = (int(x) for x in input().split()) x -= 1 y -= 1 adj[x].append((y, l, v1, v2)) adj[y].append((x, l, v1, v2)) print(dijkstra(adj, 0, n - 1, t)) if __name__ == "__main__": main()