#include <bits/stdc++.h>
using namespace std;
const int maxn = 100000 + 10;
vector<pair<int, int> > g[maxn];
int son[maxn], weight[maxn], n;
double gao(int x, int p) {
  son[x] = 1;
  weight[x] = 0;
  double res = 0;
  vector<pair<double, pair<int, int> > > vec;
  for (vector<pair<int, int> >::iterator it = g[x].begin(); it != g[x].end();
       ++it) {
    if (it->first != p) {
      res += gao(it->first, x);
      son[x] += son[it->first];
      weight[x] += weight[it->first] + it->second;
      vec.push_back(pair<double, pair<int, int> >(
          (double)(weight[it->first] + it->second) / son[it->first],
          pair<int, int>(it->first, it->second)));
    }
  }
  sort(vec.begin(), vec.end());
  int nowson = son[x] - 1;
  for (int i = 0; i < (((int)((vec).size()))); ++i) {
    double nowlen = vec[i].second.second;
    res += nowlen * nowson;
    nowson -= son[vec[i].second.first];
    nowlen += weight[vec[i].second.first] * 2;
    res += nowlen * nowson;
  }
  return res;
}
int main() {
  while (scanf("%d", &n) != EOF) {
    for (int i = 0; i < (n); ++i) g[i].clear();
    for (int i = 0; i < (n - 1); ++i) {
      int a, b, c;
      scanf("%d%d%d", &a, &b, &c);
      --a, --b;
      g[a].push_back(pair<int, int>(b, c));
      g[b].push_back(pair<int, int>(a, c));
    }
    printf("%.8lf\n", gao(0, -1) / (n - 1));
  }
  return 0;
}
