#include <bits/stdc++.h>
using namespace std;
inline int read() {
  int x = 0;
  char ch = getchar();
  while (!isdigit(ch)) ch = getchar();
  while (isdigit(ch)) x = x * 10 + ch - '0', ch = getchar();
  return x;
}
int tot = 1;
int fir[61], nex[100010], got[100010], tak[100010], cst[100010];
inline void AddEdge(int x, int y, int z = 0, int w = 0) {
  nex[++tot] = fir[x], fir[x] = tot, got[tot] = y, tak[tot] = z, cst[tot] = w;
}
int vis[61], dis[61], que[100010], pre[61];
inline int spfa(int s, int t, int n) {
  int l = 1, r = 1;
  for (int i = 1; i <= n; i++) vis[i] = false, dis[i] = 1073741823, pre[i] = 0;
  que[1] = s, dis[s] = 0;
  while (l <= r) {
    int x = que[l];
    for (int i = fir[x]; i; i = nex[i]) {
      int y = got[i], w = cst[i];
      if (!tak[i] || dis[x] + w >= dis[y]) continue;
      dis[y] = dis[x] + w, pre[y] = i;
      if (!vis[y]) vis[y] = true, que[++r] = y;
    }
    ++l, vis[x] = false;
  }
  return dis[t] != 1073741823;
}
inline int getflow(int s, int t) {
  int flow = 1073741823;
  for (int i = t; i != s; i = got[pre[i] ^ 1]) {
    flow = min(flow, tak[pre[i]]);
  }
  return flow;
}
inline void update(int s, int t, int flow, int &maxflow, int &mincost) {
  maxflow += flow, mincost += flow * dis[t];
  for (int i = t; i != s; i = got[pre[i] ^ 1]) {
    tak[pre[i]] -= flow, tak[pre[i] ^ 1] += flow;
  }
}
vector<pair<int, int>> vec;
inline pair<int, int> solve(int s, int t, int n) {
  int maxflow = 0, mincost = 0;
  while (spfa(s, t, n)) {
    update(s, t, getflow(s, t), maxflow, mincost);
    vec.push_back(make_pair(maxflow, mincost));
  }
  return make_pair(maxflow, mincost);
}
int main() {
  int n = read(), m = read();
  for (int i = 1; i <= m; i++) {
    int x = read(), y = read(), w = read();
    AddEdge(x, y, 1, w), AddEdge(y, x, 0, -w);
  }
  pair<int, int> res = solve(1, n, n);
  int q = read();
  while (q--) {
    int x = read();
    double res = 1e18;
    for (auto tmp : vec)
      res = min(res, (double)(x + tmp.second) / (double)tmp.first);
    printf("%0.10lf\n", res);
  }
  return 0;
}
