#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int N = 55;
int n, m, q;
vector<pair<int, int>> ff;
int fn, s, t;
vector<int> e[N], v, flow, cost;
inline void add(int uu, int vv, int ff, int cc) {
  e[uu].push_back(v.size());
  v.push_back(vv);
  flow.push_back(ff);
  cost.push_back(cc);
  e[vv].push_back(v.size());
  v.push_back(uu);
  flow.push_back(0);
  cost.push_back(-cc);
}
int dep[N], p[N], vis[N];
int bfs() {
  for (int i = 1; i <= fn; i++) dep[i] = INT_MAX, vis[i] = 0;
  queue<int> q;
  q.push(s);
  vis[s] = 1;
  dep[s] = 0;
  while (!q.empty()) {
    int nd = q.front();
    q.pop();
    vis[nd] = 0;
    for (auto &i : e[nd])
      if (flow[i] && dep[v[i]] > dep[nd] + cost[i]) {
        dep[v[i]] = dep[nd] + cost[i];
        p[v[i]] = i;
        cerr << v[i] << "X" << dep[v[i]] << endl;
        if (!vis[v[i]]) vis[v[i]] = 1, q.push(v[i]);
      }
  }
  return dep[t] < INT_MAX;
}
int flw, cst;
void EK() {
  while (bfs()) {
    int fl = INT_MAX;
    for (int i = t; i != s; i = v[p[i] ^ 1]) fl = min(fl, flow[p[i]]);
    flw += fl;
    cst += dep[t] * fl;
    for (int i = t; i != s; i = v[p[i] ^ 1])
      flow[p[i]] -= fl, flow[p[i] ^ 1] += fl;
    ff.push_back({flw, cst});
  }
}
int main() {
  ios::sync_with_stdio(false);
  cin >> n >> m;
  int t1, t2, t3;
  for (int i = 1; i <= m; i++) cin >> t1 >> t2 >> t3, add(t1, t2, 1, t3);
  s = 1;
  t = fn = n;
  EK();
  cin >> q;
  while (q--) {
    int x;
    cin >> x;
    double ret = DBL_MAX;
    for (auto &i : ff) ret = min(ret, (i.second + x) * 1.0 / i.first);
    printf("%.10lf\n", ret);
  }
  return 0;
}
