#include <bits/stdc++.h>
using namespace std;
inline int read() {
  int r = 0, f = 0;
  char c;
  while (!isdigit(c = getchar())) f |= (c == '-');
  while (isdigit(c)) r = (r << 1) + (r << 3) + (c ^ 48), c = getchar();
  return f ? -r : r;
}
struct E {
  int v, w, nxt;
  E() {}
  E(int v, int w, int nxt) : v(v), w(w), nxt(nxt) {}
} e[101101 << 1];
struct D {
  int size;
  long long sum, ans;
  D() {}
  D(int size, long long sum, long long ans) : size(size), sum(sum), ans(ans) {}
  bool operator<(const D &d) const { return sum * d.size < d.sum * size; }
  D operator+(const D &d) { return D(size + d.size, sum + d.sum, ans + d.ans); }
} d[101101];
int n, m, s_e, head[101101];
vector<D> son[101101];
inline void a_e(int u, int v, int w) {
  e[++s_e] = E(v, w, head[u]);
  head[u] = s_e;
}
void dfs(int u, int fa) {
  for (int i = head[u]; i; i = e[i].nxt) {
    int v = e[i].v, w = e[i].w;
    if (v == fa) continue;
    dfs(v, u);
    d[v].sum += 2 * w;
    d[v].ans += w * d[v].size;
    d[u] = d[u] + d[v];
    son[u].push_back(d[v]);
  }
  sort(son[u].begin(), son[u].end());
  int size = d[u].size;
  for (int i = 0; i < (int)son[u].size(); i++) {
    size -= son[u][i].size;
    d[u].ans += son[u][i].sum * size;
  }
  d[u].size++;
}
int main() {
  n = read();
  for (int i = 1; i < n; i++) {
    int u = read(), v = read(), w = read();
    a_e(u, v, w), a_e(v, u, w);
  }
  dfs(1, 0);
  printf("%.6lf\n", (double)d[1].ans / (double)(n - 1));
  return 0;
}
