#include <bits/stdc++.h>
using namespace std;
template <class T>
int getbit(T s, int i) {
  return (s >> i) & 1;
}
template <class T>
T onbit(T s, int i) {
  return s | (T(1) << i);
}
template <class T>
T offbit(T s, int i) {
  return s & (~(T(1) << i));
}
template <class T>
int cntbit(T s) {
  return __builtin_popcountll(s);
}
template <class T>
T gcd(T a, T b) {
  T r;
  while (b != 0) {
    r = a % b;
    a = b;
    b = r;
  }
  return a;
}
template <class T>
T lcm(T a, T b) {
  return a / gcd(a, b) * b;
}
struct MincostFlow {
  int n, s, t, E, adj[5005], next[5005], last[2555], which[2555];
  long long totalCost, totalFlow, cap[5005], flow[5005], cost[5005], pot[5005],
      dist[2555];
  void init(int _n, int _s, int _t) {
    n = _n;
    s = _s;
    t = _t;
    memset(adj, 0, sizeof(adj));
    memset(next, 0, sizeof(next));
    memset(which, 0, sizeof(which));
    memset(cap, 0, sizeof(cap));
    memset(flow, 0, sizeof(flow));
    memset(cost, 0, sizeof(cost));
    memset(pot, 0, sizeof(pot));
    memset(dist, 0, sizeof(dist));
    memset(last, -1, sizeof(last));
    E = 0;
  }
  void add(int u, int v, long long ca, long long co) {
    adj[E] = v;
    cap[E] = ca;
    flow[E] = 0;
    cost[E] = +co;
    next[E] = last[u];
    last[u] = E++;
    adj[E] = u;
    cap[E] = 0;
    flow[E] = 0;
    cost[E] = -co;
    next[E] = last[v];
    last[v] = E++;
  }
  void bellman() {
    bool stop = false;
    memset(pot, 0, sizeof(pot));
    while (!stop) {
      stop = true;
      for (int u = 0; u < (n); ++u)
        for (int e = last[u]; e != -1; e = next[e])
          if (flow[e] < cap[e]) {
            int v = adj[e];
            if (pot[v] > pot[u] + cost[e]) {
              pot[v] = pot[u] + cost[e];
              stop = false;
            }
          }
    }
  }
  bool dijkstra() {
    priority_queue<pair<long long, int>, vector<pair<long long, int> >,
                   greater<pair<long long, int> > >
        que;
    for (int u = 0; u < (n); ++u) dist[u] = (1ll << 60);
    dist[s] = 0;
    que.push(make_pair(0, s));
    while (!que.empty()) {
      long long dnow = que.top().first;
      int u = que.top().second;
      que.pop();
      if (dnow > dist[u]) continue;
      for (int e = last[u]; e != -1; e = next[e])
        if (flow[e] < cap[e]) {
          int v = adj[e];
          long long dnext = dnow + cost[e] + pot[u] - pot[v];
          if (dist[v] > dnext) {
            dist[v] = dnext;
            which[v] = e;
            que.push(make_pair(dnext, v));
          }
        }
    }
    return dist[t] < (1ll << 60);
  }
  bool maxflow(long long desireFlow = (1ll << 60)) {
    totalCost = totalFlow = 0;
    bellman();
    while (totalFlow < desireFlow) {
      if (!dijkstra()) return false;
      long long delta = desireFlow - totalFlow;
      for (int v = t, e = which[v]; v != s; v = adj[e ^ 1], e = which[v])
        delta = min(delta, cap[e] - flow[e]);
      for (int v = t, e = which[v]; v != s; v = adj[e ^ 1], e = which[v]) {
        flow[e] += delta;
        flow[e ^ 1] -= delta;
      }
      totalFlow += delta;
      totalCost += delta * (dist[t] - pot[s] + pot[t]);
      for (int u = 0; u < (n); ++u) pot[u] += dist[u];
    }
    return true;
  }
} mcf;
int n, m, a[5005], b[5005], c[5005];
long long f[2555];
void sol() {
  cin >> n >> m;
  for (int i = (1); i <= (m); ++i) {
    cin >> a[i] >> b[i] >> c[i];
    a[i]--;
    b[i]--;
  }
  memset(f, 0x3f, sizeof(f));
  for (int t = (1); t <= (n); ++t) {
    mcf.init(n + 1, 0, n);
    for (int i = (1); i <= (m); ++i) {
      mcf.add(a[i], b[i], 1, c[i]);
    }
    mcf.add(n - 1, n, t, 0);
    mcf.maxflow();
    if (mcf.totalFlow < t)
      break;
    else
      f[t] = mcf.totalCost;
  }
  long long q, x;
  cin >> q;
  cout << fixed << setprecision(9);
  for (int run = 0; run < (q); ++run) {
    cin >> x;
    long double res = (1ll << 60);
    for (int t = (1); t <= (n); ++t) {
      res = min(res, (f[t] + x) * (long double)(1.0) / t);
    }
    cout << res << "\n";
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  sol();
  return 0;
}
