Problem:
Score : 600 points

Problem Statement

Given is a tree T with N vertices. The i-th edge connects Vertex A_i and B_i (1 \leq A_i,B_i \leq N).

Now, each vertex is painted black with probability 1/2 and white with probability 1/2, which is chosen independently from other vertices. Then, let S be the smallest subtree (connected subgraph) of T containing all the vertices painted black. (If no vertex is painted black, S is the empty graph.)

Let the holeyness of S be the number of white vertices contained in S. Find the expected holeyness of S.

Since the answer is a rational number, we ask you to print it \bmod 10^9+7, as described in Notes.

Notes

When you print a rational number, first write it as a fraction \frac{y}{x}, where x, y are integers, and x is not divisible by 10^9 + 7
(under the constraints of the problem, such representation is always possible).

Then, you need to print the only integer z between 0 and 10^9 + 6, inclusive, that satisfies xz \equiv y \pmod{10^9 + 7}.

Constraints

2 \leq N \leq 2 \times 10^5

1 \leq A_i,B_i \leq N

The given graph is a tree.

Input

Input is given from Standard Input in the following format:

N
A_1 B_1
:
A_{N-1} B_{N-1}

Output

Print the expected holeyness of S, \bmod 10^9+7.

Sample Input 1

3
1 2
2 3

Sample Output 1

125000001

If the vertices 1, 2, 3 are painted black, white, black, respectively, the holeyness of S is 1.

Otherwise, the holeyness is 0, so the expected holeyness is 1/8.

Since 8 \times 125000001 \equiv 1 \pmod{10^9+7}, we should print 125000001.

Sample Input 2

4
1 2
2 3
3 4

Sample Output 2

375000003

The expected holeyness is 3/8.

Since 8 \times 375000003 \equiv 3 \pmod{10^9+7}, we should print 375000003.

Sample Input 3

4
1 2
1 3
1 4

Sample Output 3

250000002

The expected holeyness is 1/4.

Sample Input 4

7
4 7
3 1
2 6
5 2
7 1
2 7

Sample Output 4

570312505

Solution in Python (3.4.3) (judge verdict: Runtime Error)


"""
Writer: SPD_9X2
https://atcoder.jp/contests/abc149/tasks/abc149_f

全方位木dpか？
→保持する値は、小部分木の頂点の数

頂点数a,b,c,dの4つの部分木が付いてる時の確率は

1/2 * (1-黒を持つ成分が1つ以下の確率)

黒を持つ成分が1つ以下の確率 = all白の確率+aのみall白+bのみall白+c+d
all白の確率 = aが白*b*c*d = 1/2**(n-1)
aのみ黒 = (1-a)*b*c*d

aが白の確率 = (1/2) ** a

all白の確率は, 累計O(N)で構築可能
aのみ白・・etc は、あらかじめ(1-a)*(1-b)…を計算しておき、差分計算する
そうすれば全体O(N)で構築可能
結果としてO(N)で解ける。

全方位木dpでは、結局接続する小部分木の頂点の数の集合が分ければ解ける
→親部分木の大きさは分かるので全方位感がないね？

"""
def inverse(a,mod): #aのmodを法にした逆元を返す
    return pow(a,mod-2,mod)

N = int(input())

lis = [ [] for i in range(N) ]

for i in range(N-1):

    A,B = map(int,input().split())

    A -= 1
    B -= 1

    lis[A].append(B)
    lis[B].append(A)

mod = 10**9+7
half = 500000004
hxx = [1,half] #1/2の累乗をO(1)で出すための奴
bxx = [1,2] #2の累乗をO(1)で出す
for i in range(N):
    hxx.append(hxx[-1] * half % mod)
    bxx.append(bxx[-1] * 2 % mod)

ans = [0]

def dfs(v,p,ans):

    vns = []
    ret = 1

    for nex in lis[v]:

        if nex != p:
            cvn = dfs(nex,v,ans)
            ret += cvn
            vns.append(cvn)

    if N-1-sum(vns) != 0:
        vns.append(N-1-sum(vns))

    #答えを求めるパート
        
    b_zero_one = hxx[N-1]

    for i in vns:
        b_zero_one += hxx[N-1-i] * (1-hxx[i])

    #print (v,half * (1-b_zero_one) % mod)
    ans[0] += half * (1-b_zero_one)
    ans[0] %= mod

    return ret

ans = [0]
dfs(0,0,ans)
print (ans[0])