#include <bits/stdc++.h>
using namespace std;
struct edge {
  int v, L, sum, size;
  edge(int v, int L) : v(v), L(L), sum(0), size(1){};
  bool operator<(const edge &a) const {
    return (long long)sum * a.size < (long long)a.sum * size;
  }
};
int n;
vector<edge> edges[100010];
long long dp[100010];
pair<int, int> dfs(int idx, int par = -1) {
  int sum = 0, cnt = 1;
  for (int i = 0; i < edges[idx].size(); i++) {
    int j = edges[idx][i].v;
    if (j == par) continue;
    pair<int, int> tmp = dfs(j, idx);
    sum += tmp.first + 2 * edges[idx][i].L;
    cnt += tmp.second;
    edges[idx][i].sum = tmp.first + 2 * edges[idx][i].L;
    edges[idx][i].size = tmp.second;
  }
  sort(edges[idx].begin(), edges[idx].end());
  long long ad = 0;
  dp[idx] = 0;
  for (int i = 0; i < edges[idx].size(); i++) {
    int j = edges[idx][i].v;
    if (j == par) continue;
    dp[idx] += (ad + (long long)edges[idx][i].L) * edges[idx][i].size + dp[j];
    ad += edges[idx][i].sum;
  }
  return pair<int, int>(sum, cnt);
}
int main() {
  scanf("%d", &n);
  for (int i = 0; i < n - 1; i++) {
    int x, y, z;
    scanf("%d%d%d", &x, &y, &z);
    x--, y--;
    edges[x].push_back(edge(y, z));
    edges[y].push_back(edge(x, z));
  }
  dfs(0);
  printf("%lf\n", (double)dp[0] / (n - 1));
  return 0;
}
