3
1 1 5
1 3 42
1 2 42
 2
42 23
1 2 10
 10
45792697 27183921 4791060 77070594 27286110 66957065 19283638 2944837 26775511 65379701
5 8 25
8 10 94
1 4 14
9 7 96
4 2 16
2 6 58
2 3 99
6 8 21
8 9 87
 5
3 1 2 6 5
1 2 3
2 3 1
4 3 9
5 3 1
 10
26 31 21 57 56 44 54 58 79 97
2 1 277
1 8 91
1 7 380
4 1 649
10 5 799
10 1 940
8 6 627
6 3 177
9 6 685
 10
8 100 62 38 26 51 26 23 77 32
6 8 29
4 1 82
7 8 66
7 10 67
8 9 98
6 1 14
1 5 48
3 1 58
2 9 90
 2
23 42
1 2 10
 1
42
 3
1 5 1
1 3 42
1 2 42
 10
1 1 1 1 1 1 1 1 1 1
1 2 5
1 3 5
1 4 5
1 5 5
1 6 5
1 7 5
1 8 5
1 9 5
1 10 5
 3
1 1 1
1 2 42
2 3 42
 3
5 1 1
1 3 42
1 2 24

3 1042.0638260857 1 727.3238618387 6 283959805416.40496826
 3 192.0000000000 1 13952642.4776933547 8 544327.1927847408 2 727.3238618387 1 0.0000000000 2 1042.0638260857 1 100.6230589875 2 544.3822186663 1 389.7666169867
#include <bits/stdc++.h>
using namespace std;
int i, j, m, n, p, k, fox[200005], k1, a[200005], x, y, z, vis[200005],
    Q[200005], Rt[200005], deep[200005], Belong[20][200005], fa[200005],
    size[200005], ansx, dis[200005];
int Dis[200005];
long double ans = (long double)1e30, Ans[200005];
struct Node {
  int ed, before, cost;
} s[200005 * 2];
void add(int x, int y, int z) {
  s[++k1].ed = y;
  s[k1].before = fox[x];
  fox[x] = k1;
  s[k1].cost = z;
}
void bfs(int x) {
  Q[Q[0] = 1] = x;
  Rt[x] = 1;
  for (int i = 1; i <= Q[0]; i++) {
    int p = Q[i];
    for (int j = fox[p]; j; j = s[j].before)
      if (!(vis[s[j].ed] || Rt[s[j].ed])) {
        int A = s[j].ed;
        deep[A] = deep[x] + 1;
        Q[++Q[0]] = A;
        Rt[A] = 1;
      }
  }
  for (int i = 1; i <= Q[0]; i++) Rt[Q[i]] = 0;
  for (int i = 1; i <= Q[0]; ++i) Belong[deep[x]][Q[i]] = x;
}
int getroot(int x) {
  Q[Q[0] = 1] = x;
  Rt[x] = 1;
  fa[x] = 0;
  for (int i = 1; i <= Q[0]; i++) {
    int p = Q[i];
    for (int j = fox[p]; j; j = s[j].before) {
      int A = s[j].ed;
      if (vis[A] || Rt[A]) continue;
      Q[++Q[0]] = A;
      fa[A] = p;
      Rt[A] = 1;
    }
  }
  int A1 = 0, A2 = 1000000;
  for (int i = Q[0]; i; i--) {
    int p = Q[i];
    size[p] = 1;
    int Max = -1;
    for (int j = fox[p]; j; j = s[j].before) {
      int A = s[j].ed;
      if (vis[A] || fa[p] == A) continue;
      Max = max(Max, size[A]);
      size[p] += size[A];
    }
    Max = max(Max, Q[0] - size[p]);
    if (Max < A2) {
      A1 = p;
      A2 = Max;
    }
  }
  for (int i = 1; i <= Q[0]; i++) Rt[Q[i]] = 0;
  return A1;
}
void Fen(int x) {
  int i;
  int root = getroot(x);
  bfs(root);
  vis[root] = 1;
  for (i = fox[root]; i; i = s[i].before)
    if (!vis[s[i].ed]) Fen(s[i].ed);
}
long double P(long double x) { return x * sqrt(x); }
void getans(int x) {
  int i, l;
  for (i = 1; i <= n; ++i) vis[i] = 0;
  dis[x] = 0;
  vis[x] = 1;
  Q[Q[0] = 1] = x;
  for (l = 1; l <= Q[0]; ++l) {
    p = Q[l];
    for (i = fox[p]; i; i = s[i].before)
      if (!vis[s[i].ed]) {
        vis[s[i].ed] = 1;
        dis[s[i].ed] = dis[p] + s[i].cost;
        Q[++Q[0]] = s[i].ed;
      }
  }
  long double sum = 0;
  for (i = 1; i <= n; ++i) sum += (long double)a[i] * P(dis[i]);
  if (sum < ans) ans = sum, ansx = x;
}
long double Bfs(int x, int y, int z) {
  memset(vis, 0, sizeof(vis));
  vis[x] = vis[y] = 1;
  Q[Q[0] = 1] = x;
  Dis[x] = 0;
  int i, l;
  for (l = 1; l <= Q[0]; ++l) {
    int p = Q[l];
    for (i = fox[p]; i; i = s[i].before)
      if (!vis[s[i].ed]) {
        vis[s[i].ed] = 1;
        Dis[s[i].ed] = Dis[x] + s[i].cost;
        Q[++Q[0]] = s[i].ed;
      }
  }
  long double S = 0;
  for (i = 1; i <= Q[0]; ++i) S += (long double)a[Q[i]] * sqrt(Dis[Q[i]] + z);
  return S;
}
void Get(int x) {
  getans(x);
  if (n == 1000) printf("%d\n", x);
  int id = 0;
  long double sum = -(long double)1e30, R;
  for (i = fox[x]; i; i = s[i].before)
    if (deep[s[i].ed] > deep[x]) {
      R = Bfs(s[i].ed, x, s[i].cost);
      if (!id || sum < R) id = s[i].ed, sum = R;
    }
  if (!id) return;
  Get(id);
}
int main() {
  scanf("%d", &n);
  for (i = 1; i <= n; ++i) scanf("%d", &a[i]);
  for (i = 1; i < n; ++i)
    scanf("%d%d%d", &x, &y, &z), add(x, y, z), add(y, x, z);
  Fen(1);
  for (i = 1; i <= n; ++i)
    if (Belong[0][i] == i) break;
  Get(i);
  printf("%d ", ansx);
  cout << fixed << setprecision(10) << ans << endl;
}
