#include <bits/stdc++.h>
using namespace std;
const int N = 1e6 + 7;
long long n, used[N], len[N];
double ans, ver[N];
vector<long long int> d[N];
void dfs(int v, int ln, double f) {
  used[v] = 1;
  ver[v] = f;
  len[v] = ln;
  if (v != 1 && d[v].size() == 1) ans += ver[v] * len[v];
  for (int i = 0; i < d[v].size(); ++i) {
    int to = d[v][i];
    if (used[to] == 1) continue;
    double q = d[v].size();
    if (v != 1)
      dfs(to, ln + 1, f / (q - 1));
    else
      dfs(to, ln + 1, f / (q));
  }
}
int main() {
  cin >> n;
  for (int i = 1; i < n; ++i) {
    int a, b;
    cin >> a >> b;
    d[a].push_back(b);
    d[b].push_back(a);
  }
  dfs(1, 0, 1);
  printf("%.6f", ans);
  return 0;
}
