#include <bits/stdc++.h>
using namespace std;
mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());
mt19937 rnf(2106);
const int N = 100005;
int n;
vector<pair<int, int> > a[N];
long long q[N], d[N], ans[N];
bool so(const pair<long long, long long>& a,
        const pair<long long, long long>& b) {
  return (a.first * b.second) < (a.second * b.first);
}
void dfs(int x, int p) {
  q[x] = 1;
  for (int i = 0; i < a[x].size(); ++i) {
    int h = a[x][i].first;
    int dd = a[x][i].second;
    if (h == p) continue;
    dfs(h, x);
    d[h] += 2 * dd;
    ans[h] += q[h] * dd;
    d[x] += d[h];
    q[x] += q[h];
  }
  vector<pair<long long, long long> > v;
  for (int i = 0; i < a[x].size(); ++i) {
    int h = a[x][i].first;
    if (h == p) continue;
    ans[x] += ans[h];
    v.push_back(make_pair(d[h], q[h]));
  }
  sort((v).begin(), (v).end(), so);
  int s = 0;
  for (int i = ((int)(v).size()) - 1; i >= 0; --i) {
    ans[x] += s * v[i].first;
    s += v[i].second;
  }
}
void solv() {
  scanf("%d", &n);
  for (int i = 0; i < n - 1; ++i) {
    int x, y, z;
    scanf("%d%d%d", &x, &y, &z);
    a[x].push_back(make_pair(y, z));
    a[y].push_back(make_pair(x, z));
  }
  dfs(1, 1);
  printf("%.9f\n", (double)ans[1] / (n - 1));
}
int main() {
  solv();
  return 0;
}
