Problem: Farmer John is obsessed with making Bessie exercise more!

Bessie is out grazing on the farm, which consists of n fields connected by m directed roads. Each road takes some time w_i to cross. She is currently at field 1 and will return to her home at field n at the end of the day.

Farmer John has plans to increase the time it takes to cross certain roads. He can increase the time it takes to cross each road by a nonnegative amount, but the total increase cannot exceed x_i for the i-th plan. 

Determine the maximum he can make the shortest path from 1 to n for each of the q independent plans.

Input

The first line contains integers n and m (2 ≤ n ≤ 50, 1 ≤ m ≤ n ⋅ (n-1)) — the number of fields and number of roads, respectively.

Each of the following m lines contains 3 integers, u_i, v_i, and w_i (1 ≤ u_i, v_i ≤ n, 1 ≤ w_i ≤ 10^6), meaning there is an road from field u_i to field v_i that takes w_i time to cross.

It is guaranteed that there exists a way to get to field n from field 1. It is guaranteed that the graph does not contain self-loops or parallel edges. It is possible to have a road from u to v and a road from v to u.

The next line contains a single integer q (1 ≤ q ≤ 10^5), the number of plans.

Each of the following q lines contains a single integer x_i, the query (0 ≤ x_i ≤ 10^5).

Output

For each query, output the maximum Farmer John can make the shortest path if the total increase does not exceed x_i.

Your answer is considered correct if its absolute or relative error does not exceed 10^{-6}.

Formally, let your answer be a, and the jury's answer be b. Your answer is accepted if and only if \frac{|a - b|}{max{(1, |b|)}} ≤ 10^{-6}.

Example

Input


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


Output


3.0000000000
4.0000000000
4.5000000000
5.0000000000
5.5000000000

Solution (in CPP):

Solution:
#include <bits/stdc++.h>
using namespace std;
inline char gc() {
  static char buf[100000], *p1 = buf, *p2 = buf;
  return p1 == p2 && (p2 = (p1 = buf) + fread(buf, 1, 100000, stdin), p1 == p2)
             ? EOF
             : *p1++;
}
inline long long read() {
  long long x = 0;
  char ch = getchar();
  bool positive = 1;
  for (; !isdigit(ch); ch = getchar())
    if (ch == '-') positive = 0;
  for (; isdigit(ch); ch = getchar()) x = x * 10 + ch - '0';
  return positive ? x : -x;
}
inline void write(long long a) {
  if (a < 0) {
    a = -a;
    putchar('-');
  }
  if (a >= 10) write(a / 10);
  putchar('0' + a % 10);
}
inline void writeln(long long a) {
  write(a);
  puts("");
}
inline void wri(long long a) {
  write(a);
  putchar(' ');
}
const int inf = 1e9;
const int N = 55, M = 5005;
int nedge = 1, son[N], nextt[M], ed[M];
int cost[M], dist[N], di[M];
bool vis[N];
int last[N], que[N], laedge[N];
bool spfa(int s, int t, int n) {
  for (int i = 1; i <= n; i++) {
    dist[i] = inf;
    last[i] = laedge[i] = vis[i] = que[i - 1] = 0;
  }
  int tot = 1, l = 0, r = 0;
  que[0] = s;
  vis[s] = true;
  dist[s] = 0;
  while (tot) {
    int k = que[l];
    vis[k] = false;
    if (++l == n) l = 0;
    tot--;
    for (int i = son[k]; i; i = nextt[i]) {
      if (di[i] > 0 && dist[ed[i]] > dist[k] + cost[i]) {
        dist[ed[i]] = dist[k] + cost[i];
        laedge[ed[i]] = i;
        last[ed[i]] = k;
        if (vis[ed[i]] == 0) {
          if (++r == n) r = 0;
          que[r] = ed[i];
          tot++;
          vis[ed[i]] = true;
        }
      }
    }
  }
  return last[t] > 0;
}
int flo, len[M], s[M], S[M];
void costflow(int s, int t, int n) {
  int sum = 0;
  while (spfa(s, t, n)) {
    int mmin = inf;
    for (int i = t; last[i]; i = last[i]) {
      mmin = min(mmin, di[laedge[i]]);
    }
    len[flo] = dist[t] - sum;
    sum += len[flo];
    flo++;
    for (int i = t; last[i]; i = last[i]) {
      di[laedge[i]] -= mmin;
      di[laedge[i] ^ 1] += mmin;
    }
  }
}
inline void aedge(int a, int b, int c, int d) {
  nextt[++nedge] = son[a];
  son[a] = nedge;
  ed[nedge] = b;
  di[nedge] = c;
  cost[nedge] = d;
}
inline void ins(int a, int b, int c, int d) {
  aedge(a, b, c, d);
  aedge(b, a, 0, -d);
}
int main() {
  int n = read(), m = read();
  for (int i = (int)(1); i <= (int)(m); i++) {
    int u = read(), v = read(), w = read();
    ;
    ins(u, v, 1, w);
  }
  costflow(1, n, n);
  S[0] = len[0];
  for (int i = (int)(1); i <= (int)(flo - 1); i++) {
    s[i] = s[i - 1] + i * len[i];
    S[i] = S[i - 1] + len[i];
  }
  int q = read();
  while (q--) {
    int x = read();
    int t = upper_bound(s, s + flo, x) - s;
    printf("%.10f\n", S[t - 1] + (double)(x - s[t - 1]) / (t));
  }
}