#include <bits/stdc++.h>
using namespace std;
vector<long long> adj[100003];
bool vis[100003];
double d[100003], den[100003];
void dfs(long long u, long long level) {
  vis[u] = 1;
  d[u] = level;
  for (long long i = 0; i < adj[u].size(); ++i) {
    if (!vis[adj[u][i]]) dfs(adj[u][i], level + 1);
  }
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long n, i, j, k, s, x, u, v, c = 0;
  cin >> n;
  for (i = 0; i < n - 1; ++i) {
    cin >> u >> v;
    u--;
    v--;
    adj[u].push_back(v);
    adj[v].push_back(u);
  }
  if (n == 1) {
    cout << 0;
    return 0;
  }
  double ans = 0;
  den[0] = 1;
  queue<long long> q;
  q.push(0);
  while (!q.empty()) {
    u = q.front();
    vis[u] = 1;
    q.pop();
    for (i = 0; i < adj[u].size(); ++i)
      if (!vis[adj[u][i]]) {
        q.push(adj[u][i]);
        if (u)
          den[adj[u][i]] = (double)den[u] / ((double)adj[u].size() - 1.0);
        else
          den[adj[u][i]] = (double)den[u] / ((double)adj[u].size());
      }
  }
  for (i = 0; i < n; ++i) vis[i] = 0;
  dfs(0, 0);
  for (i = 0; i < n; ++i)
    if (i && adj[i].size() == 1) {
      ans += (double)d[i] * (double)den[i];
    }
  cout << fixed << setprecision(10) << ans;
  return 0;
}
