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 <class T>
int getbit(T s, int i) {
  return (s >> i) & 1;
}
template <class T>
T onbit(T s, int i) {
  return s | (T(1) << i);
}
template <class T>
T offbit(T s, int i) {
  return s & (~(T(1) << i));
}
template <class T>
int cntbit(T s) {
  return __builtin_popcountll(s);
}
template <class T>
T gcd(T a, T b) {
  T r;
  while (b != 0) {
    r = a % b;
    a = b;
    b = r;
  }
  return a;
}
template <class T>
T lcm(T a, T b) {
  return a / gcd(a, b) * b;
}
struct MincostFlow {
  int n, s, t, E, adj[5005], next[5005], last[2555], which[2555];
  long long totalCost, totalFlow, cap[5005], flow[5005], cost[5005], pot[5005],
      dist[2555];
  void init(int _n, int _s, int _t) {
    n = _n;
    s = _s;
    t = _t;
    memset(adj, 0, sizeof(adj));
    memset(next, 0, sizeof(next));
    memset(which, 0, sizeof(which));
    memset(cap, 0, sizeof(cap));
    memset(flow, 0, sizeof(flow));
    memset(cost, 0, sizeof(cost));
    memset(pot, 0, sizeof(pot));
    memset(dist, 0, sizeof(dist));
    memset(last, -1, sizeof(last));
    E = 0;
  }
  void add(int u, int v, long long ca, long long co) {
    adj[E] = v;
    cap[E] = ca;
    flow[E] = 0;
    cost[E] = +co;
    next[E] = last[u];
    last[u] = E++;
    adj[E] = u;
    cap[E] = 0;
    flow[E] = 0;
    cost[E] = -co;
    next[E] = last[v];
    last[v] = E++;
  }
  void bellman() {
    bool stop = false;
    memset(pot, 0, sizeof(pot));
    while (!stop) {
      stop = true;
      for (int u = 0; u < (n); ++u)
        for (int e = last[u]; e != -1; e = next[e])
          if (flow[e] < cap[e]) {
            int v = adj[e];
            if (pot[v] > pot[u] + cost[e]) {
              pot[v] = pot[u] + cost[e];
              stop = false;
            }
          }
    }
  }
  bool dijkstra() {
    priority_queue<pair<long long, int>, vector<pair<long long, int> >,
                   greater<pair<long long, int> > >
        que;
    for (int u = 0; u < (n); ++u) dist[u] = (1ll << 60);
    dist[s] = 0;
    que.push(make_pair(0, s));
    while (!que.empty()) {
      long long dnow = que.top().first;
      int u = que.top().second;
      que.pop();
      if (dnow > dist[u]) continue;
      for (int e = last[u]; e != -1; e = next[e])
        if (flow[e] < cap[e]) {
          int v = adj[e];
          long long dnext = dnow + cost[e] + pot[u] - pot[v];
          if (dist[v] > dnext) {
            dist[v] = dnext;
            which[v] = e;
            que.push(make_pair(dnext, v));
          }
        }
    }
    return dist[t] < (1ll << 60);
  }
  bool maxflow(long long desireFlow = (1ll << 60)) {
    totalCost = totalFlow = 0;
    bellman();
    while (totalFlow < desireFlow) {
      if (!dijkstra()) return false;
      long long delta = desireFlow - totalFlow;
      for (int v = t, e = which[v]; v != s; v = adj[e ^ 1], e = which[v])
        delta = min(delta, cap[e] - flow[e]);
      for (int v = t, e = which[v]; v != s; v = adj[e ^ 1], e = which[v]) {
        flow[e] += delta;
        flow[e ^ 1] -= delta;
      }
      totalFlow += delta;
      totalCost += delta * (dist[t] - pot[s] + pot[t]);
      for (int u = 0; u < (n); ++u) pot[u] += dist[u];
    }
    return true;
  }
} mcf;
int n, m, a[5005], b[5005], c[5005];
long long f[2555];
void sol() {
  cin >> n >> m;
  for (int i = (1); i <= (m); ++i) {
    cin >> a[i] >> b[i] >> c[i];
    a[i]--;
    b[i]--;
  }
  memset(f, 0x3f, sizeof(f));
  for (int t = (1); t <= (n); ++t) {
    mcf.init(n + 1, 0, n);
    for (int i = (1); i <= (m); ++i) {
      mcf.add(a[i], b[i], 1, c[i]);
    }
    mcf.add(n - 1, n, t, 0);
    mcf.maxflow();
    if (mcf.totalFlow < t)
      break;
    else
      f[t] = mcf.totalCost;
  }
  long long q, x;
  cin >> q;
  cout << fixed << setprecision(9);
  for (int run = 0; run < (q); ++run) {
    cin >> x;
    long double res = (1ll << 60);
    for (int t = (1); t <= (n); ++t) {
      res = min(res, (f[t] + x) * (long double)(1.0) / t);
    }
    cout << res << "\n";
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  sol();
  return 0;
}