#include <bits/stdc++.h>
using namespace std;
template <typename T>
inline void read(T& x) {
  x = 0;
  bool w = 1;
  char c = getchar();
  while (!isdigit(c)) {
    if (c == '-') w = 0;
    c = getchar();
  }
  while (isdigit(c)) {
    x = x * 10 + c - '0';
    c = getchar();
  }
  x = w ? x : -x;
}
const long long N = 1e5 + 10;
const long long inf = 1e18;
long long n, q, s, t, ans, rt = 1, d[N], dis[2][N], f[N];
vector<long long> G[N], W[N], val, pos;
void dfs1(long long x, long long fa, long long o) {
  for (long long i = G[x].size(), y; i; i--) {
    y = G[x][i - 1];
    if (y == fa) continue;
    dis[o][y] = dis[o][x] + W[x][i - 1];
    dfs1(y, x, o);
  }
}
void dfs(long long x, long long fa, long long l) {
  val.push_back(d[x]);
  pos.push_back(x);
  f[x] = 1;
  f[pos[lower_bound(val.begin(), val.end(), d[x] - l) - val.begin() - 1]]--;
  for (long long i = G[x].size(), y; i; i--) {
    y = G[x][i - 1];
    if (y == fa) continue;
    dfs(y, x, l);
    f[x] += f[y];
  }
  ans = max(ans, f[x]);
  val.pop_back(), pos.pop_back();
}
signed main() {
  read(n);
  for (long long i = 1; i < n; i++) {
    long long x, y, z;
    read(x), read(y), read(z);
    G[x].push_back(y), W[x].push_back(z);
    G[y].push_back(x), W[y].push_back(z);
  }
  dfs1(1, 0, 0);
  for (long long i = 1; i <= n; i++)
    if (dis[0][i] > dis[0][s]) s = i;
  memset(dis, 0, sizeof(dis));
  dfs1(s, 0, 0);
  for (long long i = 1; i <= n; i++)
    if (dis[0][i] > dis[0][t]) t = i;
  dfs1(t, 0, 1);
  for (long long i = 1; i <= n; i++) {
    d[i] = max(dis[0][i], dis[1][i]);
    if (d[i] < d[rt]) rt = i;
  }
  val.push_back(-inf), pos.push_back(0);
  read(q);
  while (q--) {
    long long x;
    read(x);
    ans = 0;
    dfs(rt, 0, x);
    cout << ans << endl;
  }
  return 0;
}
