#include <bits/stdc++.h>
using namespace std;
vector<pair<int, double> > E[100005];
int num[100005];
double ans[100005];
double times[100005];
void recur(int pos, int parent = -1) {
  ans[pos] = times[pos] = 0;
  num[pos] = 1;
  map<int, int> mp;
  vector<pair<double, pair<double, double> > > vec;
  for (long long i = 0; i < ((long long)((long long)E[pos].size())); i++)
    if (E[pos][i].first != parent) {
      int other = E[pos][i].first;
      recur(other, pos);
      double t = times[other] + 2.0 * E[pos][i].second;
      num[pos] += num[other];
      ans[pos] += ans[other] + E[pos][i].second * num[other];
      times[pos] += t;
      vec.push_back(make_pair(t / num[other], make_pair(t, num[other])));
    }
  double sum = num[pos] - 1;
  sort(vec.begin(), vec.end());
  for (long long i = 0; i < ((long long)((long long)vec.size())); i++) {
    sum -= vec[i].second.second;
    ans[pos] += sum * vec[i].second.first;
  }
}
int main() {
  long long n;
  cin >> n;
  for (long long i = 0; i < ((long long)n - 1); i++) {
    long long a, b, c;
    cin >> a >> b >> c;
    E[a - 1].push_back(make_pair(b - 1, c));
    E[b - 1].push_back(make_pair(a - 1, c));
  }
  recur(0);
  printf("%.20lf\n", ans[0] / (double)(n - 1));
}
