#include <bits/stdc++.h>
using namespace std;
vector<int> adj[100005];
double pb[100005] = {0};
int dist[100005] = {0};
bool visited[100005] = {0};
double ans = 0;
void dfs(int s) {
  if (visited[s]) return;
  visited[s] = true;
  int cnt = 0;
  for (auto u : adj[s]) {
    if (!visited[u]) {
      if (s != 1)
        pb[u] = pb[s] / (adj[s].size() - 1);
      else
        pb[u] = pb[s] / (adj[s].size());
      dist[u] = dist[s] + 1;
      dfs(u);
      cnt++;
    }
  }
  if (cnt == 0) {
    ans = ans + pb[s] * dist[s];
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int i, j, k;
  int n;
  cin >> n;
  for (i = 0; i <= n - 2; i++) {
    int u, v;
    cin >> u >> v;
    adj[u].push_back(v);
    adj[v].push_back(u);
  }
  pb[1] = 1;
  dist[1] = 0;
  dfs(1);
  printf("%.15f\n", ans);
}
