#include <bits/stdc++.h>
using namespace std;
vector<long long> x[100002];
bool visited[100002];
double sum = 0.0;
void dfs(long long u, long long v, double pre) {
  long long o = 0;
  visited[u] = true;
  for (long long i = 0; i < x[u].size(); i++) {
    if (visited[x[u][i]] == false) {
      o++;
    }
  }
  if (o == 0) {
    sum += pre * v;
  }
  for (long long i = 0; i < x[u].size(); i++) {
    if (visited[x[u][i]] == false) {
      dfs(x[u][i], v + 1, pre / o);
    }
  }
}
int main() {
  long long n;
  cin >> n;
  memset(visited, false, sizeof(visited));
  for (long long i = 0; i < n - 1; i++) {
    long long a, b;
    cin >> a >> b;
    x[a].push_back(b);
    x[b].push_back(a);
  }
  dfs(1, 0, 1);
  cout << fixed << setprecision(15) << sum << endl;
}
