#include <bits/stdc++.h>
using namespace std;
vector<int> arr[100005];
int vis[100005];
vector<int> v;
double res = 0.000000000000;
void dfs(int node, int dis, double factor) {
  vis[node] = 1;
  bool leaf = 1;
  int x = 0;
  for (int i = 0; i < arr[node].size(); i++) {
    if (!vis[arr[node][i]]) {
      x += 1;
    }
  }
  for (int i = 0; i < arr[node].size(); i++) {
    if (!vis[arr[node][i]]) {
      leaf = 0;
      dfs(arr[node][i], dis + 1, factor / x);
    }
  }
  if (leaf) {
    res += factor * dis;
  }
}
int main() {
  int n;
  cin >> n;
  for (int i = 0; i < n - 1; i++) {
    int x, y;
    cin >> x >> y;
    arr[x].push_back(y);
    arr[y].push_back(x);
  }
  dfs(1, 0, 1);
  cout << fixed << setprecision(10) << res << endl;
}
