#include <bits/stdc++.h>
using namespace std;
const int maxn = 2E5 + 5;
int n;
int size, head[maxn];
int root, sum[maxn], maxp[maxn];
int ans1;
bool vis[maxn];
long double ans2 = 1E100, w[maxn];
long double g[maxn];
struct edge {
  int to, next;
  long double w;
} E[maxn * 2];
inline void add(int u, int v, long double w) {
  E[++size].to = v;
  E[size].next = head[u];
  E[size].w = w;
  head[u] = size;
}
void findroot(int u, int F, int tot) {
  sum[u] = 1;
  maxp[u] = 0;
  for (int i = head[u]; i; i = E[i].next) {
    int v = E[i].to;
    if (v == F || vis[v]) continue;
    findroot(v, u, tot);
    sum[u] += sum[v];
    maxp[u] = max(maxp[u], sum[v]);
  }
  maxp[u] = max(maxp[u], tot - sum[u]);
  if (maxp[u] < maxp[root]) root = u;
}
void dfs(int u, int F, long double d, int source) {
  g[source] += w[u] * sqrt(d);
  for (int i = head[u]; i; i = E[i].next) {
    int v = E[i].to;
    if (v == F) continue;
    dfs(v, u, d + E[i].w, source);
  }
}
long double get(int u, int F, long double d) {
  long double s = w[u] * d * sqrt(d);
  for (int i = head[u]; i; i = E[i].next) {
    int v = E[i].to;
    if (v == F) continue;
    s += get(v, u, d + E[i].w);
  }
  return s;
}
void solve(int u) {
  if (vis[u]) return;
  vis[u] = 1;
  long double d = get(u, u, 0);
  if (d < ans2) ans1 = u, ans2 = d;
  long double tot = 0;
  for (int i = head[u]; i; i = E[i].next) {
    int v = E[i].to;
    g[v] = 0;
    dfs(v, u, E[i].w, v);
    tot += g[v];
  }
  for (int i = head[u]; i; i = E[i].next) {
    int v = E[i].to;
    if (tot - 2 * g[v] < 0) {
      root = 0;
      findroot(v, u, sum[v]);
      solve(root);
      break;
    }
  }
}
int main() {
  ios::sync_with_stdio(false);
  cin >> n;
  for (int i = 1; i <= n; ++i) cin >> w[i];
  for (int i = 2; i <= n; ++i) {
    int x, y, z;
    cin >> x >> y >> z;
    add(x, y, z);
    add(y, x, z);
  }
  maxp[root = 0] = n + 1;
  findroot(1, 1, n);
  solve(root);
  cout << ans1 << " " << fixed << setprecision(9) << ans2 << endl;
  return 0;
}
