#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 5;
struct node {
  int x;
  long long y;
  int z;
  bool operator<(const node &a) const { return y * a.x < a.y * x; }
};
int n, siz[N];
long long f[N], f1[N], f2[N];
vector<pair<int, int> > G[N];
void dfs(int x, int fa) {
  vector<node> t;
  siz[x] = 1;
  for (auto it : G[x])
    if (it.first != fa) {
      dfs(it.first, x);
      f1[x] += f1[it.first];
      siz[x] += siz[it.first];
      t.push_back({siz[it.first], f2[it.first] + 2 * it.second, it.second});
    }
  sort(t.begin(), t.end());
  for (auto it : t) f1[x] += (f2[x] + it.z) * it.x, f2[x] += it.y;
}
int main() {
  ios ::sync_with_stdio(0);
  cin >> n;
  for (int i = 1, x, y, z; i < n; i++)
    cin >> x >> y >> z, G[x].push_back({y, z}), G[y].push_back({x, z});
  dfs(1, 0);
  printf("%.10f", 1.0 * f1[1] / (n - 1));
  return 0;
}
