#include <bits/stdc++.h>
using namespace std;
int get() {
  int x = 0;
  char s = getchar();
  while (s < '0' || s > '9') s = getchar();
  while (s >= '0' && s <= '9')
    x = (x << 3) + (x << 1) + (s ^ 48), s = getchar();
  return x;
}
const int M = 1e5 + 5;
int n, head[M], cntedge, siz[M], f2[M];
long long f1[M];
struct edge {
  int to, nxt, w;
  edge() {}
  edge(const int T, const int NX, const int W) { to = T, nxt = NX, w = W; }
} e[M << 1];
struct node {
  int x, y, z;
  node() {}
  node(const int X, const int Y, const int Z) { x = X, y = Y, z = Z; }
  bool operator<(const node t) const { return 1ll * t.x * y < 1ll * x * t.y; }
} a[M];
void add(const int u, const int v, const int w) {
  e[++cntedge] = edge(v, head[u], w), head[u] = cntedge;
}
void dfs(const int x, const int fa) {
  siz[x] = 1;
  for (int i = head[x]; i; i = e[i].nxt)
    if (e[i].to ^ fa) {
      dfs(e[i].to, x);
      siz[x] += siz[e[i].to];
      f1[x] += f1[e[i].to];
    }
  int len = 0;
  for (int i = head[x]; i; i = e[i].nxt)
    if (e[i].to ^ fa)
      a[++len] = node(siz[e[i].to], f2[e[i].to] + (e[i].w << 1), e[i].w);
  sort(a + 1, a + len + 1);
  for (int i = 1; i <= len; ++i)
    f1[x] += 1ll * (f2[x] + a[i].z) * a[i].x, f2[x] += a[i].y;
}
int main() {
  n = get();
  for (int i = 1, u, v, w; i < n; ++i) {
    u = get(), v = get(), w = get();
    add(u, v, w), add(v, u, w);
  }
  dfs(1, 0);
  printf("%.8f", 1.0 * f1[1] / (n - 1));
  return 0;
}
