#include <bits/stdc++.h>
using namespace std;
vector<vector<int> > edges;
vector<bool> visited;
vector<int> journey;
int n;
double ans = 0;
void dfs(int u, int d, double p) {
  visited[u] = true;
  int children = 0;
  for (int v : edges[u])
    if (!visited[v]) children++;
  for (int v : edges[u])
    if (!visited[v]) dfs(v, d + 1, p / children);
  if (children == 0) ans += p * d;
}
int main() {
  cin >> n;
  edges.resize(n + 1);
  visited = vector<bool>(n + 1, false);
  int u, v;
  for (int i = 0; i < n - 1; i++) {
    cin >> u >> v;
    edges[u].push_back(v);
    edges[v].push_back(u);
  }
  dfs(1, 0, 1.0);
  cout << fixed;
  cout.precision(15);
  cout << ans << "\n";
}
