#include <bits/stdc++.h>
using namespace std;
const long long INF = 1e9, N = 20010, M = 200010;
long long head[N], ver[M], edge[M], nxt[M], v[N], incf[N], pre[N], cst[M];
long long n, m, sp, tp, tot;
void add(long long x, long long y, long long z, long long c) {
  ver[++tot] = y, edge[tot] = z, nxt[tot] = head[x], head[x] = tot;
  cst[tot] = c;
  ver[++tot] = x, edge[tot] = 0, nxt[tot] = head[y], head[y] = tot;
  cst[tot] = -c;
}
long long d[N];
bool vis[N];
queue<long long> q;
vector<pair<long long, long long> > FFF;
long long flow, cost;
long long spfa() {
  for (long long i = 1; i <= n; i++) d[i] = INF, vis[i] = false;
  q.push(sp);
  vis[sp] = true;
  d[sp] = 0;
  while (!q.empty()) {
    long long u = q.front();
    q.pop();
    vis[u] = false;
    for (long long i = head[u]; i != -1; i = nxt[i]) {
      long long v = ver[i];
      if (d[v] > d[u] + cst[i] && edge[i]) {
        pre[v] = i;
        d[v] = d[u] + cst[i];
        if (!vis[v]) {
          vis[v] = true;
          q.push(v);
        }
      }
    }
  }
  return d[tp] != INF;
}
void EK() {
  while (spfa()) {
    long long flw = INF;
    for (long long i = tp; i != sp; i = ver[pre[i] ^ 1])
      flw = min(flw, edge[pre[i]]);
    flow += flw;
    cost += d[tp] * flw;
    for (long long i = tp; i != sp; i = ver[pre[i] ^ 1])
      edge[pre[i]] -= flw, edge[pre[i] ^ 1] += flw;
    FFF.push_back(make_pair(flow, cost));
  }
}
long long QQ;
signed main() {
  memset(head, -1, sizeof head);
  scanf("%lld %lld", &n, &m);
  tot = 1;
  long long x, y, c;
  for (long long i = 1; i <= m; i++) {
    scanf("%lld %lld %lld", &x, &y, &c);
    add(x, y, 1, c);
  }
  sp = 1;
  tp = n;
  EK();
  scanf("%lld", &QQ);
  while (QQ--) {
    scanf("%lld", &c);
    long double res = 1.0 * INF;
    for (unsigned long long dii = 0; dii < FFF.size(); dii++)
      res = min(res, (long double)(FFF[dii].second + 1.0 * c) /
                         (long double)(FFF[dii].first));
    cout << setprecision(10) << fixed << res << endl;
  }
}
