#include <bits/stdc++.h>
using namespace std;
template <typename T>
inline T gi() {
  T x = 0, f = 1;
  char c = getchar();
  while (c < '0' || c > '9') {
    if (c == '-') f = -1;
    c = getchar();
  }
  while (c >= '0' && c <= '9') x = x * 10 + c - '0', c = getchar();
  return f * x;
}
const int N = 100003, M = N << 1;
int n;
int tot, head[N], ver[M], nxt[M], edge[M];
int sz[N];
pair<int, int> a[N];
int cnt;
long long f[N], g[N];
inline void add(int u, int v, int w) {
  ver[++tot] = v, edge[tot] = w, nxt[tot] = head[u], head[u] = tot;
}
inline bool cmp(pair<int, int> x, pair<int, int> y) {
  return 1. * (2 * x.second + g[x.first]) / sz[x.first] <
         1. * (2 * y.second + g[y.first]) / sz[y.first];
}
void dfs(int u, int fa) {
  sz[u] = 1;
  for (int i = head[u]; i; i = nxt[i]) {
    int v = ver[i];
    if (v == fa) continue;
    dfs(v, u);
    sz[u] += sz[v];
    g[u] += g[v] + 2ll * edge[i];
  }
  cnt = 0;
  for (int i = head[u]; i; i = nxt[i]) {
    int v = ver[i];
    if (v == fa) continue;
    a[++cnt] = {v, edge[i]};
  }
  sort(a + 1, a + 1 + cnt, cmp);
  int now = 0;
  for (int i = 1; i <= cnt; i += 1) {
    int v = a[i].first;
    f[u] += f[v] + 1ll * sz[v] * (now + a[i].second);
    now += g[v] + 2ll * a[i].second;
  }
}
int main() {
  n = gi<int>();
  for (int i = 1; i < n; i += 1) {
    int u = gi<int>(), v = gi<int>(), w = gi<int>();
    add(u, v, w), add(v, u, w);
  }
  dfs(1, 0);
  printf("%.10lf\n", 1. * f[1] / (n - 1));
  return 0;
}
