#include <bits/stdc++.h>
using namespace std;
inline long long qr() {
  long long x = 0, f = 1;
  char ch;
  while (!isdigit(ch = getchar()))
    if (ch == '-') f = -1;
  for (; isdigit(ch); x = x * 10 + ch - 48, ch = getchar())
    ;
  return x * f;
}
const int N = 100010;
vector<pair<int, int> > g[N];
long long t[N], ans;
int sz[N], n;
bool cmp(pair<int, int> a, pair<int, int> b) {
  return t[a.first] * sz[b.first] < t[b.first] * sz[a.first];
}
void dfs(int u, int ff) {
  sz[u] = 1;
  for (int i = 0; i < g[u].size(); ++i) {
    int v = g[u][i].first;
    if (v != ff) {
      dfs(v, u);
      sz[u] += sz[v];
      t[v] += 2 * g[u][i].second;
      t[u] += t[v];
    }
  }
}
void dfs(int u, int ff, int tm) {
  sort(g[u].begin(), g[u].end(), cmp);
  ans += tm;
  int k = tm;
  for (int i = 0; i < g[u].size(); ++i) {
    int v = g[u][i].first;
    if (v != ff) {
      dfs(v, u, k + g[u][i].second);
      k += t[v];
    }
  }
}
int main() {
  n = qr();
  for (int i = 2; i <= n; ++i) {
    int x = qr(), y = qr(), z = qr();
    g[x].push_back(make_pair(y, z));
    g[y].push_back(make_pair(x, z));
  }
  dfs(1, 0);
  dfs(1, 0, 0);
  printf("%.6lf\n", 1.0 * ans / (n - 1));
  return 0;
}
