#include <bits/stdc++.h>
using namespace std;
const int N = 100005;
vector<int> edge[N], sons[N];
int n;
bool vis[N];
double f[N];
double ans;
void dfs_tree(int u) {
  vis[u] = 1;
  for (unsigned int i = 0; i < edge[u].size(); i++) {
    int v = edge[u][i];
    if (!vis[v]) {
      dfs_tree(v);
      sons[u].push_back(v);
    }
  }
}
void dfs(int u, int d) {
  int m = sons[u].size();
  if (m == 0) {
    ans += f[u] * d;
    return;
  }
  for (int i = 0; i < m; i++) {
    int v = sons[u][i];
    f[v] = f[u] / m;
    dfs(v, d + 1);
  }
}
int main() {
  scanf("%d", &n);
  for (int i = 1; i < n; i++) {
    int u, v;
    scanf("%d%d", &u, &v);
    edge[u].push_back(v);
    edge[v].push_back(u);
  }
  dfs_tree(1);
  f[1] = 1;
  dfs(1, 0);
  printf("%.9lf\n", ans);
}
