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;
struct MCMF {
  using F = int;
  using C = int;
  struct Edge {
    int to, rev;
    F f;
    C cost;
  };
  int n;
  vector<C> p, dist;
  vector<pair<int, int>> pre;
  vector<vector<Edge>> adj;
  vector<pair<long long, C>> ans;
  void init(int _n) {
    n = _n;
    p.resize(n);
    dist.resize(n);
    pre.resize(n);
    adj.resize(n);
  }
  void ae(int u, int v, F cap, C cost) {
    adj[u].push_back({v, (int)adj[v].size(), cap, cost});
    adj[v].push_back({u, (int)adj[u].size() - 1, 0, -cost});
  }
  bool path(int s, int t) {
    const C INF = numeric_limits<C>::max();
    dist.assign(n, INF);
    using T = pair<C, int>;
    priority_queue<T, vector<T>, greater<T>> todo;
    todo.push({dist[s] = 0, s});
    while (!todo.empty()) {
      T x = todo.top();
      todo.pop();
      if (x.first > dist[x.second]) continue;
      for (auto& e : adj[x.second]) {
        if (e.f && dist[e.to] > x.first + e.cost + p[x.second] - p[e.to])
          dist[e.to] = x.first + e.cost + p[x.second] - p[e.to],
          pre[e.to] = {x.second, e.rev}, todo.push({dist[e.to], e.to});
      }
    }
    return dist[t] != INF;
  }
  pair<F, C> maxFlow(int s, int t) {
    for (int x = 0; x < n; x++)
      for (int i = 0; i < n; i++)
        for (auto& e : adj[i])
          if (e.f) p[e.to] = min(p[e.to], p[i] + e.cost);
    F totFlow = 0;
    C totCost = 0;
    while (path(s, t)) {
      for (int i = 0; i < n; i++) p[i] += dist[i];
      ans.push_back({1ll * totFlow * (p[t] - p[s]) - totCost, (p[t] - p[s])});
      F df = numeric_limits<F>::max();
      for (int x = t; x != s; x = pre[x].first) {
        Edge& e = adj[pre[x].first][adj[x][pre[x].second].rev];
        df = min(df, e.f);
      }
      totFlow += df, totCost += (p[t] - p[s]) * df;
      for (int x = t; x != s; x = pre[x].first) {
        Edge& e = adj[x][pre[x].second];
        e.f += df;
        adj[pre[x].first][e.rev].f -= df;
      }
    }
    ans.push_back({1ll * totFlow * dist[t] - totCost, dist[t]});
    return {totFlow, totCost};
  }
} mcmf;
int n, m, q;
int main() {
  cout << fixed << setprecision(10);
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cin >> n >> m;
  mcmf.init(n);
  for (int i = 0; i < m; i++) {
    int u, v, w;
    cin >> u >> v >> w;
    --u;
    --v;
    mcmf.ae(u, v, 1, w);
  }
  mcmf.maxFlow(0, n - 1);
  cin >> q;
  while (q--) {
    long long x;
    cin >> x;
    auto it = lower_bound(mcmf.ans.begin(), mcmf.ans.end(),
                          pair<long long, int>{x + 1, 0});
    long double ans = (long double)1.0 *
                      ((it - 1)->second * (it->first - x) +
                       it->second * (x - (it - 1)->first)) /
                      (it->first - (it - 1)->first);
    cout << ans << endl;
  }
}