#include <bits/stdc++.h>
using namespace std;
static const double PI = acos(-1.0);
const long long MOD = 1e9 + 7;
long long power(long long a, long long b) {
  long long ret = 1;
  while (b) {
    if (b & 1) ret *= a;
    a *= a;
    if (ret >= MOD) ret %= MOD;
    if (a >= MOD) a %= MOD;
    b >>= 1;
  }
  return ret;
}
long long invmod(long long x) { return power(x, MOD - 2); }
vector<long long> adj[100005];
double ans;
void dfs(long long u, long long prv, long long l, double f) {
  bool gg = false;
  for (long long i = 0; i < (long long)adj[u].size(); i++) {
    long long v = adj[u][i];
    if (v == prv) continue;
    gg = true;
    if (prv != 0)
      dfs(v, u, l + 1, f / (double)(adj[u].size() - 1));
    else
      dfs(v, u, l + 1, f / (double)(adj[u].size()));
  }
  if (!gg) ans = ans + (f * (double)l);
}
int main() {
  long long n, i, u, v;
  cin >> n;
  for (i = 0; i < n - 1; i++) {
    cin >> u >> v;
    adj[u].push_back(v);
    adj[v].push_back(u);
  }
  dfs(1, 0, 0, (double)1);
  printf("%.13lf", ans);
  return 0;
}
