Problem: There are n cities and n - 1 roads in the Seven Kingdoms, each road connects two cities and we can reach any city from any other by the roads.

Theon and Yara Greyjoy are on a horse in the first city, they are starting traveling through the roads. But the weather is foggy, so they can’t see where the horse brings them. When the horse reaches a city (including the first one), it goes to one of the cities connected to the current city. But it is a strange horse, it only goes to cities in which they weren't before. In each such city, the horse goes with equal probabilities and it stops when there are no such cities. 

Let the length of each road be 1. The journey starts in the city 1. What is the expected length (expected value of length) of their journey? You can read about expected (average) value by the link <https://en.wikipedia.org/wiki/Expected_value>.

Input

The first line contains a single integer n (1 ≤ n ≤ 100000) — number of cities.

Then n - 1 lines follow. The i-th line of these lines contains two integers ui and vi (1 ≤ ui, vi ≤ n, ui ≠ vi) — the cities connected by the i-th road.

It is guaranteed that one can reach any city from any other by the roads.

Output

Print a number — the expected length of their journey. The journey starts in the city 1.

Your answer will be considered correct if its absolute or relative error does not exceed 10 - 6.

Namely: let's assume that your answer is a, and the answer of the jury is b. The checker program will consider your answer correct, if <image>.

Examples

Input

4
1 2
1 3
2 4


Output

1.500000000000000


Input

5
1 2
1 3
3 4
2 5


Output

2.000000000000000

Note

In the first sample, their journey may end in cities 3 or 4 with equal probability. The distance to city 3 is 1 and to city 4 is 2, so the expected length is 1.5.

In the second sample, their journey may end in city 4 or 5. The distance to the both cities is 2, so the expected length is 2.

Solution (in PYTHON3):

Solution:
from os import path
import sys,time, collections as c , math as m , pprint as p
maxx , localsys , mod = float('inf'), 0 , int(1e9 + 7) 
if (path.exists('input.txt')):  sys.stdin=open('input.txt','r') ;   sys.stdout=open('output.txt','w')
input = sys.stdin.readline
n = int(input()) ; g = c.defaultdict(list)
for _ in range(n-1):
    u , v = map(int , input().split())
    g[u].append(v)
    g[v].append(u)
v , q  , ans  = [0]*(n+1) , [(1 ,1 ,1)] , 0 #p , cnt , height
while q :
    p , cnt , h = q.pop()
    v[p] , c = 1 , 0
    for i in g[p]:
        if not v[i]:
            c+=1
    if c == 0 :
        ans+= cnt*h
    else:
        for i in g[p]:
            if not v[i]:
                q.append((i , cnt/c , h+1))
                v[i] = 1
print('%.14f'%(ans-1))
# # 70
# 1 25
# 57 1
# 18 1
# 65 1
# 38 1
# 1 41
# 1 5
# 1 69
# 1 3
# 31 1
# 1 8
# 1 9
# 53 1
# 70 1
# 45 1
# 1 24
# 1 42
# 1 30
# 1 12
# 1 37
# 64 1
# 1 28
# 1 58
# 1 22
# 11 1
# 1 4
# 1 27
# 1 16
# 1 21
# 54 1
# 1 51
# 1 43
# 29 1
# 56 1
# 1 39
# 32 1
# 1 15
# 1 17
# 1 19
# 1 40
# 36 1
# 48 1
# 63 1
# 1 7
# 1 47
# 1 13
# 1 46
# 60 1
# 1 6
# 23 1
# 20 1
# 1 52
# 2 1
# 26 1
# 1 59
# 1 66
# 10 1
# 1 62
# 1 68
# 1 55
# 50 1
# 33 1
# 44 1
# 1 34
# 1 35
# 1 61
# 14 1
# 67 1
# 49 1




























# def ok(p , s):
#     cnt , need =0 , 0
#     for i in s:
#         if p[need] == i:
#             cnt+=1 ; need ^= 1
#     if cnt % 2 and p[0] != p[1]:
#         cnt-=1
#     return cnt

# for _ in range(int(input())):
#     s = input().rstrip('\n') ; n , ans = len(s) , maxx
#     for i in range(10):
#         for j in range(10):
#             ans = min(ans , n - ok((str(i) , str(j)), s))
#     print(ans)
#This problem was so easy oh gawd , so you can only make left cyclic shift = right cyclic shift , when there are at most
#2 characters
#(incase of 1 ch) at the same time if total string has only character it is valid no matter how you see it 
#(incase of 2 ch) all the characters at odd positions must be equal , and all the characters at even position must be equal





# n , k = map(int , input().split()) ; s = input().rstrip('\n')
# ans = a = b = j = 0
# for i in range(n):
#     a , b = (a+1 , b) if s[i] == 'a' else (a , b+1 )
#     if min(a, b) > k :
#         a , b = (a -1 , b) if s[j] == 'a' else (a , b -1) ; j+=1
#     else:
#         ans+=1
# print(ans)
# #two - pointer method , if at any point min(a , b )> k then keep on decreasing from the beginning untill and unless you get min(a , b) 
# #less than k