#include <bits/stdc++.h>
using namespace std;
const int maxn = 100000 + 10;
const int inf = 0x3f3f3f3f;
const double eps = 1e-8;
const int dx[8] = {0, 0, 1, -1, 1, 1, -1, -1};
const int dy[8] = {1, -1, 0, 0, 1, -1, 1, -1};
double res;
int n;
vector<int> v[maxn];
void dfs(int id, int f, double l, double p) {
  int sz = v[id].size();
  int ok = 0;
  for (int i = 0; i < sz; i++) {
    if (v[id][i] != f) {
      ok = 1;
      dfs(v[id][i], id, l + 1.0, p / (sz - 1.0));
    }
  }
  if (ok == 0) res += (p * l);
}
int main() {
  res = 0.0;
  scanf("%d", &n);
  int a, b;
  for (int i = 1; i < n; i++) {
    scanf("%d%d", &a, &b);
    v[a].push_back(b);
    v[b].push_back(a);
  }
  v[1].push_back(0);
  dfs(1, 0, 0.0, 1.0);
  printf("%f\n", res);
  return 0;
}
