#include <bits/stdc++.h>
using namespace std;
vector<int> adj[100005];
int lev[100005];
double prb[100005];
vector<int> leaf;
void dfs(int u, int par) {
  int flag = 0;
  for (int i = 0; i < adj[u].size(); i++) {
    int v = adj[u][i];
    if (v == par) continue;
    lev[v] = lev[u] + 1;
    if (u == 1)
      prb[v] = prb[u] / (adj[u].size());
    else
      prb[v] = prb[u] / (adj[u].size() - 1);
    dfs(v, u);
    flag = 1;
  }
  if (!flag) leaf.push_back(u);
}
int main() {
  ios_base::sync_with_stdio(false);
  int n;
  cin >> n;
  for (int i = 0; i < n - 1; i++) {
    int a, b;
    cin >> a >> b;
    adj[a].push_back(b);
    adj[b].push_back(a);
  }
  lev[1] = 0;
  prb[1] = 1;
  dfs(1, 0);
  double sum = 0;
  for (int i = 0; i < leaf.size(); i++) {
    sum += (lev[leaf[i]] * 1.0) * prb[leaf[i]];
  }
  cout << fixed << setprecision(8) << sum << '\n';
  return 0;
}
