#include <bits/stdc++.h>
using namespace std;
const int MOD = 100003;
const long long LINF = 2e16;
const int INF = 1e9;
const int magic = 348;
const double eps = 1e-10;
const double pi = acos(-1);
inline int getint() {
  char ch;
  int res;
  bool f;
  while (!isdigit(ch = getchar()) && ch != '-') {
  }
  if (ch == '-')
    f = false, res = 0;
  else
    f = true, res = ch - '0';
  while (isdigit(ch = getchar())) res = res * 10 + ch - '0';
  return f ? res : -res;
}
int n;
vector<pair<int, int> > v[100048];
int sz[100048], edgelen[100048];
inline void dfs(int cur, int father) {
  int i, second;
  sz[cur] = 1;
  edgelen[cur] = 0;
  for (i = 0; i < int(v[cur].size()); i++) {
    second = v[cur][i].first;
    if (second != father) {
      dfs(second, cur);
      sz[cur] += sz[second];
      edgelen[second] += v[cur][i].second * 2;
      edgelen[cur] += edgelen[second];
    }
  }
}
inline bool cmp(pair<int, int> first, pair<int, int> second) {
  return (long long)edgelen[first.first] * sz[second.first] <
         (long long)edgelen[second.first] * sz[first.first];
}
long long ans = 0;
inline void Dfs(int cur, int father, int tm) {
  int i, second;
  sort(v[cur].begin(), v[cur].end(), cmp);
  ans += tm;
  int curtm = tm;
  for (i = 0; i < int(v[cur].size()); i++) {
    second = v[cur][i].first;
    if (second != father)
      Dfs(second, cur, curtm + v[cur][i].second), curtm += edgelen[second];
  }
}
int main() {
  int i, first, second, c;
  n = getint();
  for (i = 1; i <= n - 1; i++) {
    first = getint();
    second = getint();
    c = getint();
    v[first].push_back(make_pair(second, c));
    v[second].push_back(make_pair(first, c));
  }
  dfs(1, -1);
  Dfs(1, -1, 0);
  double fans = ans;
  fans /= (n - 1);
  printf("%.6lf\n", fans);
  return 0;
}
