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;
const int max_n = 55, inf = 1000111222;
namespace min_cost_max_flow {
const int max_v = max_n;
const int DIJKSTRA_N2 = 1;
const int DIJKSTRA_MLOGN = 2;
const int DIJKSTRA_TYPE = DIJKSTRA_N2;
struct edge {
  int v, residual_capacity, cost;
  edge(int v, int residual_capacity, int cost)
      : v(v), residual_capacity(residual_capacity), cost(cost) {}
};
vector<edge> edges;
vector<int> g[max_v];
void add_edge(int u, int v, int f, int c) {
  g[u].push_back(edges.size());
  edges.push_back({v, f, c});
  g[v].push_back(edges.size());
  edges.push_back({u, 0, -c});
}
int phi[max_v], dist[max_v];
char used[max_v];
bool dijkstra_mlogn(int s, int t) {
  for (int i = 0; i <= t; ++i) {
    dist[i] = inf;
  }
  dist[s] = 0;
  priority_queue<pair<int, int>> q;
  q.push({0, s});
  while (!q.empty()) {
    pair<int, int> p = q.top();
    q.pop();
    const int v = p.second;
    if (-p.first != dist[v]) {
      continue;
    }
    for (int id : g[v]) {
      if (edges[id].residual_capacity == 0) {
        continue;
      }
      const int to = edges[id].v;
      if (dist[v] + phi[v] - phi[to] + edges[id].cost < dist[to]) {
        dist[to] = dist[v] + phi[v] - phi[to] + edges[id].cost;
        q.push({-dist[to], to});
      }
    }
  }
  for (int i = 0; i <= t; ++i) {
    dist[i] = min(inf, dist[i] + phi[i]);
    phi[i] = dist[i];
  }
  return dist[t] != inf;
}
bool dijkstra_n2(int s, int t) {
  for (int i = 0; i <= t; ++i) {
    dist[i] = inf;
  }
  dist[s] = 0;
  for (int i = 0; i <= t; ++i) {
    int v = -1;
    for (int j = 0; j <= t; ++j) {
      if (!used[j] && (v == -1 || dist[j] < dist[v])) {
        v = j;
      }
    }
    used[v] = 1;
    for (int id : g[v]) {
      if (edges[id].residual_capacity == 0) {
        continue;
      }
      const int to = edges[id].v;
      if (dist[v] + phi[v] - phi[to] + edges[id].cost < dist[to]) {
        dist[to] = dist[v] + phi[v] - phi[to] + edges[id].cost;
      }
    }
  }
  for (int i = 0; i <= t; ++i) {
    dist[i] = min(inf, dist[i] + phi[i]);
    phi[i] = dist[i];
    used[i] = 0;
  }
  return dist[t] != inf;
}
bool dijkstra(int s, int t) {
  if (DIJKSTRA_TYPE == 0) {
    puts("Select dijkstra type");
    exit(1);
  }
  if (DIJKSTRA_TYPE == DIJKSTRA_N2) {
    return dijkstra_n2(s, t);
  } else if (DIJKSTRA_TYPE == DIJKSTRA_MLOGN) {
    return dijkstra_mlogn(s, t);
  }
  puts("Unsupported dijkstra type");
  exit(2);
}
int start[max_v];
int dfs(int v, int t, int f) {
  if (v == t) {
    return f;
  }
  used[v] = 1;
  for (int &i = start[v]; i < g[v].size(); ++i) {
    const int id = g[v][i];
    if (edges[id].residual_capacity &&
        dist[v] + edges[id].cost == dist[edges[id].v] && !used[edges[id].v]) {
      int res = dfs(edges[id].v, t, min(f, edges[id].residual_capacity));
      if (res) {
        f -= res;
        edges[id].residual_capacity -= res;
        edges[id ^ 1].residual_capacity += res;
        used[v] = 0;
        return res;
      }
    }
  }
  used[v] = 0;
  return 0;
}
vector<int> min_cost_max_flow(int s, int t) {
  for (int i = 0; i <= t; ++i) {
    phi[i] = 0;
  }
  int res = 0;
  int it = 0;
  vector<int> v;
  while (dijkstra(s, t)) {
    memset(start, 0, sizeof(int) * (t + 1));
    int x = dfs(s, t, 1);
    res += 1LL * x * dist[t];
    v.push_back(res);
  }
  return v;
}
}  // namespace min_cost_max_flow
int n, m;
int main() {
  scanf("%d%d", &n, &m);
  while (m--) {
    int u, v, x;
    scanf("%d%d%d", &u, &v, &x);
    --u;
    --v;
    min_cost_max_flow::add_edge(u, v, 1, x);
  }
  vector<int> all = min_cost_max_flow::min_cost_max_flow(0, n - 1);
  for (int i = all.size() - 1; i; --i) {
    all[i] -= all[i - 1];
  }
  int t;
  scanf("%d", &t);
  while (t--) {
    int x;
    scanf("%d", &x);
    int i;
    for (i = 0; i + 1 < all.size(); ++i) {
      int need = (i + 1) * (all[i + 1] - all[i]);
      if (x >= need) {
        x -= need;
      } else {
        break;
      }
    }
    double res = all[i] + 1.0 * x / (i + 1);
    printf("%.12f\n", res);
  }
  return 0;
}