#include <bits/stdc++.h>
using namespace std;
int n;
vector<vector<int> > tree;
double ans[1000005];
double curweight;
double visited[100005];
int curdepth;
void dfs(int v) {
  visited[v] = 1;
  double s = tree[v].size();
  if (s == 1 && v != 1) {
    ans[curdepth] += curweight;
    return;
  }
  for (int i = 0; i < s; i++) {
    int child = tree[v][i];
    if (visited[child] == 1) continue;
    if (v == 1)
      curweight *= 1 / s;
    else
      curweight *= 1 / (s - 1);
    curdepth++;
    dfs(child);
    if (v == 1)
      curweight *= s;
    else
      curweight *= (s - 1);
    curdepth--;
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin >> n;
  tree.resize(n + 10);
  for (int i = 0; i < n - 1; i++) {
    int u, v;
    cin >> u >> v;
    tree[u].push_back(v);
    tree[v].push_back(u);
  }
  memset(ans, 0, sizeof(ans));
  memset(visited, 0, sizeof(visited));
  curweight = 1;
  curdepth = 0;
  dfs(1);
  double myans = 0;
  for (int i = 0; i <= n; i++) {
    myans += i * ans[i];
  }
  printf("%.9f", myans);
  return 0;
}
