#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 5;
vector<int> adj[N];
int n;
void BFS(int src) {
  bool vis[n + 1];
  memset(vis, false, sizeof(vis));
  vis[src] = true;
  queue<pair<int, pair<long double, long double> > > Q;
  Q.push({src, {1, 0}});
  long double ans = 0;
  while (!Q.empty()) {
    auto p = Q.front();
    Q.pop();
    int u = p.first;
    long double prob = p.second.first;
    long double len = p.second.second;
    vis[u] = true;
    long double sz = adj[u].size();
    if (u != 1) sz--;
    if (sz == 0) {
      ans += prob * len;
      continue;
    }
    for (auto neig : adj[u]) {
      if (!vis[neig]) {
        pair<int, pair<long double, long double> > p = {neig,
                                                        {prob / sz, len + 1}};
        Q.push(p);
      }
    }
  }
  cout.precision(15);
  cout << ans << "\n";
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cin >> n;
  for (int i = 0; i < n - 1; i++) {
    int u, v;
    cin >> u >> v;
    adj[u].push_back(v);
    adj[v].push_back(u);
  }
  BFS(1);
  return 0;
}
