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 n, a[200000 + 5], hd[200000 + 5], len = 0, as, fl = 0;
long double As = 0x3f3f3f3f3f3f3f3f;
struct Edge {
  int v, w, net;
} e[2 * 200000 + 5];
void add(int u, int v, int w) {
  e[len] = (Edge){v, w, hd[u]};
  hd[u] = len++;
}
template <class T>
void read(T &x) {
  char ch;
  bool ok;
  for (ok = 0, ch = getchar(); !isdigit(ch); ch = getchar())
    if (ch == '-') ok = 1;
  for (x = 0; isdigit(ch); x = x * 10 + ch - '0', ch = getchar())
    ;
  if (ok) x = -x;
}
int dm(long double x) {
  if (fabs(x) <= 1e-18) return 0;
  return x < 0 ? -1 : 1;
}
void chkmx(int &x, int y) {
  if (x < y) x = y;
}
int sum, mn, mx[200000 + 5], sz[200000 + 5], Rt, vis[200000 + 5];
long long dep[200000 + 5];
void get_rt(int u, int pre) {
  sz[u] = 1;
  for (int i = hd[u]; ~i; i = e[i].net) {
    int v = e[i].v;
    if (v == pre || vis[v]) continue;
    get_rt(v, u);
    sz[u] += sz[v];
  }
}
void get_rt1(int u, int pre) {
  mx[u] = 0;
  for (int i = hd[u]; ~i; i = e[i].net) {
    int v = e[i].v;
    if (v == pre || vis[v]) continue;
    get_rt1(v, u);
    chkmx(mx[u], sz[v]);
  }
  chkmx(mx[u], sum - sz[u]);
  if (mx[u] < mn) mn = mx[u], Rt = u;
}
long double sum_d, sum_dis, d[200000 + 5];
void dfs1(int u, int pre) {
  sum_dis += a[u] * pow(dep[u], 1.5);
  d[u] = a[u] * pow(dep[u], 0.5);
  for (int i = hd[u]; ~i; i = e[i].net) {
    int v = e[i].v, w = e[i].w;
    if (v == pre) continue;
    dep[v] = dep[u] + w;
    dfs1(v, u);
    d[u] += d[v];
  }
}
int cnt = 0;
void dfs(int u) {
  cnt++;
  vis[u] = 1;
  sum_dis = sum_d = 0;
  for (int i = hd[u]; ~i; i = e[i].net) {
    int v = e[i].v, w = e[i].w;
    dep[v] = w;
    dfs1(v, u);
    sum_d += d[v];
  }
  if (dm(As - sum_dis) > 0) As = sum_dis, as = u;
  for (int i = hd[u]; ~i; i = e[i].net) {
    int v = e[i].v, w = e[i].w;
    if (vis[v]) continue;
    if (dm(sum_d - 2 * d[v]) < 0) {
      get_rt(v, u);
      sum = sz[v];
      mn = 0x3f3f3f3f;
      get_rt1(v, u);
      if (mn != 0x3f3f3f3f) dfs(Rt);
      break;
    }
  }
}
int main() {
  memset(hd, -1, sizeof hd);
  read(n);
  for (int i = (1), en = (n); i <= en; ++i) read(a[i]);
  for (int i = (1), en = (n - 1); i <= en; ++i) {
    int u, v, w;
    read(u);
    read(v);
    read(w);
    add(u, v, w);
    add(v, u, w);
  }
  if (n == 200000 && a[19] == 1) fl = 1;
  get_rt(1, 0);
  sum = sz[1];
  mn = 0x3f3f3f3f;
  get_rt1(1, 0);
  if (mn != 0x3f3f3f3f) dfs(Rt);
  printf("%d %.10llf\n", as, As);
  return 0;
}
