#include <bits/stdc++.h>
using namespace std;
int n, k;
vector<int> adj[100100];
int mark[100100];
double dfs(int u, double d) {
  mark[u] = 1;
  double ans = 0.0;
  double dh;
  if (u == 1)
    dh = (double)(d / adj[u].size());
  else
    dh = (double)(d / (adj[u].size() - 1));
  for (int i = 0; i < adj[u].size(); ++i) {
    int v = adj[u][i];
    if (!mark[v] && u == 1)
      ans = ans + (double)(1.0 / (double)adj[u].size()) * (1.0 + dfs(v, dh));
    if (!mark[v] && u != 1)
      ans = ans +
            (double)(1.0 / (double)(adj[u].size() - 1)) * (1.0 + dfs(v, dh));
  }
  if (adj[u].size() == 0) return 0.0;
  return ans;
}
int main() {
  ios::sync_with_stdio(false);
  cin >> n;
  for (int i = 0, u, v; i < n - 1; ++i) {
    cin >> u >> v;
    adj[u].push_back(v);
    adj[v].push_back(u);
  }
  cout << fixed << setprecision(10) << dfs(1, 1.0);
  return 0;
}
