#include <bits/stdc++.h>
using namespace std;
vector<int> v[(int)1e5 + 1];
vector<int> visited;
vector<double> level, prob;
void dfs(int u = 0) {
  visited[u] = 1;
  for (auto c : v[u])
    if (!visited[c] and u == 0) {
      level[c] = level[u] + 1;
      prob[c] = prob[u] * (1.0 / v[u].size());
      dfs(c);
    } else if (!visited[c]) {
      level[c] = level[u] + 1;
      prob[c] = prob[u] * (1.0 / (v[u].size() - 1));
      dfs(c);
    }
}
int main() {
  int n;
  cin >> n;
  if (n == 1) {
    cout << 0 << '\n';
    return 0;
  }
  level.resize(n, 0);
  visited.resize(n, 0);
  prob.resize(n, 1);
  for (int i = 0; i < n - 1; i++) {
    int x, y;
    cin >> x >> y;
    x--, y--;
    v[x].push_back(y);
    v[y].push_back(x);
  }
  dfs();
  double ans = 0;
  for (int i = 1; i < n; i++)
    if (v[i].size() == 1) ans += level[i] * prob[i];
  cout << fixed << setprecision(12) << ans << '\n';
}
