#include <bits/stdc++.h>
using namespace std;
const int MAXN = 2.1e5;
int n;
struct edge_t {
  int dest;
  int cost;
  operator int() const { return dest; }
};
vector<edge_t> adj[MAXN];
int weight[MAXN];
int ans_idx = -1;
double ans_val;
bool alive[MAXN];
int sz[MAXN];
void get_sz(int v, int p) {
  sz[v] = 1;
  for (int w : adj[v]) {
    if (!alive[w] || w == p) continue;
    get_sz(w, v);
    sz[v] += sz[w];
  }
}
int get_centroid(int v, int p, int tot_sz) {
  for (int w : adj[v]) {
    if (!alive[w] || w == p) continue;
    if (sz[w] * 2 >= tot_sz) {
      return get_centroid(w, v, tot_sz);
    }
  }
  return v;
}
void dfs(int v, int p, int d, double& dist, double& diff) {
  dist += d * sqrt(d) * weight[v];
  diff += sqrt(d) * weight[v];
  for (auto e : adj[v]) {
    if (e == p) continue;
    dfs(e, v, d + e.cost, dist, diff);
  }
}
void solve(int v) {
  get_sz(v, -1);
  v = get_centroid(v, -1, sz[v]);
  alive[v] = false;
  double cnd = 0;
  double tgt = -1;
  double maxd = -1;
  for (auto e : adj[v]) {
    double dist = 0, diff = 0;
    dfs(e, v, e.cost, dist, diff);
    cnd += dist;
    if (!alive[e]) continue;
    if (maxd < diff) {
      maxd = diff;
      tgt = e;
    }
  }
  if (ans_idx == -1 || cnd < ans_val) {
    ans_val = cnd;
    ans_idx = v;
  }
  if (tgt != -1) {
    solve(tgt);
  }
}
int main() {
  ios::sync_with_stdio(0), cin.tie(0);
  cout << fixed << setprecision(20);
  cin >> n;
  for (int i = 0; i < n; i++) cin >> weight[i];
  for (int i = 0; i < n - 1; i++) {
    int a, b, c;
    cin >> a >> b >> c;
    a--, b--;
    adj[a].push_back({b, c});
    adj[b].push_back({a, c});
  }
  for (int i = 0; i < n; i++) alive[i] = true;
  solve(0);
  cout << ans_idx + 1 << ' ' << ans_val << '\n';
  return 0;
}
