#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 2;
int n;
vector<pair<long long, long long> > adj[N];
pair<long long, long long> dp[N];
long double ans;
bool cmp(pair<long long, long long> x, pair<long long, long long> y) {
  return (dp[x.first].second + 2 * x.second) * dp[y.first].first <
         dp[x.first].first * (dp[y.first].second + 2 * y.second);
}
void dfs(int v) {
  dp[v].first = 1;
  for (int i = 0; i < adj[v].size(); i++) {
    int u = adj[v][i].first;
    if (!dp[u].first) {
      dfs(u);
      dp[v].first += dp[u].first;
      dp[v].second += 2 * adj[v][i].second + dp[u].second;
    } else {
      swap(adj[v][i], adj[v].back());
      adj[v].pop_back();
      i--;
    }
  }
  sort(adj[v].begin(), adj[v].end(), cmp);
}
void dfs2(int v) {
  static int dis;
  ans += dis;
  for (int i = 0; i < adj[v].size(); i++) {
    dis += adj[v][i].second;
    dfs2(adj[v][i].first);
    dis += adj[v][i].second;
  }
}
int main() {
  cin.sync_with_stdio(false);
  cin >> n;
  for (int i = 0; i < n - 1; i++) {
    int u, v, w;
    cin >> u >> v >> w;
    u--, v--;
    adj[u].push_back(pair<long long, long long>(v, w));
    adj[v].push_back(pair<long long, long long>(u, w));
  }
  dfs(0);
  dfs2(0);
  cout << fixed << setprecision(8) << ans / (n - 1) << '\n';
  return 0;
}
