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;
using Int = long long;
template <typename T1, typename T2>
inline void chmin(T1 &a, T2 b) {
  if (a > b) a = b;
}
template <typename T1, typename T2>
inline void chmax(T1 &a, T2 b) {
  if (a < b) a = b;
}
template <typename T, bool isMin>
struct ConvexHullTrick {
  using P = pair<T, T>;
  deque<P> H;
  bool empty() const { return H.empty(); }
  void clear() { H.clear(); }
  inline int sgn(T x) { return x == 0 ? 0 : (x < 0 ? -1 : 1); }
  using D = double;
  inline bool check(const P &a, const P &b, const P &c) {
    if (b.second == a.second || c.second == b.second)
      return sgn(b.first - a.first) * sgn(c.second - b.second) >=
             sgn(c.first - b.first) * sgn(b.second - a.second);
    return (b.first - a.first) * (c.second - b.second) >=
           (b.second - a.second) * (c.first - b.first);
  }
  void addLine(T m, T b) {
    if (!isMin) m *= -1, b *= -1;
    P line(m, b);
    if (empty()) {
      H.emplace_front(line);
      return;
    }
    if (H.front().first <= m) {
      if (H.front().first == m) {
        if (H.front().second <= b) return;
        H.pop_front();
      }
      while (H.size() >= 2 && check(line, H.front(), H[1])) H.pop_front();
      H.emplace_front(line);
    } else {
      assert(m <= H.back().first);
      if (H.back().first == m) {
        if (H.back().second <= b) return;
        H.pop_back();
      }
      while (H.size() >= 2 && check(H[H.size() - 2], H.back(), line))
        H.pop_back();
      H.emplace_back(line);
    }
  }
  inline T getY(const P &a, const T &x) { return a.first * x + a.second; }
  T query(T x) {
    assert(!empty());
    int l = -1, r = H.size() - 1;
    while (l + 1 < r) {
      int m = (l + r) >> 1;
      if (getY(H[m], x) >= getY(H[m + 1], x))
        l = m;
      else
        r = m;
    }
    if (isMin) return getY(H[r], x);
    return -getY(H[r], x);
  }
  T queryMonotoneInc(T x) {
    assert(!empty());
    while (H.size() >= 2 && getY(H.front(), x) >= getY(H[1], x)) H.pop_front();
    if (isMin) return getY(H.front(), x);
    return -getY(H.front(), x);
  }
  T queryMonotoneDec(T x) {
    assert(!empty());
    while (H.size() >= 2 && getY(H.back(), x) >= getY(H[H.size() - 2], x))
      H.pop_back();
    if (isMin) return getY(H.back(), x);
    return -getY(H.back(), x);
  }
};
template <typename TF, typename TC>
struct PrimalDual {
  struct edge {
    int to;
    TF cap;
    TC cost;
    int rev;
    edge() {}
    edge(int to, TF cap, TC cost, int rev)
        : to(to), cap(cap), cost(cost), rev(rev) {}
  };
  static const TC INF;
  vector<vector<edge>> G;
  vector<TC> h, dist;
  vector<int> prevv, preve;
  PrimalDual() {}
  PrimalDual(int n) : G(n), h(n), dist(n), prevv(n), preve(n) {}
  void add_edge(int u, int v, TF cap, TC cost) {
    G[u].emplace_back(v, cap, cost, G[v].size());
    G[v].emplace_back(u, 0, -cost, G[u].size() - 1);
  }
  void dijkstra(int s) {
    struct P {
      TC first;
      int second;
      P(TC first, int second) : first(first), second(second) {}
      bool operator<(const P &a) const { return a.first < first; }
    };
    priority_queue<P> que;
    fill(dist.begin(), dist.end(), INF);
    dist[s] = 0;
    que.emplace(dist[s], s);
    while (!que.empty()) {
      P p = que.top();
      que.pop();
      int v = p.second;
      if (dist[v] < p.first) continue;
      for (int i = 0; i < (int)G[v].size(); i++) {
        edge &e = G[v][i];
        if (e.cap == 0) continue;
        if (dist[v] + e.cost + h[v] - h[e.to] < dist[e.to]) {
          dist[e.to] = dist[v] + e.cost + h[v] - h[e.to];
          prevv[e.to] = v;
          preve[e.to] = i;
          que.emplace(dist[e.to], e.to);
        }
      }
    }
  }
  TC flow(int s, int t, TF f, int &ok) {
    TC res = 0;
    fill(h.begin(), h.end(), 0);
    while (f > 0) {
      dijkstra(s);
      if (dist[t] == INF) {
        ok = 0;
        return res;
      }
      for (int v = 0; v < (int)h.size(); v++)
        if (dist[v] < INF) h[v] = h[v] + dist[v];
      TF d = f;
      for (int v = t; v != s; v = prevv[v])
        d = min(d, G[prevv[v]][preve[v]].cap);
      f -= d;
      res = res + h[t] * d;
      for (int v = t; v != s; v = prevv[v]) {
        edge &e = G[prevv[v]][preve[v]];
        e.cap -= d;
        G[v][e.rev].cap += d;
      }
    }
    ok = 1;
    return res;
  }
};
template <typename TF, typename TC>
const TC PrimalDual<TF, TC>::INF = numeric_limits<TC>::max() / 2;
signed main() {
  using ll = long long;
  ll n, m;
  scanf("%lld %lld", &n, &m);
  vector<ll> us(m), vs(m), ws(m);
  for (ll i = 0; i < m; i++) {
    scanf("%lld %lld %lld", &us[i], &vs[i], &ws[i]);
    us[i]--, vs[i]--;
  }
  using D = double;
  ConvexHullTrick<D, true> cht;
  PrimalDual<ll, ll> G(n);
  for (ll i = 0; i < m; i++) G.add_edge(us[i], vs[i], 1, ws[i]);
  int ok = 1;
  ll sum = 0, cnt = 0;
  while (1) {
    sum += G.flow(0, n - 1, 1, ok);
    cnt++;
    if (!ok) break;
    if (cnt >= 5000) break;
    cht.addLine(D(1) / D(cnt), D(sum) / D(cnt));
  }
  ll q;
  scanf("%lld", &q);
  vector<ll> xs(q);
  for (ll i = 0; i < q; i++) scanf("%lld", &xs[i]);
  using P = pair<D, ll>;
  vector<P> vp;
  for (ll i = 0; i < q; i++) vp.emplace_back(xs[i], i);
  sort(vp.begin(), vp.end());
  vector<D> ans(q);
  for (auto p : vp) ans[p.second] = cht.queryMonotoneInc(p.first);
  for (int i = 0; i < q; i++) printf("%.8f\n", ans[i]);
  return 0;
}