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;
long long mod = 1000000007LL;
long long large = 2000000000000000000LL;
struct Edge {
  int from, to;
  long long cap, flow, cost;
};
struct MCMF {
  int n, m, s, t;
  vector<Edge> edges;
  vector<vector<int> > G;
  vector<int> inq;
  vector<long long> dis;
  vector<int> p;
  vector<long long> a;
  void init(int maxn) {
    n = maxn;
    G.assign(n + 10, vector<int>(0));
    edges.clear();
    inq.assign(n + 10, 0);
    dis.assign(n + 10, 1000000000);
    p.assign(n + 10, 0);
    a.assign(n + 10, 0);
  }
  void addEdge(int from, int to, long long cap, long long cost) {
    edges.push_back((Edge){from, to, cap, 0, cost});
    edges.push_back((Edge){to, from, 0, 0, -cost});
    m = (int)edges.size();
    G[from].push_back(m - 2);
    G[to].push_back(m - 1);
  }
  vector<vector<int> > path;
  vector<long long> cl;
  bool SPFA(int s, int t, long long& flow, long long& cost) {
    dis.assign(n + 10, large);
    inq.assign(n + 10, 0);
    dis[s] = 0;
    inq[s] = 1;
    p[s] = 0;
    a[s] = large;
    queue<int> q;
    q.push(s);
    while (!q.empty()) {
      int u = q.front();
      q.pop();
      inq[u] = 0;
      for (int i = 0; i < (int)G[u].size(); i++) {
        Edge& e = edges[G[u][i]];
        if (e.cap > e.flow && dis[e.to] > dis[u] + e.cost) {
          dis[e.to] = dis[u] + e.cost;
          p[e.to] = G[u][i];
          a[e.to] = min(a[u], e.cap - e.flow);
          if (!inq[e.to]) {
            q.push(e.to);
            inq[e.to] = 1;
          }
        }
      }
    }
    if (dis[t] == large) return false;
    flow += a[t];
    cost += dis[t] * a[t];
    cl.push_back(dis[t]);
    int u = t;
    vector<int> pa;
    while (u != s) {
      pa.push_back(u);
      edges[p[u]].flow += a[t];
      edges[p[u] ^ 1].flow -= a[t];
      u = edges[p[u]].from;
    }
    pa.push_back(u);
    reverse(pa.begin(), pa.end());
    path.push_back(pa);
    return true;
  }
  vector<vector<int> > flow_decomposition() {
    vector<vector<int> > path;
    while (true) {
      dis.assign(n, large);
      a.assign(n, large);
      queue<int> q;
      dis[s] = 0;
      p[s] = 0;
      q.push(s);
      while (!q.empty()) {
        int u = q.front();
        q.pop();
        for (int j = 0; j < (int)G[u].size(); j++) {
          Edge& e = edges[G[u][j]];
          if (e.flow > 0 && e.cap > 0) {
            int v = e.to;
            if (dis[v] == large) {
              q.push(v);
              dis[v] = dis[u] + 1;
              p[v] = G[u][j];
              a[v] = min(a[u], e.flow);
            }
          }
        }
      }
      if (dis[t] == large) break;
      int u = t;
      vector<int> pa;
      while (u != s) {
        pa.push_back(u);
        edges[p[u]].flow -= a[t];
        edges[p[u] ^ 1].flow += a[t];
        u = edges[p[u]].from;
      }
      pa.push_back(u);
      reverse(pa.begin(), pa.end());
      path.push_back(pa);
    }
    return path;
  }
  pair<long long, long long> mincost(int s, int t) {
    long long flow = 0, cost = 0;
    this->s = s;
    this->t = t;
    while (SPFA(s, t, flow, cost))
      ;
    return pair<long long, long long>(flow, cost);
  }
  void clearflow() {
    inq.assign(n + 10, 0);
    dis.assign(n + 10, 1000000000);
    p.assign(n + 10, 0);
    a.assign(n + 10, 0);
    for (int i = 0; i < (int)edges.size(); i++) {
      edges[i].flow = 0;
    }
  }
};
int n, m;
vector<vector<pair<int, int> > > adj;
int main() {
  ios::sync_with_stdio(false);
  cin >> n >> m;
  adj.assign(n, vector<pair<int, int> >());
  for (int i = 0; i < m; i++) {
    int x, y, z;
    cin >> x >> y >> z;
    x--;
    y--;
    adj[x].push_back(pair<int, int>(y, z));
  }
  MCMF d;
  d.init(n + 10);
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < (int)adj[i].size(); j++) {
      int v = adj[i][j].first;
      int dis = adj[i][j].second;
      d.addEdge(i, v, 1, dis);
    }
  }
  d.mincost(0, n - 1);
  vector<long long> cl = d.cl;
  cl.push_back(1000000000LL);
  int q;
  cin >> q;
  while (q--) {
    double v;
    cin >> v;
    double d = cl[0];
    for (int i = 0; i < (int)cl.size(); i++) {
      if (1LL * (i + 1) * (cl[i + 1] - cl[i]) >= v) {
        d += v / (i + 1);
        break;
      } else {
        v -= (i + 1) * (cl[i + 1] - cl[i]);
        d = cl[i + 1];
      }
    }
    cout << setprecision(10) << fixed << d << endl;
  }
  return 0;
}