#include <bits/stdc++.h>
using namespace std;
const int N = 100105;
int hah[N];
int t[N], k[N];
int visitTime;
int T[N];
int e;
struct Node {
  int v, t;
  double p;
};
vector<Node> E[N];
struct {
  int v, t, next;
} edge[2 * N];
void insertEdge(int head, int tail, int t) {
  edge[e].v = tail;
  edge[e].t = t;
  edge[e].next = hah[head];
  hah[head] = e++;
}
void dfsNodeAndTime(int head, int father, int vt) {
  k[head] = 1;
  t[head] = 2 * vt;
  int i;
  for (i = hah[head]; i >= 0; i = edge[i].next) {
    if (edge[i].v != father) {
      int v = edge[i].v;
      int time = edge[i].t;
      Node tmp;
      tmp.t = time;
      tmp.v = v;
      E[head].push_back(tmp);
      dfsNodeAndTime(v, head, time);
      k[head] += k[v];
      t[head] += t[v];
    }
  }
}
int cmp(Node a, Node b) { return a.p < b.p; }
void DFS(int head) {
  int s = E[head].size();
  int i;
  int v;
  for (i = 0; i < s; i++) {
    v = E[head][i].v;
    E[head][i].p = (double)t[v] / (double)k[v];
  }
  sort(E[head].begin(), E[head].end(), cmp);
  for (i = 0; i < s; i++) {
    v = E[head][i].v;
    visitTime += E[head][i].t;
    T[v] = visitTime;
    DFS(v);
    visitTime += E[head][i].t;
  }
}
int main() {
  int n;
  while (scanf("%d", &n) != EOF) {
    visitTime = 0;
    e = 0;
    memset(hah, -1, sizeof(hah));
    int i;
    for (i = 0; i < N; i++) {
      E[i].clear();
    }
    int a, b, t;
    for (i = 1; i < n; i++) {
      scanf("%d%d%d", &a, &b, &t);
      insertEdge(a, b, t);
      insertEdge(b, a, t);
    }
    dfsNodeAndTime(1, -1, 0);
    DFS(1);
    double ans = 0;
    for (i = 2; i <= n; i++) {
      ans += 1.0 * T[i];
    }
    printf("%.12lf\n", ans * 1.0 / (n - 1));
  }
  return 0;
}
