#include <bits/stdc++.h>
using namespace std;
int ecnt;
struct Edge {
  int to, w;
  Edge *next;
} * mat[100050], edges[100050 * 2];
void link(int x, int to, int w) {
  edges[ecnt].to = to;
  edges[ecnt].w = w;
  edges[ecnt].next = mat[x];
  mat[x] = &edges[ecnt++];
}
int n;
int num[100050];
long long g[100050];
long long f[100050];
struct Node {
  int num;
  long long g;
  Node(int x, long long y) : num(x), g(y) {}
};
bool cmp(const Node &a, const Node &b) { return a.num * b.g > b.num * a.g; }
void dfs(int x, int father) {
  num[x] = 1;
  vector<Node> now;
  for (Edge *p = mat[x]; p; p = p->next) {
    int to = p->to;
    if (to == father) continue;
    dfs(to, x);
    num[x] += num[to];
    f[x] += f[to] + num[to] * p->w;
    g[to] += 2 * p->w;
    g[x] += g[to];
    now.push_back(Node(num[to], g[to]));
  }
  sort(now.begin(), now.end(), cmp);
  int tol = num[x] - 1;
  for (int i = 0; i < now.size(); i++) {
    tol -= now[i].num;
    f[x] += tol * now[i].g;
  }
}
int main() {
  scanf("%d", &n);
  for (int i = 0; i < n - 1; i++) {
    int x, y, w;
    scanf("%d%d%d", &x, &y, &w);
    link(x, y, w);
    link(y, x, w);
  }
  dfs(1, -1);
  printf("%.10f\n", f[1] * 1.0 / (n - 1));
  return 0;
}
