#include <bits/stdc++.h>
int min(int a, int b) { return a < b ? a : b; }
int oo[1 + (50 * (50 - 1)) * 2], oh[1 + (50 * (50 - 1)) * 2];
int link(int o, int h) {
  static int _ = 1;
  oo[_] = o, oh[_] = h;
  return _++;
}
int oo_[1 + ((50 * (50 - 1)) * 3) * 2], oh_[1 + ((50 * (50 - 1)) * 3) * 2], __;
int link_(int o, int h) {
  oo_[__] = o, oh_[__] = h;
  return __++;
}
int ae[50], ae_[50], dd[50], n;
int ii[(50 * (50 - 1))], jj[(50 * (50 - 1))], ww[(50 * (50 - 1))];
char tt[(50 * (50 - 1))];
int ij[((50 * (50 - 1)) * 3)], cc[((50 * (50 - 1)) * 3) * 2], m_;
int pq[1 + 50], iq[50], cnt;
int less(int u, int v) { return dd[u] < dd[v]; }
int i2(int i) {
  return (i *= 2) > cnt ? 0 : i < cnt && less(pq[i + 1], pq[i]) ? i + 1 : i;
}
void pq_up(int u) {
  int i, j, v;
  for (i = iq[u]; (j = i / 2) && less(u, v = pq[j]); i = j) pq[iq[v] = i] = v;
  pq[iq[u] = i] = u;
}
void pq_dn(int u) {
  int i, j, v;
  for (i = iq[u]; (j = i2(i)) && less(v = pq[j], u); i = j) pq[iq[v] = i] = v;
  pq[iq[u] = i] = u;
}
void pq_add_last(int u) { pq[iq[u] = ++cnt] = u; }
int pq_remove_first() {
  int u = pq[1], v = pq[cnt--];
  if (v != u) iq[v] = 1, pq_dn(v);
  iq[u] = 0;
  return u;
}
void dijkstra(int n, int s) {
  memset(dd, 0x3f, n * sizeof *dd);
  dd[s] = 0, pq_add_last(s);
  while (cnt) {
    int i = pq_remove_first(), o;
    for (o = ae[i]; o; o = oo[o]) {
      int h = oh[o];
      if (!tt[h]) {
        int j = jj[h], d = dd[i] + ww[h];
        if (dd[j] > d) {
          if (dd[j] == 0x3f3f3f3f) pq_add_last(j);
          dd[j] = d, pq_up(j);
        }
      }
    }
  }
}
void link2(int i, int j, int c) {
  int h = m_++;
  ij[h] = i ^ j, cc[h << 1] = c, cc[h << 1 | 1] = 0;
  ae_[i] = link_(ae_[i], h << 1);
  ae_[j] = link_(ae_[j], h << 1 | 1);
}
int bfs(int s, int t) {
  static int qu[50];
  int i, head, cnt;
  for (i = 0; i < n; i++) dd[i] = n;
  head = cnt = 0;
  dd[s] = 0, qu[head + cnt++] = s;
  while (cnt) {
    int d, o;
    i = qu[cnt--, head++], d = dd[i] + 1;
    for (o = ae_[i]; o; o = oo_[o]) {
      int h_ = oh_[o];
      if (cc[h_]) {
        int h = h_ >> 1, j = i ^ ij[h];
        if (dd[j] > d) {
          dd[j] = d;
          if (j == t) return 1;
          qu[head + cnt++] = j;
        }
      }
    }
  }
  return 0;
}
int dfs(int i, int t) {
  int d, o;
  if (i == t) return 1;
  d = dd[i] + 1;
  for (o = ae_[i]; o; o = oo_[o]) {
    int h_ = oh_[o];
    if (cc[h_]) {
      int h = h_ >> 1, j = i ^ ij[h];
      if (dd[j] == d && dfs(j, t)) {
        cc[h_]--, cc[h_ ^ 1]++;
        return 1;
      }
    }
  }
  dd[i] = n;
  return 0;
}
void dinic(int s, int t) {
  while (bfs(s, t))
    while (dfs(s, t))
      ;
}
int main() {
  static double ans[100000 + 1];
  static int dd1[50], dd2[50], xx[(50 * (50 - 1))];
  int m, q, h, x;
  scanf("%d%d", &n, &m);
  for (h = 0; h < m; h++) {
    int i, j, w;
    scanf("%d%d%d", &i, &j, &w), i--, j--;
    ii[h] = i, jj[h] = j, ww[h] = w;
    ae[i] = link(ae[i], h);
  }
  x = 0;
  while (x < 100000) {
    int k, y, z, d, d_;
    memset(tt, 0, m * sizeof *tt);
    dijkstra(n, 0);
    memcpy(dd1, dd, n * sizeof *dd);
    d = dd1[n - 1];
    memset(ae_, 0, n * sizeof *ae_), __ = 1, m_ = 0;
    for (h = 0; h < m; h++) {
      int i = ii[h], j = jj[h], w = ww[h];
      if (dd1[i] + w == dd1[j]) {
        tt[h] = 1;
        link2(0, j, 1), link2(i, n - 1, 1);
        if (xx[h] == 0) link2(j, i, 1);
      }
    }
    dinic(0, n - 1);
    d_ = 0x3f3f3f3f;
    k = 0;
    for (h = 0; h < m; h++) {
      int i = ii[h], j = jj[h];
      if (tt[h]) {
        if ((dd[i] == n) == (dd[j] == n))
          tt[h] = 0;
        else if (dd[i] != n) {
          tt[h] = 1;
          k++;
        } else {
          if (xx[h] > 0) {
            tt[h] = 2;
            k--;
            d_ = min(d_, d + xx[h]);
          } else
            tt[h] = 0;
        }
      }
    }
    dijkstra(n, 0);
    memcpy(dd2, dd, n * sizeof *dd);
    d_ = min(d_, dd2[n - 1]);
    for (h = 0; h < m; h++)
      if (tt[h] == 2) d_ = min(d_, d + dd2[ii[h]] + ww[h] - dd1[jj[h]]);
    y = d_ - d <= (100000 - x) / k ? x + (d_ - d) * k : 100000;
    for (z = x; z <= y; z++) ans[z] = d + (double)(z - x) / k;
    if (y < 100000) {
      for (h = 0; h < m; h++)
        if (tt[h] == 1)
          ww[h] += d_ - d, xx[h] += d_ - d;
        else if (tt[h] == 2)
          ww[h] -= d_ - d, xx[h] -= d_ - d;
    }
    x = y;
  }
  scanf("%d", &q);
  while (q--) {
    scanf("%d", &x);
    printf("%f\n", ans[x]);
  }
  return 0;
}
