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>
int min(int a, int b) { return a < b ? a : b; }
int oo[1 + (50 * (50 - 1)) * 2], oh[1 + (50 * (50 - 1)) * 2], _ = 1;
int link(int o, int h) {
  oo[_] = o, oh[_] = h;
  return _++;
}
int oo_[1 + ((50 * (50 - 1)) * 3 + 2) * 2],
    oh_[1 + ((50 * (50 - 1)) * 3 + 2) * 2], __;
int link_(int o, int h) {
  oo_[__] = o, oh_[__] = h;
  return __++;
}
int ae[50], ae_[(50 + 2)], dd[(50 + 2)], n_;
int ii[(50 * (50 - 1))], jj[(50 * (50 - 1))], ww[(50 * (50 - 1))];
char tt[(50 * (50 - 1))];
int ij[((50 * (50 - 1)) * 3 + 2)], cc[((50 * (50 - 1)) * 3 + 2) * 2], m_;
int pq[1 + 50], iq[50], cnt;
int less(int u, int v) { return dd[u] < dd[v]; }
int i2(int i) {
  return (i *= 2) > cnt ? 0 : i < cnt && less(pq[i + 1], pq[i]) ? i + 1 : i;
}
void pq_up(int u) {
  int i, j, v;
  for (i = iq[u]; (j = i / 2) && less(u, v = pq[j]); i = j) pq[iq[v] = i] = v;
  pq[iq[u] = i] = u;
}
void pq_dn(int u) {
  int i, j, v;
  for (i = iq[u]; (j = i2(i)) && less(v = pq[j], u); i = j) pq[iq[v] = i] = v;
  pq[iq[u] = i] = u;
}
void pq_add_last(int u) { pq[iq[u] = ++cnt] = u; }
int pq_remove_first() {
  int u = pq[1], v = pq[cnt--];
  if (v != u) iq[v] = 1, pq_dn(v);
  iq[u] = 0;
  return u;
}
void dijkstra(int n, int s) {
  memset(dd, 0x3f, n * sizeof *dd);
  dd[s] = 0, pq_add_last(s);
  while (cnt) {
    int i = pq_remove_first(), o;
    for (o = ae[i]; o; o = oo[o]) {
      int h = oh[o];
      if (!tt[h]) {
        int j = jj[h], d = dd[i] + ww[h];
        if (dd[j] > d) {
          if (dd[j] == 0x3f3f3f3f) pq_add_last(j);
          dd[j] = d, pq_up(j);
        }
      }
    }
  }
}
void link2(int i, int j, int c) {
  int h = m_++;
  ij[h] = i ^ j, cc[h << 1] = c, cc[h << 1 | 1] = 0;
  ae_[i] = link_(ae_[i], h << 1);
  ae_[j] = link_(ae_[j], h << 1 | 1);
}
int bfs(int s, int t) {
  static int qu[(50 + 2)];
  int i, head, cnt;
  for (i = 0; i < n_; i++) dd[i] = n_;
  head = cnt = 0;
  dd[s] = 0, qu[head + cnt++] = s;
  while (cnt) {
    int d, o;
    i = qu[cnt--, head++], d = dd[i] + 1;
    for (o = ae_[i]; o; o = oo_[o]) {
      int h_ = oh_[o];
      if (cc[h_]) {
        int h = h_ >> 1, j = i ^ ij[h];
        if (dd[j] > d) {
          dd[j] = d;
          if (j == t) return 1;
          qu[head + cnt++] = j;
        }
      }
    }
  }
  return 0;
}
int dfs(int i, int t) {
  int d, o;
  if (i == t) return 1;
  d = dd[i] + 1;
  for (o = ae_[i]; o; o = oo_[o]) {
    int h_ = oh_[o];
    if (cc[h_]) {
      int h = h_ >> 1, j = i ^ ij[h];
      if (dd[j] == d && dfs(j, t)) {
        cc[h_]--, cc[h_ ^ 1]++;
        return 1;
      }
    }
  }
  dd[i] = n_;
  return 0;
}
void dinic(int s, int t) {
  while (bfs(s, t))
    while (dfs(s, t))
      ;
}
int main() {
  static double ans[100000 + 1];
  static int dd1[50], dd2[50], xx[(50 * (50 - 1))];
  int n, m, q, h, x, s, t;
  scanf("%d%d", &n, &m);
  for (h = 0; h < m; h++) {
    int i, j, w;
    scanf("%d%d%d", &i, &j, &w), i--, j--;
    ii[h] = i, jj[h] = j, ww[h] = w;
    ae[i] = link(ae[i], h);
  }
  n_ = n + 2, s = n, t = n + 1;
  x = 0;
  while (x < 100000) {
    int k, y, z, d, d_;
    memset(tt, 0, m * sizeof *tt);
    dijkstra(n, 0);
    memcpy(dd1, dd, n * sizeof *dd);
    d = dd1[n - 1];
    memset(ae_, 0, n_ * sizeof *ae_), __ = 1, m_ = 0;
    link2(s, 0, 0x3f3f3f3f);
    link2(n - 1, t, 0x3f3f3f3f);
    for (h = 0; h < m; h++) {
      int i = ii[h], j = jj[h], w = ww[h];
      if (dd1[i] + w == dd1[j]) {
        tt[h] = 1;
        link2(s, j, 1), link2(i, t, 1);
        if (xx[h] == 0) link2(j, i, 1);
      }
    }
    dinic(s, t);
    d_ = 0x3f3f3f3f;
    k = 0;
    for (h = 0; h < m; h++) {
      int i = ii[h], j = jj[h];
      if (tt[h]) {
        if ((dd[i] == n_) == (dd[j] == n_))
          tt[h] = 0;
        else if (dd[i] != n_) {
          tt[h] = 1;
          k++;
        } else {
          if (xx[h] > 0) {
            tt[h] = 2;
            k--;
            d_ = min(d_, d + xx[h]);
          } else
            tt[h] = 0;
        }
      }
    }
    dijkstra(n, 0);
    memcpy(dd2, dd, n * sizeof *dd);
    d_ = min(d_, dd2[n - 1]);
    for (h = 0; h < m; h++)
      if (tt[h] == 2) d_ = min(d_, d + dd2[ii[h]] + ww[h] - dd1[jj[h]]);
    y = d_ - d <= (100000 - x) / k ? x + (d_ - d) * k : 100000;
    for (z = x; z <= y; z++) ans[z] = d + (double)(z - x) / k;
    if (y < 100000) {
      for (h = 0; h < m; h++)
        if (tt[h] == 1)
          ww[h] += d_ - d, xx[h] += d_ - d;
        else if (tt[h] == 2)
          ww[h] -= d_ - d, xx[h] -= d_ - d;
    }
    x = y;
  }
  scanf("%d", &q);
  while (q--) {
    scanf("%d", &x);
    printf("%f\n", ans[x]);
  }
  return 0;
}