#include <bits/stdc++.h>
using namespace std;
static vector<vector<pair<int, int> > > E;
struct Edge {
  int dest, length, dists, nodes;
};
static int nodes(int v, int par) {
  static int memo[100000];
  if (!memo[v]) {
    memo[v] = 1;
    for (__typeof((E[v]).begin()) it = (E[v]).begin(); it != (E[v]).end(); ++it)
      if (it->first != par) memo[v] += nodes(it->first, v);
  }
  return memo[v];
}
static int dists(int v, int par) {
  static int memo[100000];
  if (!memo[v]) {
    memo[v] = 1;
    for (__typeof((E[v]).begin()) it = (E[v]).begin(); it != (E[v]).end(); ++it)
      if (it->first != par) memo[v] += it->second + dists(it->first, v);
  }
  return memo[v] - 1;
}
static long long cost(const Edge &a, const Edge &b) {
  return (long long)a.length * a.nodes +
         (long long)(a.length * 2 + a.dists * 2 + b.length) * b.nodes;
}
static bool cmp(const Edge &a, const Edge &b) {
  return cost(a, b) < cost(b, a);
}
static long long calc(int v, int par) {
  vector<Edge> edges;
  for (__typeof((E[v]).begin()) it = (E[v]).begin(); it != (E[v]).end(); ++it)
    if (it->first != par) {
      Edge e = {it->first, it->second, dists(it->first, v),
                nodes(it->first, v)};
      edges.push_back(e);
    }
  sort(edges.begin(), edges.end(), cmp);
  long long res = 0, dist = 0;
  for (__typeof((edges).begin()) it = (edges).begin(); it != (edges).end();
       ++it) {
    res += (dist + it->length) * it->nodes + calc(it->dest, v);
    dist += 2 * (it->length + it->dists);
  }
  return res;
}
int main() {
  int N;
  cin >> N;
  E.resize(N);
  for (int _ = 0; _ < int(N - 1); ++_) {
    int a, b, t;
    cin >> a >> b >> t;
    E[a - 1].push_back(make_pair(b - 1, t));
    E[b - 1].push_back(make_pair(a - 1, t));
  }
  cout.precision(10);
  cout << fixed << (double)calc(0, -1) / (N - 1) << endl;
}
