#include <bits/stdc++.h>
using namespace std;
struct Tedge {
  long long to, len, next;
} edge[1000050];
struct Stack {
  long long current, father, pointer;
} sk[1000050];
long long now, n, first[100050], all[100050], sum[100050], size[100050];
long long len[100050], number[100050];
long long Rand() { return (rand() << 15) | rand(); }
void Addedge(long long x, long long y, long long z) {
  edge[++now].to = y;
  edge[now].len = z;
  edge[now].next = first[x];
  first[x] = now;
  return;
}
bool Cmp(long long a, long long b) {
  return 1ll * sum[a] * size[b] < 1ll * sum[b] * size[a];
}
void DFS() {
  long long tp, current, father, pointer, next, total, cnt, i;
  sk[tp = 1].current = 1;
  sk[1].father = 1;
  sk[1].pointer = first[1];
  for (i = 1; i <= n; i++) {
    size[i] = 1;
  }
  while (tp > 0) {
    current = sk[tp].current;
    father = sk[tp].father;
    pointer = sk[tp].pointer;
    if (pointer) {
      next = edge[pointer].to;
      sk[tp].pointer = edge[pointer].next;
      if (next == father) {
        continue;
      }
      sum[next] += 2 * edge[pointer].len;
      sk[++tp].current = next;
      sk[tp].father = current;
      sk[tp].pointer = first[next];
    } else {
      size[father] += size[current];
      sum[father] += sum[current];
      total = cnt = 0;
      for (pointer = first[current]; pointer; pointer = edge[pointer].next) {
        next = edge[pointer].to;
        if (next == father) {
          continue;
        }
        len[next] = edge[pointer].len;
        cnt += size[next];
        number[++total] = next;
      }
      sort(number + 1, number + total + 1, Cmp);
      for (i = 1; i <= total; i++) {
        all[current] += all[number[i]];
        all[current] += len[number[i]] * size[number[i]];
        cnt -= size[number[i]];
        all[current] += sum[number[i]] * cnt;
      }
      tp--;
    }
  }
  return;
}
int main() {
  long long i, x, y, z;
  double answer;
  srand((unsigned)time(0));
  scanf("%I64d", &n);
  for (i = 1; i < n; i++) {
    scanf("%I64d%I64d%I64d", &x, &y, &z);
    Addedge(x, y, z);
    Addedge(y, x, z);
  }
  DFS();
  answer = all[1];
  answer /= n - 1;
  printf("%.10lf\n", answer);
  return 0;
}
