#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 3;
int n, sz[N], rt, ans, w[N], v[N];
double sum, val = 1e20, sumd, d[N];
vector<pair<int, int> > e[N];
void dfs(int x, int fz, int S) {
  sz[x] = 1;
  int Mx = 0;
  for (auto it : e[x])
    if (it.first != fz && !v[it.first])
      dfs(it.first, x, S), sz[x] += sz[it.first], Mx = max(Mx, sz[it.first]);
  Mx = max(Mx, S - sz[x]);
  if (Mx <= (S / 2)) rt = x;
}
void calc(int x, int fz, int o, long long len) {
  sum += pow(len, 1.5) * w[x];
  d[o] += 1.5 * pow(len, 0.5) * w[x];
  for (auto it : e[x])
    if (it.first != fz) calc(it.first, x, o, len + it.second);
}
void dfs(int x, int S) {
  dfs(x, 0, S), x = rt, dfs(x, 0, S);
  if (v[x]) return;
  v[x] = 1, sum = sumd = 0;
  for (auto it : e[x])
    d[it.first] = 0, calc(it.first, x, it.first, it.second),
    sumd += d[it.first];
  if (sum < val) ans = x, val = sum;
  for (auto it : e[x])
    if (sumd - 2 * d[it.first] < 0) {
      dfs(it.first, sz[it.first]);
      break;
    }
}
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) scanf("%d", &w[i]);
  for (int i = 1; i < n; i++) {
    int a, b, l;
    scanf("%d %d %d", &a, &b, &l);
    e[a].push_back({b, l}), e[b].push_back({a, l});
  }
  dfs(1, n);
  printf("%d %.20lf\n", ans, val);
  return 0;
}
