#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 9;
double res = 0.0;
bool vis[N];
vector<int> g[N];
inline int read() {
  int s = 1, x = 0;
  char ch = getchar();
  while (ch < '0' || ch > '9') {
    if (ch == '-') s = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') {
    x = x * 10 + ch - '0';
    ch = getchar();
  }
  return s * x;
}
void dfs(int u, double d, double x) {
  queue<int> q;
  double y = 0.0;
  for (int v : g[u])
    if (!vis[v]) q.push(v), y++;
  if (q.empty())
    res += d * x;
  else {
    while (!q.empty()) {
      int v = q.front();
      q.pop();
      vis[v] = 1;
      dfs(v, d + 1, x / y);
    }
  }
}
int main() {
  int n = read();
  for (int i = 1; i < n; i++) {
    int u = read(), v = read();
    g[u].push_back(v);
    g[v].push_back(u);
  }
  memset(vis, 0, sizeof(vis));
  vis[1] = 1;
  dfs(1, 0, 1);
  return 0 * printf("%.8lf\n", res);
}
