#include <bits/stdc++.h>
using namespace std;
template <class T>
inline void chkmin(T &a, T b) {
  if (a > b) a = b;
}
template <class T>
inline void chkmax(T &a, T b) {
  if (a < b) a = b;
}
int N;
vector<pair<int, int> > adj[100010];
int cnt[100010], t[100010];
double dp[100010];
void dfs(int p, int x) {
  int i;
  vector<pair<double, pair<int, int> > > child;
  for (i = 0; i < adj[x].size(); i++) {
    int y = adj[x][i].first;
    int e = adj[x][i].second;
    if (y != p) {
      dfs(x, y);
      double coef = (2.0 * e + t[y]) / cnt[y];
      child.push_back(make_pair(coef, make_pair(e, y)));
    }
  }
  sort(child.begin(), child.end());
  cnt[x] = 1;
  double sum = 0.0;
  for (i = 0; i < child.size(); i++) {
    int e = child[i].second.first, y = child[i].second.second;
    cnt[x] += cnt[y];
    t[x] += 2 * e + t[y];
    dp[x] += dp[y] + (e + sum) * cnt[y];
    sum += 2 * e + t[y];
  }
}
int main() {
  int i;
  scanf("%d", &N);
  for (i = 1; i < N; i++) {
    int a, b, c;
    scanf("%d%d%d", &a, &b, &c);
    a--;
    b--;
    adj[a].push_back(make_pair(b, c));
    adj[b].push_back(make_pair(a, c));
  }
  dfs(-1, 0);
  printf("%.9lf\n", dp[0] / (N - 1));
  return 0;
}
