Problem Description

The project West-East power transmission is famous around the world. It transmits the electricity from western areas to east China. There are many nodes in the power system. Each node is connected with several other nodes in the system by cable. Power can be only transmitted between two connected nodes. For each node, it cant send power to two or more other nodes at the same time. As we have all known, power will be loss during the transmission. Bob is the chief engineer of the project. He wants to build a transmission line which send power from one node to another node and minimize the power loss at the same time. Now he asks you to help him solve the problem.

Input

There are several test cases. For each test case, the first line contains an integer N (0 < N 50000) which represents the number of nodes in the power system. Then there will be N groups of data following. For the i-th(0 < i N) group, the first line is an integer ki (ki 50), which means the node i is connected with ki nodes. The rest of the i-th group data are divided into ki lines. Each line contains an integer ai (0 < ai N, ai i) and an integer bi (0 bi 100), which represents power can be transmitted from node i to ai and will loss bi% while transmitting. The last line of input data contains three integers separated by single spaces. The first one is s, the second is t (0 < s, t N), and the third is the total power M (0 < M 10^6) at node s. Output For each test case, output the minimum of loss power while transmitting from node s to node t. The result should be printed with two digits to the right of the decimal point. If power cannot be transmitted from node s to node t, output IMPOSSIBLE! in a line. Sample Input 4 2 2 50 3 70 2 1 30 4 20 2 1 10 4 40 0 1 4 100

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <queue>
#include <string>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <ctime>
 
using namespace std;
 
#define INF 1e9
 
int beg, end, m;
 
struct node                 //
{
    int to,next;          //next
    double w;
} e[3000000];
int lastshow[100010];
double dis[100010];
bool inqueue[100010];
int t,n,cnt;
queue<int>q;
 
void insert(int a,int b,double w)          //abw
{
    e[cnt].to=b;
    e[cnt].w=w;
    e[cnt].next=lastshow[a];
    lastshow[a]=cnt++;
}
bool spfa()
{
    q.push(beg);
    while(!q.empty())
    {
        int x=q.front();
        q.pop();
        inqueue[x]=false;                               //
        int id=lastshow[x];
        while(id!=-1)
        {
            if(dis[e[id].to] < dis[x]*e[id].w)
            {
                dis[e[id].to] = dis[x] * e[id].w;
                if(!inqueue[e[id].to])                  //
                {
                    inqueue[e[id].to]=true;
                    q.push(e[id].to);
                }
            }
            id=e[id].next;
        }
    }
    return true;
}
 
void ini()
{
    for(int i=0; i<=n; ++i){
        inqueue[i] = false;
        dis[i] = 0;
    }
    dis[beg] = 1.0;
    cnt=0;
    while(!q.empty())
    {
        q.pop();
    }
}
int main()
{
    int i, j, k;
    double ww;
    int a, b;
    int ki;
    double ans;
    while(cin >> n){
        int a,b;
        double w;
        for(i = 0 ; i <=n ; i ++)
            lastshow[i] = -1;
        for(i=1; i<= n; ++i){
            scanf("%d", &ki);
            for(j = 1; j <= ki; j ++){
                scanf("%d", &b);
                scanf("%lf", &ww);
                w = 1.0 - ww / 100.0;
                insert(i,b,w);
            }
        }
        scanf("%d %d %d", &beg, &end, &m);
        ini();
        spfa();
        if(0 == dis[end])
            printf("IMPOSSIBLE!\n");
        else{
            ans = (double)m * (1.0 - dis[end]);
            printf("%.2lf\n", ans);
        }
    }
    return 0;
}