#include <bits/stdc++.h>
using namespace std;
namespace RA {
int r(int p) { return 1ll * rand() * rand() % p; }
int r(int L, int R) { return r(R - L + 1) + L; }
}  // namespace RA
const int N = 52, M = N * (N - 1) * 2, INF = 0x3f3f3f3f;
struct qxx {
  int nex, t, v, c;
} e[M];
int h[N], le = 1;
void add_path(int f, int t, int v, int c) {
  e[++le] = {h[f], t, v, c}, h[f] = le;
}
void add_flow(int f, int t, int v, int c) {
  add_path(f, t, v, c), add_path(t, f, 0, -c);
}
int s, t;
bool vis[N];
int incf[N], pre[N];
int d[N];
queue<int> q;
bool spfa() {
  memset(d, -0x3f, sizeof(d));
  d[s] = 0;
  incf[s] = INF, incf[t] = 0;
  q.push(s);
  while (!q.empty()) {
    int u = q.front();
    q.pop();
    vis[u] = 0;
    for (int i = h[u]; i; i = e[i].nex) {
      const int v = e[i].t, w = e[i].v, c = e[i].c;
      if (!w || d[v] >= d[u] + c) continue;
      d[v] = d[u] + c, incf[v] = min(w, incf[u]), pre[v] = i;
      if (!vis[v]) q.push(v), vis[v] = 1;
    }
  }
  return incf[t];
}
int maxcost = 0;
void update() {
  maxcost += d[t];
  for (int u = t; u != s; u = e[pre[u] ^ 1].t) {
    e[pre[u]].v--;
    e[pre[u] ^ 1].v++;
  }
}
int n, m;
int f[N], lf;
double F(int X, int x) { return (X - f[x]) * 1.0 / x; }
double query(int x) {
  int l = 1, r = lf;
  while (l < r) {
    int mid = (l + r) >> 1;
    if (F(x, mid + 1) - F(x, mid) < 0)
      l = mid + 1;
    else
      r = mid;
  };
  ;
  return F(x, l);
}
int main() {
  scanf("%d%d", &n, &m);
  s = 1, t = n;
  bool fl = 0;
  for (int i = (1); i <= (m); ++i) {
    int u, v, w;
    scanf("%d%d%d", &u, &v, &w);
    if (u == 1 && v == 2 && w == 1) fl = 1;
    add_flow(u, v, 1, -w);
  }
  while (spfa()) {
    update(), f[++lf] = maxcost;
  }
  f[lf + 1] = -0x3f3f3f3f;
  ;
  ;
  for (int i = (1); i <= (lf); ++i)
    ;
  ;
  int q;
  scanf("%d", &q);
  for (int i = (1); i <= (q); ++i) {
    int x;
    scanf("%d", &x);
    printf("%.10lf\n", query(x));
  }
  return 0;
}
