#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e5 + 5;
vector<vector<int> > adj;
double prob[maxn];
vector<bool> used(maxn, false);
vector<int> d(maxn, 0);
void dfs(int u = 0) {
  used[u] = 1;
  int cnt = 0;
  for (auto to : adj[u]) {
    if (!used[to]) cnt++;
  }
  if (cnt == 0) return;
  double p = prob[u] / cnt;
  for (auto to : adj[u]) {
    if (!used[to]) {
      prob[to] = p;
      dfs(to);
      d[to] = d[u] + 1;
    }
  }
}
int main() {
  int n;
  cin >> n;
  adj.resize(n);
  prob[0] = 1;
  for (int i = 0; i < n - 1; i++) {
    int u, v;
    cin >> u >> v;
    u--;
    v--;
    adj[u].push_back(v);
    adj[v].push_back(u);
  }
  dfs();
  double ans = 0;
  for (int i = 0; i < n; i++) ans += (double)prob[i] * d[i];
  printf("%.10lf", ans);
  return 0;
}
