#icpc2013springg. [icpc2013spring_g]Revenge of Minimum Cost Flow

[icpc2013spring_g]Revenge of Minimum Cost Flow

$(function(){document.getElementById("fixed-server-timer").style.display = "none";})

Problem Statement

Flora is a freelance carrier pigeon. Since she is an excellent pigeon, there are too much task requests to her. It is impossible to do all tasks, so she decided to outsource some tasks to Industrial Carrier Pigeon Company.

There are NN cities numbered from 0 to N1N-1. The task she wants to outsource is carrying ff freight units from city ss to city tt. There are MM pigeons in the company. The ii-th pigeon carries freight from city sis_i to tit_i, and carrying cost of uu units is uaiu a_i if uu is smaller than or equals to did_i, otherwise diai+(udi)bid_i a_i + (u-d_i)b_i. Note that ii-th pigeon cannot carry from city tit_i to sis_i. Each pigeon can carry any amount of freights. If the pigeon carried freight multiple times, the cost is calculated from total amount of freight units he/she carried.

Flora wants to minimize the total costs. Please calculate minimum cost for her.


Input

The test case starts with a line containing five integers NN (2leqNleq1002 \\leq N \\leq 100), MM (1leqMleq1,0001 \\leq M \\leq 1{,}000), ss (0leqsleqN10 \\leq s \\leq N-1), tt (0leqtleqN10 \\leq t \\leq N-1) and ff (1leqfleq2001 \\leq f \\leq 200). You may assume sneqts \\neq t. Each of the next MM lines contains five integers sis_i (0leqsileqN10 \\leq s_i \\leq N-1), tit_i (0leqtileqN10 \\leq t_i \\leq N-1), aia_i (0leqaileq1,0000 \\leq a_i \\leq 1{,}000), bib_i (0leqbileq1,0000 \\leq b_i \\leq 1{,}000) and did_i (1leqdileq2001 \\leq d_i \\leq 200). Each denotes ii-th pigeon's information. You may assume at most one pair of aia_i and bib_i satisfies ai<bia_i < b_i, all others satisfies ai>bia_i > b_i.

Output

Print the minimum cost to carry ff freight units from city ss to city tt in a line. If it is impossible to carry, print "Impossible" (quotes for clarity).

Sample Input 1


2 2 0 1 5
0 1 3 0 3
0 1 2 1 6

Output for the Sample Input 1


9

Sample Input 2


4 4 0 3 5
0 1 3 0 3
1 3 3 0 3
0 2 2 1 6
2 3 2 1 6

Output for the Sample Input 2


18

Sample Input 3


2 1 0 1 1
1 0 1 0 1

Output for the Sample Input 3


Impossible

Sample Input 4


2 2 0 1 2
0 1 5 1 2
0 1 6 3 1

Output for the Sample Input 4


9

Sample Input 5


3 3 0 2 4
0 2 3 4 2
0 1 4 1 3
1 2 3 1 1

Output for the Sample Input 5


14

Source Name

Japan Alumni Group Spring Contest 2013