Under construction

Still being built. Things may change

City Brain

Time limit4sMemory limit1024 MB

Summary
Given an undirected road graph, spend up to k dollars to raise road speeds so the sum of two shortest travel times, for two pairs of cities, is minimized.
Level

Hard8 of 10

Topics
Graph, Shortest path, Brute force
Solved
No attempts yet

Problem

Prof. Pang works for the City Brain program of Capital Grancel. The road network of Grancel is an undirected graph. Initially, the speed limit on each road is 11 m/s. Prof. Pang can raise the speed limit on a road by 11 m/s for 11 dollar. He has kk dollars and may spend any nonnegative integer amount on each road.

If a road has speed limit aa m/s, anyone can cross it in either direction in 1/a1/a seconds. After Prof. Pang spends his money, Prof. Du travels from s1s_1 to t1t_1, and Prof. Wo travels from s2s_2 to t2t_2. Prof. Pang must spend the money so that the sum of the minimum travel times of Prof. Du and Prof. Wo is as small as possible.

It is guaranteed that s1s_1 and t1t_1 are connected by at least one path, and that s2s_2 and t2t_2 are connected by at least one path.

Input

The first line contains three integers nn, mm, and kk (1≤n≤50001 \le n \le 5000, 0≤m≤50000 \le m \le 5000, 0≤k≤1090 \le k \le 10^9), separated by single spaces. Here nn is the number of vertices, mm is the number of edges, and kk is the number of dollars.

Each of the next mm lines contains two integers aa and bb (1≤a,b≤n1 \le a, b \le n, a≠ba \ne b), the endpoints of one road. Multiple roads may connect the same pair of cities.

The last line contains four integers s1s_1, t1t_1, s2s_2, and t2t_2 (1≤s1,t1,s2,t2≤n1 \le s_1, t_1, s_2, t_2 \le n), the start and end vertices of Prof. Du and Prof. Wo.

Output

Print one real number on a single line: the minimum sum of Prof. Du's and Prof. Wo's travel times. The answer is accepted if its absolute or relative error does not exceed 10−910^{-9}.

Examples3

  1. Example 1

    Input
    6 5 1
    1 2
    3 2
    2 4
    4 5
    4 6
    1 5 3 6
    
    Expected output
    5.000000000000
    
  2. Example 2

    Input
    1 0 100
    1 1 1 1
    
    Expected output
    0.000000000000
    
  3. Example 3

    Input
    4 2 3
    1 2
    3 4
    1 2 3 4
    
    Expected output
    0.833333333333