#include <bits/stdc++.h>
using namespace std;
const int MAX = 1e5 + 20;
struct edge {
  long long to, co;
  edge(long long a = 0, long long b = 0) : to(a), co(b) {}
};
vector<edge> adj[MAX];
long long A[MAX], S[MAX];
long long dp[MAX];
long long c[MAX];
vector<int> childs[MAX];
int n;
void dfs(int v, int pa, long long co) {
  S[v] = 1, A[v] = co * 2, c[v] = co;
  for (int i = 0; i < adj[v].size(); i++) {
    edge &e = adj[v][i];
    int u = e.to;
    if (u != pa) {
      childs[v].push_back(u);
      dfs(u, v, e.co);
      S[v] += S[u];
      A[v] += A[u];
    }
  }
}
long long sol(int v) {
  if (childs[v].size() == 0) {
    return dp[v] = 0;
  } else {
    dp[v] = 0;
    sort(childs[v].begin(), childs[v].end(),
         [](int a, int b) { return A[a] * S[b] < A[b] * S[a]; });
    for (int i = 0; i < childs[v].size(); i++) {
      int u = childs[v][i];
      sol(u);
      dp[v] += dp[u];
    }
    for (int i = 0, ta = 0; i < childs[v].size(); i++) {
      int u = childs[v][i];
      dp[v] += (c[u] + ta) * S[u];
      ta += A[u];
    }
    return dp[v];
  }
}
int main() {
  scanf("%d", &n);
  for (int i = 0; i < n - 1; i++) {
    int a, b, t;
    scanf("%d%d%d", &a, &b, &t);
    adj[a].push_back(edge(b, t));
    adj[b].push_back(edge(a, t));
  }
  dfs(1, -1, 0);
  long long ans = sol(1);
  printf("%.12lf\n", (double)ans / (n - 1));
  return 0;
}
