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;
int N, M;
map<double, double> step;
template <int NV, class V>
class MinCostFlow {
 public:
  struct edge {
    int to;
    V capacity;
    V cost;
    int reve;
  };
  vector<edge> E[NV];
  int prev_v[NV], prev_e[NV];
  V dist[NV];
  void add_edge(int x, int y, V cap, V cost) {
    E[x].push_back((edge){y, cap, cost, (int)E[y].size()});
    E[y].push_back((edge){x, 0, -cost, (int)E[x].size() - 1});
  }
  V mincost(int from, int to, signed long long flow) {
    V res = 0;
    int i, v;
    memset(prev_v, 0, sizeof(prev_v));
    memset(prev_e, 0, sizeof(prev_e));
    while (flow > 0) {
      fill(dist, dist + NV, numeric_limits<V>::max() / 2);
      dist[from] = 0;
      priority_queue<pair<V, int> > Q;
      Q.push(make_pair(0, from));
      while (Q.size()) {
        V d = -Q.top().first;
        int cur = Q.top().second;
        Q.pop();
        if (dist[cur] != d) continue;
        if (d == numeric_limits<V>::max() / 2) break;
        for (i = 0; i < (E[cur].size()); i++) {
          edge& e = E[cur][i];
          if (e.capacity > 0 && dist[e.to] > d + e.cost) {
            dist[e.to] = d + e.cost;
            prev_v[e.to] = cur;
            prev_e[e.to] = i;
            Q.push(make_pair(-dist[e.to], e.to));
          }
        }
      }
      if (dist[to] == numeric_limits<V>::max() / 2) return -1;
      V lc = flow;
      for (v = to; v != from; v = prev_v[v])
        lc = min(lc, E[prev_v[v]][prev_e[v]].capacity);
      flow -= lc;
      res += lc * dist[to];
      step[dist[to]] += lc;
      for (v = to; v != from; v = prev_v[v]) {
        edge& e = E[prev_v[v]][prev_e[v]];
        e.capacity -= lc;
        E[v][e.reve].capacity += lc;
      }
    }
    return res;
  }
};
MinCostFlow<51, double> mcf;
double ret[101010];
int Q;
void solve() {
  int i, j, k, l, r, x, y;
  string s;
  cin >> N >> M;
  for (i = 0; i < (M); i++) {
    cin >> x >> y >> r;
    mcf.add_edge(x - 1, y - 1, 1, r);
  }
  mcf.mincost(0, N - 1, 1e9);
  step[1e9] = 1e9;
  double now = step.begin()->first;
  double cap = step.begin()->second;
  step.erase(step.begin());
  for (i = 0; i < (101000); i++) {
    ret[i] = now;
    double vol = 1.0;
    while (now + vol / cap >= step.begin()->first) {
      vol -= (step.begin()->first - now) * cap;
      now = step.begin()->first;
      cap += step.begin()->second;
      step.erase(step.begin());
    }
    now += vol / cap;
  }
  cin >> Q;
  while (Q--) {
    cin >> x;
    (void)printf("%.12lf\n", ret[x]);
  }
}
int main(int argc, char** argv) {
  string s;
  int i;
  if (argc == 1) ios::sync_with_stdio(false), cin.tie(0);
  for (i = 0; i < (argc - 1); i++) s += argv[i + 1], s += '\n';
  for (i = 0; i < (s.size()); i++) ungetc(s[s.size() - 1 - i], stdin);
  cout.tie(0);
  solve();
  return 0;
}