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;
double PI = 3.141592653589793238462643383279;
const double EPS = 1e-9;
const long long MOD = 1000000007;
const int inf = 1 << 30;
const long long linf = 1LL << 60;
namespace MIN_COST_FLOW {
struct edge {
  int to, cap, cost, rev;
};
int V;
vector<edge> G[51];
int h[51];
int dist[51];
int prevv[51], preve[51];
void init(int n) { V = n; }
void add_edge(int from, int to, int cap, int cost) {
  G[from].push_back((edge){to, cap, cost, (int)G[to].size()});
  G[to].push_back((edge){from, 0, -cost, (int)G[from].size() - 1});
}
vector<pair<double, double> > min_cost_flow(int s, int t) {
  int res = 0;
  fill(h, h + V, 0);
  int f = 0;
  vector<pair<double, double> > ret;
  while (true) {
    priority_queue<pair<int, int>, vector<pair<int, int> >,
                   greater<pair<int, int> > >
        que;
    fill(dist, dist + V, inf);
    dist[s] = 0;
    que.push(pair<int, int>(0, s));
    while (!que.empty()) {
      pair<int, int> 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 && dist[e.to] > dist[v] + e.cost + h[v] - h[e.to]) {
          dist[e.to] = dist[v] + e.cost + h[v] - h[e.to];
          prevv[e.to] = v;
          preve[e.to] = i;
          que.push(pair<int, int>(dist[e.to], e.to));
        }
      }
    }
    if (dist[t] == inf) {
      break;
    }
    for (int v = 0; v < V; v++) h[v] += dist[v];
    int d = inf;
    for (int v = t; v != s; v = prevv[v]) {
      d = min(d, G[prevv[v]][preve[v]].cap);
    }
    f += d;
    res += d * h[t];
    ret.push_back(pair<double, double>(f, res));
    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;
    }
  }
  return ret;
}
};  // namespace MIN_COST_FLOW
int n, m;
int main() {
  scanf("%d%d", &n, &m);
  MIN_COST_FLOW::init(n);
  for (int i = 0; i < (int)m; i++) {
    int u, v, w;
    scanf("%d%d%d", &u, &v, &w);
    MIN_COST_FLOW::add_edge(u - 1, v - 1, 1, w);
  }
  vector<pair<double, double> > vp = MIN_COST_FLOW::min_cost_flow(0, n - 1);
  sort(vp.begin(), vp.end());
  int q;
  scanf("%d", &q);
  vector<int> x(q), xi(q);
  vector<double> ans(q);
  for (int i = 0; i < (int)q; i++) {
    scanf("%d", &x[i]);
  }
  iota(xi.begin(), xi.end(), 0);
  sort(xi.begin(), xi.end(),
       [&](const int& l, const int& r) { return x[l] < x[r]; });
  int now = 0;
  for (int i : xi) {
    double val = (x[i] + vp[now].second) / vp[now].first;
    while (now + 1 < (int)vp.size()) {
      double nval = (x[i] + vp[now + 1].second) / vp[now + 1].first;
      if (nval < val) {
        now++;
        val = nval;
      } else {
        break;
      }
    }
    ans[i] = val;
  }
  for (double d : ans) printf("%.15f\n", d);
}