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 JAVA):

Solution:
/*	/ ﾌﾌ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ム
	/ )\⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀Y
	(⠀⠀| ( ͡° ͜ʖ ͡°）⠀⠀⠀ ⌒(⠀ ノ
	(⠀ ﾉ⌒ Y ⌒ヽ-く __／
	| _⠀｡ノ| ノ｡ |/
	(⠀ー '_人`ー ﾉ
	⠀|\ ￣ _人'彡ﾉ
	⠀ )\⠀⠀ ｡⠀⠀ /
	⠀⠀(\⠀ #⠀ /
	⠀/⠀⠀⠀/ὣ========D-
	/⠀⠀⠀/⠀ \ \⠀⠀\
	( (⠀)⠀⠀⠀⠀ ) ).⠀)
	(⠀⠀)⠀⠀⠀⠀⠀( | /
	|⠀ /⠀⠀⠀⠀⠀⠀ | /
	[_] ⠀⠀⠀⠀⠀[___]                     */
//1:-segment tree (class segment_tree)
//2:-Prime check (class Prime_check)
//3:-greatest common divisor (class GFG)
//4:-modulus class (class mod_)

import java.util.*;
import java.io.*;
import java.math.BigInteger;
import java.math.BigDecimal;

public class srx2
{
static class segment_tree
{
	static int st[];
	public static void cons(int a[])
	{
		int x=(int)Math.ceil((Math.log(a.length)/Math.log(2)));
		int size=2*((int)(Math.pow(2,x)))-1;
		st=new int[size];
		consut(a,0,a.length-1,0);
	}
	public static int consut(int a[],int ss,int se,int si)
	{
		if(ss==se)
		{	
			st[si]=a[ss];
			return st[si];
		}
		int mid=(ss+se)/2;
		st[si]=consut(a,ss,mid,2*si+1)+consut(a,mid+1,se,2*si+2);
		return st[si];
	}
	public static int getsum(int ss,int se,int qs,int qe,int si)
	{
		if(qs<=ss && qe>=se)
			return st[si];
		if(qs>se || ss>qe)
			return 0;
		int mid=(ss+se)/2;
		return getsum(ss,mid,qs,qe,2*si+1)+getsum(mid+1,se,qs,qe,2*si+2);
	}
	public static void update(int ss,int se,int i,int diff,int si)
	{
		if(i<ss || i>se)
			return;
		st[si]+=diff;
		int mid=(ss+se)/2;
		if(ss!=se)
		{
			update(ss,mid,i,diff,2*si+1);
			update(mid+1,se,i,diff,2*si+2);
		}
	}
}

static class Prime_check
{
	public static boolean isPrime(long n) 
    	{  
        	if (n <= 1) return false; 
       		if (n <= 3) return true; 
      
	        if (n % 2 == 0 || n % 3 == 0) return false; 
      
     		   for (long i = 5; i * i <= n; i = i + 6) 
     		       if (n % i == 0 || n % (i + 2) == 0) 
     			       return false; 
      
        	return true; 
    	}
}

static class GFG
{
	public static long gfg(long a,long b)
	{
		if(b==0)
			return a;
		else
			return gfg(b,a%b);
	}
}

static class mod_
{
	static long MOD=1000000007;
	public static long fast_exp(long x, long y) 
    	{ 
        	long res = 1;      
        	x = x % MOD;  
      		while (y > 0) 
        	{ 
            		if((y & 1)==1) 
                		res = (res * x) % MOD; 
      			y = y >> 1;  
            		x = (x * x) % MOD;
        	} 
        	return res; 
    	}
}
static class obj
{
	int a;
	int b;
	int c;
	public obj(int x,int y,int z)
	{
		a=x;
		b=y;
		c=z;
	}
}
	public static void main(String args[])throws IOException
	{
		Scanner sc=new Scanner(System.in);
		int n=sc.nextInt();
		ArrayList<Integer> ar[]=new ArrayList[n];
		for(int i=0;i<n;i++)
		{
			ar[i]=new ArrayList<Integer>();
		}
		for(int i=0;i<n-1;i++)
		{
			int x=sc.nextInt();
			int y=sc.nextInt();
			ar[x-1].add(y-1);
			ar[y-1].add(x-1);
		}
		int vis[]=new int[n];
		double x=dfs(ar,vis,0,0.0,1.0,0.0);
		System.out.printf("%.7f\n",x);
	}
	public static double dfs(ArrayList<Integer> ar[],int vis[],int i,double ans,double div,double xx)
	{
		vis[i]=1;
		ans+=1;
		int flag=0;
		int count=0;
		for(int j=0;j<ar[i].size();j++)
			if(vis[ar[i].get(j)]==0)
				count+=1;
		if(count!=0)
			div*=count;
		//System.out.println("count: "+count+" of "+i+" present div= "+div);
		for(int j=0;j<ar[i].size();j++)
		{
			if(vis[ar[i].get(j)]==0)
			{
				flag=1;
				xx=dfs(ar,vis,ar[i].get(j),ans,div,xx);
				//System.out.println(xx+" "+i);
			}
		}
		if(flag==0)
			return xx+(1/div)*(ans-1);
		return xx;
	}
}