#include <bits/stdc++.h>
using namespace std;
int n, m;
int k;
bool debug = false;
vector<pair<int, int>> mp[100005];
long long a[100005], ss;
int cou[100005];
long long dfs(int x, int p, long long t) {
  a[x] = t;
  vector<pair<double, pair<long long, int>>> aa;
  long long r = 0;
  for (auto child : mp[x])
    if (child.first != p) {
      long long ans = dfs(child.first, x, child.second + t) + child.second;
      r += ans;
      ss += child.second * cou[child.first];
      aa.push_back({ans * 1.0 / cou[child.first], {ans, child.first}});
    }
  if (aa.size() == 0) return 0;
  if (aa.size() == 1) return r;
  sort(aa.begin(), aa.end());
  long long tt = 0;
  for (auto yy : aa) {
    auto y = yy.second;
    ss += tt * cou[y.second];
    tt += y.first * 2;
  }
  return r;
}
void dfsc(int x, int p) {
  cou[x] = 1;
  for (auto child : mp[x])
    if (child.first != p) {
      dfsc(child.first, x);
      cou[x] += cou[child.first];
    }
}
int main() {
  scanf("%d", &n);
  for (int i = 0, a, b, t; i < n - 1; i++) {
    scanf("%d%d%d", &a, &b, &t);
    mp[a].push_back({b, t});
    mp[b].push_back({a, t});
  }
  dfsc(1, 0);
  dfs(1, 0, 0);
  printf("%.10lf\n", 1.0 * ss / (n - 1));
  return 0;
}
