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;
template <typename A, typename B>
inline void chmin(A &a, B b) {
  if (a > b) a = b;
}
template <typename A, typename B>
inline void chmax(A &a, B b) {
  if (a < b) a = b;
}
template <class A, class B>
ostream &operator<<(ostream &ost, const pair<A, B> &p) {
  ost << "{" << p.first << "," << p.second << "}";
  return ost;
}
template <class T>
ostream &operator<<(ostream &ost, const vector<T> &v) {
  ost << "{";
  for (long long i = 0; i < v.size(); i++) {
    if (i) ost << ",";
    ost << v[i];
  }
  ost << "}";
  return ost;
}
struct PrimalDual {
  using F = long long;
  const F INF = 1ll << 60;
  struct Edge {
    long long to;
    F cap, cost;
    long long rev;
    Edge(long long to, F cap, F cost, long long rev)
        : to(to), cap(cap), cost(cost), rev(rev) {}
  };
  long long n;
  vector<vector<Edge>> G;
  vector<F> h;
  vector<long long> prevv, preve;
  vector<F> dist;
  PrimalDual(long long n)
      : n(n), G(n), h(n), dist(n), prevv(n, -1), preve(n, -1) {}
  void addEdge(long long from, long long to, F cap, F cost) {
    G[from].push_back(Edge(to, cap, cost, G[to].size()));
    G[to].push_back(Edge(from, 0, -cost, G[from].size() - 1));
  }
  vector<pair<F, F>> solve(long long s, long long t) {
    F cur = 0;
    priority_queue<pair<F, long long>, vector<pair<F, long long>>,
                   greater<pair<F, long long>>>
        que;
    vector<pair<F, F>> ret;
    for (long long z = 1;; z++) {
      fill(dist.begin(), dist.end(), INF);
      dist[s] = 0;
      que.emplace(0, s);
      while (que.size()) {
        F d;
        long long v;
        tie(d, v) = que.top();
        que.pop();
        if (dist[v] < d) continue;
        for (long long i = 0; i < G[v].size(); i++) {
          Edge &e = G[v][i];
          F nd = dist[v] + e.cost + h[v] - h[e.to];
          if (e.cap > 0 && dist[e.to] > nd) {
            dist[e.to] = nd;
            prevv[e.to] = v;
            preve[e.to] = i;
            que.emplace(nd, e.to);
          }
        }
      }
      if (dist[t] == INF) break;
      for (long long v = 0; v < n; v++) h[v] += dist[v];
      cur += h[t];
      for (long long v = t; v != s; v = prevv[v]) {
        Edge &e = G[prevv[v]][preve[v]];
        e.cap -= 1;
        G[v][e.rev].cap += 1;
      }
      ret.emplace_back(cur, z);
    }
    return ret;
  }
};
template <typename T, bool isMin>
struct ConvexHullTrickAddMonotone {
  using P = pair<T, T>;
  deque<P> H;
  ConvexHullTrickAddMonotone() = default;
  bool empty() const { return H.empty(); }
  void clear() { H.clear(); }
  inline long long sgn(T x) { return x == 0 ? 0 : (x < 0 ? -1 : 1); }
  using D = long 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 D(b.first - a.first) * sgn(c.second - b.second) /
               D(abs(b.second - a.second)) >=
           D(c.first - b.first) * sgn(b.second - a.second) /
               D(abs(c.second - b.second));
  }
  void add(T a, T b) {
    if (!isMin) a *= -1, b *= -1;
    P line(a, b);
    if (empty()) {
      H.emplace_front(line);
      return;
    }
    if (H.front().first <= a) {
      if (H.front().first == a) {
        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(a <= H.back().first);
      if (H.back().first == a) {
        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 get_y(const P &a, const T &x) { return a.first * x + a.second; }
  T query(T x) {
    assert(!empty());
    long long l = -1, r = H.size() - 1;
    while (l + 1 < r) {
      long long m = (l + r) >> 1;
      if (get_y(H[m], x) >= get_y(H[m + 1], x))
        l = m;
      else
        r = m;
    }
    if (isMin) return get_y(H[r], x);
    return -get_y(H[r], x);
  }
  T query_monotone_inc(T x) {
    assert(!empty());
    while (H.size() >= 2 && get_y(H.front(), x) >= get_y(H[1], x))
      H.pop_front();
    if (isMin) return get_y(H.front(), x);
    return -get_y(H.front(), x);
  }
  T query_monotone_dec(T x) {
    assert(!empty());
    while (H.size() >= 2 && get_y(H.back(), x) >= get_y(H[H.size() - 2], x))
      H.pop_back();
    if (isMin) return get_y(H.back(), x);
    return -get_y(H.back(), x);
  }
};
signed main() {
  long long N, M;
  cin >> N >> M;
  PrimalDual pd(N);
  for (long long i = 0; i < (M); i++) {
    long long u, v, d;
    cin >> u >> v >> d;
    u--;
    v--;
    pd.addEdge(u, v, 1, d);
  }
  auto tap = pd.solve(0, N - 1);
  ConvexHullTrickAddMonotone<long double, true> cht;
  vector<pair<long double, long double>> lines;
  for (auto &p : tap) {
    lines.emplace_back((long double)1.0 / p.second,
                       (long double)p.first / p.second);
  }
  sort(begin(lines), end(lines));
  for (auto &p : lines) cht.add(p.first, p.second);
  long long Q;
  cin >> Q;
  vector<pair<long long, long long>> val;
  for (long long i = 0; i < Q; i++) {
    long long x;
    cin >> x;
    val.emplace_back(x, i);
  }
  sort(begin(val), end(val));
  vector<double> ans(Q);
  for (long long i = 0; i < Q; i++) {
    ans[val[i].second] = cht.query_monotone_inc(val[i].first);
  }
  cout << fixed << setprecision(10);
  for (long long i = 0; i < Q; i++) {
    cout << ans[i] << "\n";
  }
  return 0;
}