#include <bits/stdc++.h>
using namespace std;
int n;
long double ans;
vector<int> g[100005];
void dfs(int v, int p, int l, long double f) {
  if ((int)g[v].size() == 1 && g[v][0] == p) {
    ans += (long double)l * f;
    return;
  }
  int k = (int)g[v].size();
  if (v != 1) --k;
  for (int i = 0; i < (int)g[v].size(); ++i) {
    int to = g[v][i];
    if (to != p) dfs(to, v, l + 1, (long double)f / k);
  }
}
int main() {
  ios_base::sync_with_stdio(0);
  cin >> n;
  for (int i = 0; i < n - 1; ++i) {
    int from, to;
    cin >> from >> to;
    g[from].push_back(to);
    g[to].push_back(from);
  }
  dfs(1, 1, 0, 1);
  cout.precision(7);
  cout << fixed << ans;
  return 0;
}
