#include <bits/stdc++.h>
using namespace std;
template <class T>
inline void input(T &x) {
  register char c = getchar();
  x = 0;
  int neg = 0;
  for (; ((c < 48 || c > 57) && c != '-'); c = getchar())
    ;
  if (c == '-') {
    neg = 1;
    c = getchar();
  }
  for (; c > 47 && c < 58; c = getchar()) {
    x = (x << 1) + (x << 3) + c - 48;
  }
  if (neg) x = -x;
}
inline long long bigmod(long long p, long long e, long long M) {
  long long ret = 1;
  for (; e > 0; e >>= 1) {
    if (e & 1) ret = (ret * p) % M;
    p = (p * p) % M;
  }
  return ret;
}
template <class T>
inline T gcd(T a, T b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
template <class T>
inline T modinverse(T a, T M) {
  return bigmod(a, M - 2, M);
}
const int N = 1e5 + 6;
int n, u, v, t;
vector<pair<int, int> > g[N];
long long dp[N];
vector<int> Nodes[N];
int C[N];
int sub[N];
bool cmp(int a, int b) {
  return (2 * C[a] + dp[a]) * sub[b] < (2 * C[b] + dp[b]) * sub[a];
}
void dfs(int u, int p = -1) {
  sub[u] = 1;
  for (auto x : g[u])
    if (x.first != p) {
      dfs(x.first, u);
      C[x.first] = x.second;
      dp[u] += 2 * x.second + dp[x.first];
      sub[u] += sub[x.first];
      Nodes[u].push_back(x.first);
    }
  sort((Nodes[u]).begin(), (Nodes[u]).end(), cmp);
}
long long ans = 0;
void Trv(int u, long long Time) {
  ans += Time;
  for (auto x : Nodes[u]) {
    Trv(x, Time + C[x]);
    Time += 2 * C[x] + dp[x];
  }
}
int main() {
  input(n);
  for (int i = 0; i < n - 1; i++) {
    input(u), input(v), input(t);
    g[u].push_back(make_pair(v, t));
    g[v].push_back(make_pair(u, t));
  }
  dfs(1, -1);
  Trv(1, 0);
  printf("%.10lf\n", ans / (n - 1.));
  return 0;
}
