#include <bits/stdc++.h>
using std::bitset;
using std::cerr;
using std::cin;
using std::cout;
using std::endl;
using std::make_pair;
using std::map;
using std::pair;
using std::priority_queue;
using std::queue;
using std::set;
using std::string;
using std::stringstream;
using std::vector;
class MyTimer {
 public:
  void reset() {}
  void report() {}
} myTimer;
template <typename T1, typename T2>
inline bool chmin(T1 &a, const T2 &b) {
  return a > b ? a = b, true : false;
}
template <typename T1, typename T2>
inline bool chmax(T1 &a, const T2 &b) {
  return a < b ? a = b, true : false;
}
inline int readint() {
  int a = 0;
  char c = getchar(), p = 0;
  while (isspace(c)) c = getchar();
  if (c == '-') p = 1, c = getchar();
  while (isdigit(c)) a = a * 10 + c - '0', c = getchar();
  return p ? -a : a;
}
inline long long readLL() {
  long long a = 0;
  char c = getchar(), p = 0;
  while (isspace(c)) c = getchar();
  if (c == '-') p = 1, c = getchar();
  while (isdigit(c)) a = a * 10 + c - '0', c = getchar();
  return p ? -a : a;
}
const int maxN = 100000 + 233;
int n, m;
vector<pair<int, int> > G[maxN];
long long size[maxN], sum[maxN], f[maxN];
void DFS_first(int u, int fa) {
  for (int i = 0; i < (int)G[u].size(); ++i)
    if (G[u][i].first == fa) {
      G[u].erase(G[u].begin() + i, G[u].begin() + i + 1);
      break;
    }
  size[u] = 1;
  sum[u] = 0;
  for (auto p : G[u]) {
    int v = p.first, w = p.second;
    DFS_first(v, u);
    size[u] += size[v];
    sum[u] += (sum[v] += 2 * w);
  }
}
bool cmp(pair<int, int> x, pair<int, int> y) {
  return sum[x.first] * size[y.first] < sum[y.first] * size[x.first];
}
void DFS(int u) {
  for (pair<int, int> p : G[u]) DFS(p.first);
  std::sort(G[u].begin(), G[u].end(), cmp);
  f[u] = 0;
  long long t = 0;
  for (pair<int, int> p : G[u]) {
    int v = p.first;
    f[u] += p.second * size[v] + t * size[v] + f[v];
    t += sum[v];
  }
}
int main() {
  n = readint();
  for (int i = 1; i < n; ++i) {
    int x = readint(), y = readint(), w = readint();
    G[x].push_back(pair<int, int>(y, w));
    G[y].push_back(pair<int, int>(x, w));
  }
  DFS_first(1, -1);
  DFS(1);
  cout << std::fixed << std::setprecision(8);
  cout << (f[1] / (double)(n - 1)) << endl;
  return 0;
}
