#include <bits/stdc++.h>
using namespace std;
struct Node {
  vector<int> adj;
};
Node graph[100005];
int d[100005];
int visited[100005];
double p[100005];
vector<int> last;
void dfs(int node) {
  visited[node] = true;
  int adjlist = graph[node].adj.size();
  for (int i = 0; i < adjlist; ++i) {
    int v = graph[node].adj[i];
    if (!visited[v]) {
      if (node != 1)
        p[v] = p[node] * (1.0 / (double)(adjlist - 1));
      else
        p[v] = p[node] * (1.0 / (double)(adjlist));
      d[v] = d[node] + 1;
      dfs(v);
    }
  }
  if (adjlist == 1 && node != 1) last.push_back(node);
  return;
}
int main() {
  int n;
  double avg = 0.0;
  cin >> n;
  for (int i = 1; i < n; ++i) {
    int a, b;
    cin >> a >> b;
    graph[a].adj.push_back(b);
    graph[b].adj.push_back(a);
  }
  memset(visited, false, sizeof(visited));
  memset(d, 0, sizeof(d));
  memset(p, 1, sizeof(p));
  for (int i = 1; i <= n; ++i) {
    p[i] = 1.0;
  }
  dfs(1);
  for (int i = 0; i < last.size(); ++i) {
    avg += ((double)d[last[i]]) * (p[last[i]]);
  }
  cout << fixed << setprecision(15) << avg;
  return 0;
}
