#include <bits/stdc++.h>
using namespace std;
struct tri {
  long double a, b, c;
  tri(long double a, long double b, long double c) : a(a), b(b), c(c) {}
  tri() {}
};
int main() {
  ios_base::sync_with_stdio(false);
  int n;
  long double l = 0.0;
  cin >> n;
  vector<vector<int>> tree(n + 1);
  vector<bool> vis(n + 1, false);
  for (int i = 0; i < (n - 1); ++i) {
    int a, b;
    cin >> a >> b;
    tree[a].push_back(b);
    tree[b].push_back(a);
  }
  queue<tri> q;
  q.push(tri(1, 0, 1));
  vis[1] = true;
  while (!q.empty()) {
    int v = q.front().a;
    long double le = q.front().b;
    long double pos = q.front().c;
    q.pop();
    long double co = 0;
    for (__typeof((tree[v]).begin()) i = (tree[v]).begin();
         i != (tree[v]).end(); ++i) {
      if (!vis[*i]) {
        co++;
      }
    }
    if ((int)co == 0) {
      l += le / pos;
    } else {
      for (__typeof((tree[v]).begin()) i = (tree[v]).begin();
           i != (tree[v]).end(); ++i) {
        if (!vis[*i]) {
          q.push(tri(*i, le + 1, pos * co));
          vis[*i] = true;
        }
      }
    }
  }
  cout << std::setprecision(10);
  cout << l << "\n";
  return 0;
}
