All Blue


Sanjindra is close to finding the All Blue and fulfilling their dream! However, there remains yet one obstacle in their path: a treacherous portion of the Calm Belt filled with evil sea monsters. Sanjindra knows that their ship, the Thousand Sunny, is strong and can take less than kk points of damage before that it will sink.

The portion of the Calm Belt can be modelled as a graph with nn nodes, connected by mm routes. Each route has a two endpoints (aia_i and bib_i), a distance (wiw_i), and the damage the sea monsters will do (did_i).

As Namindra, the navigator of the ship, it is your job to find the shortest route from nodes xx to yy which takes less than kk points of damage. Can you help Sanjindra with this task?

Input Format

The first line of input will consist of 3 integers, kk nn mm. Each of the next lines will consist of 4 integers aia_i bib_i wiw_i and did_i, as described in the description. Finally, the last line will contain two integers xx and yy, the point Sanjindra starts and wants to end.

Output Format

The output should consist of a single integer, the minimum length of the path if it is possible, or 1 if it is not.

Constraints

1≤k≤2001 \le k \le 200

2≤n≤20002 \le n \le 2000

n≤m≤10000n \le m \le 10000

0≤ai,bi≤n−10 \le a_i, b_i \le n-1

1≤wi≤1e51 \le w_i \le 1e5

0≤ci≤2000 \le c_i \le 200

Sample Input

Input 1
10 4 7
0 1 4 4
0 2 7 2
2 0 8 1
2 1 2 2
3 1 1 6
2 3 1 1
0 3 6 12
0 3

Sample Output

7

Comments0


No comments yet

Be the first to comment.

New comment


Log in to join the discussion.