Taxi!

No attempts yetTime limit1sMemory limit128 MB

Problem

  • Taxi driver: "Where to, sir?"
  • Passenger: "Kemanggisan, Binus Campus, please."
  • Taxi driver: "Okay, and which way should I take?"
  • Passenger: "Just take the fastest one."

This is the kind of conversation we often have when taking a taxi. Many people assume that the fastest route is also the cheapest one, but that is not always true. Because of factors such as toll fees, or a longer detour that avoids traffic jams, a faster route can end up costing more, and vice versa.

In this problem we model exactly this situation. A city has nn intersections and mm bidirectional roads connecting pairs of intersections. Traversing each road costs a fixed amount of time and a fixed fare (taxi money). Write a program that finds the minimum time to reach your destination without spending more than the money you have.

Input

The input consists of several test cases; process each case in order until the end of input.

The first line of each case contains two integers nn (1n1001 \le n \le 100, the number of intersections) and mm (the number of roads). Intersections are numbered from 00 to n1n-1.

Each of the next mm lines contains four integers uu, vv, tt, and cc (1t,c1001 \le t, c \le 100), meaning there is a bidirectional road between intersections uu and vv that takes tt minute(s) and costs cc Rupiah to traverse.

The last line of each case contains three integers ss, dd, and rr (1r1001 \le r \le 100), meaning you want to travel from the starting point ss to the destination dd using only rr Rupiah.

Output

For each case, output on a single line the minimum time to reach the destination while the total cost does not exceed your money.

It is guaranteed that the destination is always reachable within the given budget.