#include <bits/stdc++.h>
using namespace std;
void obhod(vector<int> b[100003], long double p[100003], int x, int g,
           long double& max, int y) {
  for (int i = 0; i < b[x].size(); i++) {
    if (b[x][i] == y) continue;
    p[b[x][i]] = p[x] / (b[x].size() - 1);
    obhod(b, p, b[x][i], g + 1, max, x);
  }
  if (b[x].size() == 1) max += p[x] * g;
}
void obhod1(vector<int> b[100003], long double p[100003], int x, int g,
            long double& max, int y) {
  for (int i = 0; i < b[x].size(); i++) {
    if (b[x][i] == y) continue;
    p[b[x][i]] = p[x] / b[x].size();
    obhod(b, p, b[x][i], g + 1, max, x);
  }
  if (b[x].size() == 1) max += p[x] * g;
}
int main() {
  vector<int> b[100003];
  long double p[100003], max = 0;
  int n, x, y;
  p[1] = 1;
  cin >> n;
  cout.precision(20);
  for (int i = 0; i < n - 1; i++) {
    cin >> x >> y;
    b[y].push_back(x);
    b[x].push_back(y);
  }
  obhod1(b, p, 1, 0, max, -1);
  cout << max << endl;
}
