#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 10;
const double inf = 1e20;
int n, m, rt, ans, w[N], siz[N];
bool vis[N];
double sum, sdt, dt[N], Sum = inf;
vector<int> G[N], W[N];
void dfs(int x, int f, int S) {
  siz[x] = 1;
  int mxs = 0;
  for (int i = G[x].size(), y; i; i--) {
    y = G[x][i - 1];
    if (y == f || vis[y]) continue;
    dfs(y, x, S);
    siz[x] += siz[y];
    mxs = max(siz[y], mxs);
  }
  mxs = max(S - siz[x], mxs);
  if (mxs <= (S >> 1)) rt = x;
}
void calc(int x, int f, int o, int dis) {
  sum += pow(dis, 1.5) * w[x];
  dt[o] += 1.5 * pow(dis, 0.5) * w[x];
  for (int i = G[x].size(), y, z; i; i--) {
    y = G[x][i - 1], z = W[x][i - 1];
    if (y == f) continue;
    calc(y, x, o, dis + z);
  }
}
void solve(int x, int S) {
  dfs(x, 0, S);
  x = rt;
  sum = sdt = 0;
  for (int i = G[x].size(), y, z; i; i--) {
    y = G[x][i - 1], z = W[x][i - 1];
    dt[y] = 0;
    calc(y, x, y, z);
    sdt += dt[y];
  }
  if (Sum > sum) Sum = sum, ans = x;
  vis[x] = 1;
  for (int i = G[x].size(), y; i; i--) {
    y = G[x][i - 1];
    if (sdt - 2 * dt[y] >= 0 || vis[y]) continue;
    solve(y, siz[y] > siz[x] ? S - siz[x] : siz[y]);
  }
}
signed main() {
  cin >> n;
  for (int i = 1; i <= n; i++) scanf("%d", w + i);
  for (int i = 1, u, v, w; i < n; i++) {
    scanf("%d%d%d", &u, &v, &w);
    G[u].push_back(v), W[u].push_back(w);
    G[v].push_back(u), W[v].push_back(w);
  }
  solve(1, n);
  printf("%d %.15lf\n", ans, Sum);
  return 0;
}
