#include <bits/stdc++.h>
using namespace std;
const int INF = 1000000000;
const int NMAX = 100000;
struct edge {
  edge(int dest, int cost) : dest(dest), cost(cost) {}
  int dest, cost;
};
vector<edge> old_T[NMAX], T[NMAX];
int size[NMAX], len[NMAX];
long long K[NMAX], cdyn[NMAX];
int DFS_ch(int u, int prev) {
  for (int i = 0, _n = (old_T[u].size()); i < _n; ++i) {
    const int v = old_T[u][i].dest;
    if (v != prev) {
      T[u].push_back(edge(v, old_T[u][i].cost));
      size[u] += DFS_ch(v, u);
      len[u] += 2 * old_T[u][i].cost + len[v];
    }
  }
  ++size[u];
  return size[u];
}
struct vertex_cmp {
  bool operator()(const edge& e1, const edge& e2) const {
    const int u = e1.dest, v = e2.dest;
    return K[u] * size[v] < K[v] * size[u];
  }
};
long long dyn(int u) {
  for (int i = 0, _n = (T[u].size()); i < _n; ++i) {
    const int v = T[u][i].dest, t = T[u][i].cost;
    cdyn[v] = dyn(v);
    K[v] = len[v] + 2 * t;
  }
  sort((T[u]).begin(), (T[u]).end(), vertex_cmp());
  long long res = 0, Ksum = 0;
  for (int i = 0, _n = (T[u].size()); i < _n; ++i) {
    const int v = T[u][i].dest, t = T[u][i].cost;
    res += cdyn[v] + size[v] * (t + Ksum);
    Ksum += K[v];
  }
  return res;
}
int main() {
  int N;
  scanf("%d", &N);
  for (int i = 0, _n = (N - 1); i < _n; ++i) {
    int a, b, t;
    scanf("%d%d%d", &a, &b, &t);
    old_T[a - 1].push_back(edge(b - 1, t));
    old_T[b - 1].push_back(edge(a - 1, t));
  }
  DFS_ch(0, -1);
  printf("%.7lf\n", 1.0 * dyn(0) / (N - 1));
}
