#!/usr/bin/env python3
import heapq

n, m, t = map(int, input().split())
graph, low, high = {i: [] for i in range(n + 1)}, 0, 1e18
for _ in range(m):
    a, b, l, v = map(int, input().split())
    graph[a].append((b, l, v)), graph[b].append((a, l, v))


def reachable(overspeed):
    q, dist = [(0, 1)], [None, 0, *([1e18] * (n - 1))]
    while q:
        currT, currV = heapq.heappop(q)
        if currT > dist[currV]: continue
        if currV == n: return currT <= t
        for neigh, l, v in graph[currV]:
            newT = currT + l / (v + overspeed)
            if dist[neigh] > newT:
                dist[neigh] = newT
                heapq.heappush(q, (newT, neigh))


while high - low > 1e-7 and (high - low) / (mid := (high + low) / 2) > 1e-7:
    low, high = (low, mid) if reachable(mid) else (mid, high)
print(low)
