#include <bits/stdc++.h>
using namespace std;
const int MAXN = 100005;
int n, s[MAXN], son[MAXN];
double ans;
int Read() {
  int x = 0, f = 1;
  char c = getchar();
  while (c > '9' || c < '0') {
    if (c == '-') f = -1;
    c = getchar();
  }
  while (c >= '0' && c <= '9') {
    x = (x * 10) + (c ^ 48);
    c = getchar();
  }
  return x * f;
}
void Put1(int x) {
  if (x > 9) Put1(x / 10);
  putchar(x % 10 ^ 48);
}
void Put(int x, char c = -1) {
  if (x < 0) putchar('-'), x = -x;
  Put1(x);
  if (c >= 0) putchar(c);
}
template <typename T>
T Max(T x, T y) {
  return x > y ? x : y;
}
template <typename T>
T Min(T x, T y) {
  return x < y ? x : y;
}
template <typename T>
T Abs(T x) {
  return x < 0 ? -x : x;
}
int head[MAXN], tot;
struct edge {
  int v, w, nxt;
} e[MAXN << 1];
void Add_Edge(int x, int y, int z) {
  e[++tot].v = y;
  e[tot].w = z;
  e[tot].nxt = head[x];
  head[x] = tot;
}
void Add_Double_Edge(int x, int y, int z) {
  Add_Edge(x, y, z);
  Add_Edge(y, x, z);
}
void dfs(int x, int fa) {
  son[x] = 1;
  for (int i = head[x]; i; i = e[i].nxt) {
    if (e[i].v == fa) continue;
    s[e[i].v] = e[i].w;
    dfs(e[i].v, x);
    s[x] += s[e[i].v];
    son[x] += son[e[i].v];
  }
}
struct node {
  int v, w, e;
  double ad;
  node() {}
  node(int v1, int w1, int e1, double ad1) {
    v = v1;
    w = w1;
    e = e1;
    ad = ad1;
  }
  bool operator<(const node &px) const { return ad < px.ad; }
};
void dfs2(int x, int fa, int cnt) {
  ans += cnt;
  vector<node> q;
  for (int i = head[x]; i; i = e[i].nxt) {
    if (e[i].v == fa) continue;
    q.push_back(node(e[i].v, s[e[i].v], e[i].w, 1.0 * s[e[i].v] / son[e[i].v]));
  }
  sort(q.begin(), q.end());
  for (int i = 0, len = q.size(); i < len; ++i) {
    dfs2(q[i].v, x, cnt + q[i].e);
    cnt += q[i].w * 2;
  }
}
int main() {
  n = Read();
  for (int i = 1; i < n; ++i) {
    int u = Read(), v = Read(), w = Read();
    Add_Double_Edge(u, v, w);
  }
  dfs(1, 0);
  dfs2(1, 0, 0);
  printf("%.7f", ans / (n - 1));
  return 0;
}
