#include <bits/stdc++.h>
using namespace std;
namespace Poor {
const int MaxiN = 100005;
int N;
long long Ans;
int Pa[MaxiN];
long long Opt[MaxiN], Route[MaxiN], Size[MaxiN];
vector<pair<int, int> > Adj[MaxiN];
bool Cmp(pair<int, int> A, pair<int, int> B) {
  return Size[B.first] * (Route[A.first] + 2LL * A.second) <
         Size[A.first] * (Route[B.first] + 2LL * B.second);
}
void DFS(int Cur) {
  for (typeof(Adj[Cur].begin()) it = Adj[Cur].begin(); it != Adj[Cur].end();
       ++it)
    if (it->first != Pa[Cur]) {
      Pa[it->first] = Cur;
      DFS(it->first);
      Size[Cur] += Size[it->first];
      Route[Cur] += Route[it->first] + 2LL * it->second;
    }
  for (int i = 0; i < (int)Adj[Cur].size(); ++i)
    while (i < (int)Adj[Cur].size() && Pa[Adj[Cur][i].first] != Cur) {
      swap(Adj[Cur][i], Adj[Cur][Adj[Cur].size() - 1]);
      Adj[Cur].pop_back();
    }
  sort(Adj[Cur].begin(), Adj[Cur].end(), Cmp);
  long long Rest = Size[Cur];
  for (typeof(Adj[Cur].begin()) it = Adj[Cur].begin(); it != Adj[Cur].end();
       ++it) {
    Rest -= Size[it->first];
    Ans += Size[it->first] * it->second +
           Rest * (Route[it->first] + 2LL * it->second);
  }
  ++Size[Cur];
}
void Run() {
  scanf("%d", &N);
  for (int i = 0; i < N - 1; ++i) {
    int U, V, C;
    scanf("%d%d%d", &U, &V, &C);
    Adj[U].push_back(make_pair(V, C));
    Adj[V].push_back(make_pair(U, C));
  }
  DFS(1);
  printf("%.10lf\n", (double)Ans / (N - 1));
}
}  // namespace Poor
int main() {
  Poor::Run();
  return 0;
}
