#include <bits/stdc++.h>
using namespace std;
vector<int> v[100100];
queue<int> q;
long long int dis[100100], ma[100100], p[100100], n, m, x = 0, a = 0, b = 0;
long double sum = 0, ob[100100];
void dfs(int s) {
  int e = 0, x = 0;
  q.push(s);
  p[s] = 0;
  dis[s] = 0;
  ma[s] = 1;
  while (!q.empty()) {
    x = q.front();
    for (int i = 0; i < v[x].size(); i++) {
      e = v[x][i];
      if (ma[e] == 0) {
        if (x == 1) {
          ob[e] = 1;
          ob[e] /= v[1].size();
        } else {
          ob[e] = ob[x];
          ob[e] /= (v[x].size() - 1);
        }
        ma[e] = 1;
        p[e] = x;
        dis[e] = dis[x] + 1;
        q.push(e);
      }
    }
    q.pop();
  }
}
int main() {
  ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);
  cin >> n;
  fill(ma, ma + n + 2, 0);
  fill(ob, ob + n + 2, 1);
  for (int i = 1; i < n; i++) {
    cin >> a >> b;
    v[a].push_back(b);
    v[b].push_back(a);
  }
  dfs(1);
  ob[1] = 1;
  for (int i = 2; i <= n; i++) {
    if (v[i].size() == 1) sum += dis[i] * ob[i];
  }
  cout.precision(9);
  cout << std::fixed;
  cout << sum;
}
