#include <bits/stdc++.h>
using namespace std;
long long n, hd[200009], cnt;
long long ssiz[200009], slen[200009], dp[200009][2], len[200009], siz[200009];
struct Edge {
  long long to, nxt, w;
} edge[200009 << 1];
vector<long long> q[200009];
long long read();
bool cmp(long long x, long long y) { return len[x] * siz[y] < len[y] * siz[x]; }
void add(long long u, long long v, long long w) {
  edge[++cnt] = (Edge){v, hd[u], w};
  hd[u] = cnt;
  edge[++cnt] = (Edge){u, hd[v], w};
  hd[v] = cnt;
}
void dfs(long long u, long long fa) {
  for (long long i = hd[u], v, w; i; i = edge[i].nxt)
    if ((v = edge[i].to) != fa) {
      dfs(v, u);
      len[v] += w = edge[i].w;
      dp[v][0] += siz[v] * w;
      dp[v][1] += siz[v] * w;
      siz[u] += siz[v];
      len[u] += len[v];
      q[u].push_back(v);
    }
  sort(q[u].begin(), q[u].end(), cmp);
  dp[u][0] = ssiz[0] = slen[0] = 0;
  for (long long i = 0, v; i < q[u].size(); ++i) {
    if (i) ssiz[i] = ssiz[i - 1], slen[i] = slen[i - 1];
    ssiz[i] += siz[v = q[u][i]];
    slen[i] += len[v];
    dp[u][0] += dp[v][0] + len[v] * (siz[u] - ssiz[i]) * 2;
    long long ok = true;
  }
  dp[u][1] = dp[u][0];
  for (long long i = 0, v; i < q[u].size(); ++i) {
    long long now = dp[u][0];
    v = q[u][i];
    now += siz[v] * 2 * (slen[q[u].size() - 1] - slen[i]);
    now -= len[v] * (siz[u] - ssiz[i]) * 2;
    now += dp[v][1] - dp[v][0];
    dp[u][1] = (now) < (dp[u][1]) ? (now) : (dp[u][1]);
  }
  ++siz[u];
  if (!q[u].size()) dp[u][1] = 0;
  bool ok = true;
  return void();
}
int main() {
  n = read();
  memset(dp, 0x3f, sizeof(dp));
  for (long long i = 1, u, v, w; i < n; ++i)
    u = read(), v = read(), w = read(), add(u, v, w);
  dfs(1, 1);
  printf("%.15lf\n", 1. * dp[1][1] / (n - 1));
  return 0;
}
long long read() {
  long long x = 0, f = 1;
  char c = getchar();
  while (c > '9' || c < '0') f = (c == '-') ? -1 : f, c = getchar();
  while (c >= '0' && c <= '9') x = x * 10 + c - '0', c = getchar();
  return x * f;
}
