#include <bits/stdc++.h>
using namespace std;
const int N = 3000 + 10;
namespace MCMF {
const int INF = 0x3f3f3f3f;
int cnt = 1, S, T, pre[N], id[N], b[N];
int dis[N], h[N];
bool vis[N];
struct node {
  int v, c;
  int w;
  int nex;
} e[N * 4];
void addedge(int u, int v, int c, int w) {
  e[++cnt] = node{v, c, w, b[u]};
  b[u] = cnt;
  e[++cnt] = node{u, 0, -w, b[v]};
  b[v] = cnt;
}
void init(int n) {
  cnt = 1;
  S = 0, T = n - 1;
  for (int i = 0; i < n; i++) b[i] = -1;
}
vector<int> mcmf() {
  priority_queue<pair<int, int>, vector<pair<int, int> >,
                 greater<pair<int, int> > >
      Q;
  int maxflow = 0;
  int cost = 0;
  vector<int> ans;
  while (1) {
    for (int i = S; i <= T; i++) dis[i] = INF;
    Q.push(pair<int, int>{0, S});
    dis[S] = 0;
    while (!Q.empty()) {
      pair<int, int> q = Q.top();
      Q.pop();
      int now = q.second;
      if (dis[now] < q.first) continue;
      for (int i = b[now]; i != -1; i = e[i].nex) {
        if (e[i].c < 0) continue;
        if (e[i].c > 0 &&
            dis[e[i].v] > dis[now] + e[i].w + h[now] - h[e[i].v]) {
          dis[e[i].v] = dis[now] + e[i].w + h[now] - h[e[i].v];
          pre[e[i].v] = now;
          id[e[i].v] = i;
          Q.push(pair<int, int>{dis[e[i].v], e[i].v});
        }
      }
    }
    if (dis[T] == INF) break;
    int flow = 1;
    for (int i = T; i != S; i = pre[i]) flow = min(flow, e[id[i]].c);
    maxflow += flow;
    cost += flow * (dis[T] - h[S] + h[T]);
    ans.push_back(flow * (dis[T] - h[S] + h[T]));
    for (int i = T; i != S; i = pre[i]) {
      e[id[i]].c -= flow;
      e[id[i] ^ 1].c += flow;
    }
    for (int i = S; i <= T; ++i) {
      h[i] += dis[i];
    }
  }
  return ans;
}
};  // namespace MCMF
int main() {
  ios::sync_with_stdio(0);
  int n, m;
  cin >> n >> m;
  MCMF::init(n);
  while (m--) {
    int u, v, w;
    cin >> u >> v >> w;
    MCMF::addedge(u - 1, v - 1, 1, w);
  }
  vector<int> res = MCMF::mcmf();
  vector<double> vec = {0};
  for (int i = 1; i < (int)res.size(); i++) {
    vec.push_back(vec.back() + 1.0 * (res[i] - res[i - 1]) * i);
  }
  int q;
  cin >> q;
  while (q--) {
    int x;
    cin >> x;
    int pos = upper_bound(vec.begin(), vec.end(), x) - vec.begin() - 1;
    cout << fixed << setprecision(10);
    cout << res[pos] + (x - vec[pos]) / (pos + 1) << endl;
  }
}
