#include <bits/stdc++.h>
using namespace std;
struct pai {
  long long x;
  int t;
};
bool cmp(const pai &x, const pai &y) { return x.x * y.t < y.x * x.t; }
pai a[100005];
int tt;
int si[100005];
long long f[100005], g[100005];
int lw[100005], bi[200005][3], bs;
int n;
long long ans;
int dr() {
  int xx = 0;
  char ch = getchar();
  while (ch < '0' || ch > '9') ch = getchar();
  while (ch >= '0' && ch <= '9')
    xx = (xx << 1) + (xx << 3) + ch - '0', ch = getchar();
  return xx;
}
void tj(int u, int v, int w) {
  bi[++bs][0] = lw[u], bi[lw[u] = bs][1] = v, bi[bs][2] = w;
}
void dfs(int w, int fa) {
  si[w] = 1;
  for (int o_o = lw[w]; o_o; o_o = bi[o_o][0]) {
    int v = bi[o_o][1];
    if (v != fa)
      dfs(v, w), f[w] += (f[v] += 1ll * si[v] * bi[o_o][2]),
          g[w] += (g[v] += 2 * bi[o_o][2]), si[w] += si[v];
  }
  tt = 0;
  for (int o_o = lw[w]; o_o; o_o = bi[o_o][0]) {
    int v = bi[o_o][1];
    if (v != fa) a[++tt] = (pai){g[v], si[v]};
  }
  sort(a + 1, a + tt + 1, cmp);
  long long gt = 0;
  for (int i = 1; i <= tt; i++) f[w] += gt * a[i].t, gt += a[i].x;
}
int main() {
  n = dr();
  for (int i = 1; i < n; i++) {
    int u = dr(), v = dr(), w = dr();
    tj(u, v, w), tj(v, u, w);
  }
  dfs(1, 0);
  printf("%.7f", ((double)f[1]) / (n - 1));
}
