#include <bits/stdc++.h>
using namespace std;
long double dfs(map<long long, vector<long long> >& m, vector<long long>& vis,
                long long sv) {
  vis[sv] = true;
  long double exp = 0;
  for (auto i : m[sv]) {
    if (!vis[i]) {
      exp += 1 + dfs(m, vis, i);
    }
  }
  if (exp == 0) return 0;
  if (sv == 1) return exp / (1.0 * m[sv].size());
  return exp / (1.0 * (m[sv].size() - 1));
}
int32_t main() {
  long long n;
  cin >> n;
  map<long long, vector<long long> > m;
  vector<long long> vis(n + 1);
  for (long long i = 0; i < n - 1; i++) {
    long long u, v;
    cin >> u >> v;
    m[u].push_back(v);
    m[v].push_back(u);
  }
  cout << fixed << setprecision(15) << dfs(m, vis, 1);
}
