import sys

readline = sys.stdin.buffer.readline



N = int(readline())

graph = [[] for _ in range(N + 1)]

for i in range(N - 1):

    a, b = list(map(int, readline().split()))

    lb = 1 << i

    graph[a].append(b)

    graph[b].append(a)



root = 1

parent = [0] * (N + 1)

order = []

stack = [root]

while stack:

    x = stack.pop()

    order.append(x)

    for y in graph[x]:

        if y == parent[x]:

            continue

        parent[y] = x

        stack.append(y)



MOD = 10**9 + 7

x = (MOD + 1) // 2

power_inv = [1] * (N + 100)

for i in range(1, N + 100):

    power_inv[i] = power_inv[i - 1] * x % MOD



size = [1] * (N + 1)

p_size = [N - 1] * (N + 1)

prod = [1] * (N + 1)

coef = [1] * (N + 1)

for v in order[::-1]:

    p = parent[v]

    x = size[v]

    size[p] += x



ans = 0

for i in size[2:]:

    ans += 1 - power_inv[i] - power_inv[N - i] + power_inv[N]

    ans %= MOD

ans = ans - N * power_inv[1] + 1 - power_inv[N]

ans %= MOD



print(ans)

import sys

readline = sys.stdin.readline



N = int(readline())

graph = [[] for _ in range(N + 1)]

for i in range(N - 1):

    a, b = list(map(int, readline().split()))

    graph[a].append(b)

    graph[b].append(a)



parent = [0] * (N + 1)

order = []

stack = [1]

while stack:

    x = stack.pop()

    order.append(x)

    for y in graph[x]:

        if y == parent[x]:

            continue

        parent[y] = x

        stack.append(y)



MOD = 10**9 + 7

half = pow(2, MOD - 2, MOD)

power_inv = [1] * (N + 1)

size = [1] * (N + 1)

for i, v in enumerate(order[::-1], 1):

    p = parent[v]

    x = size[v]

    size[p] += x

    power_inv[i] = power_inv[i - 1] * half % MOD



ans = sum((1 - power_inv[i] - power_inv[N - i] + power_inv[N]) % MOD for i in size[2:])

ans -= N * power_inv[1] + power_inv[N] - 1

ans %= MOD



print(ans)
import sys

readline = sys.stdin.buffer.readline
N = int(readline())
graph = [[] for _ in range(N + 1)]
for i in range(N - 1):
    a, b = list(map(int, readline().split()))
    lb = 1 << i
    graph[a].append(b)
    graph[b].append(a)
root = 1
parent = [0] * (N + 1)
order = []
stack = [root]
while stack:
    x = stack.pop()
    order.append(x)
    for y in graph[x]:
        if y == parent[x]:
            continue
        parent[y] = x
        stack.append(y)
MOD = 10**9 + 7
x = (MOD + 1) // 2
power_inv = [1] * (N + 100)
for i in range(1, N + 100):
    power_inv[i] = power_inv[i - 1] * x % MOD
size = [1] * (N + 1)
p_size = [N - 1] * (N + 1)
prod = [1] * (N + 1)
coef = [1] * (N + 1)
for v in order[::-1]:
    p = parent[v]
    x = size[v]
    size[p] += x
ans = 0
for i in size[2:]:
    ans += 1 - power_inv[i] - power_inv[N - i] + power_inv[N]
    ans %= MOD
ans = ans - N * power_inv[1] + 1 - power_inv[N]
ans %= MOD
print(ans)

import sys

readline = sys.stdin.readline
N = int(readline())
graph = [[] for _ in range(N + 1)]
for i in range(N - 1):
    a, b = list(map(int, readline().split()))
    graph[a].append(b)
    graph[b].append(a)
parent = [0] * (N + 1)
order = []
stack = [1]
while stack:
    x = stack.pop()
    order.append(x)
    for y in graph[x]:
        if y == parent[x]:
            continue
        parent[y] = x
        stack.append(y)
MOD = 10**9 + 7
half = pow(2, MOD - 2, MOD)
power_inv = [1] * (N + 1)
size = [1] * (N + 1)
for i, v in enumerate(order[::-1], 1):
    p = parent[v]
    x = size[v]
    size[p] += x
    power_inv[i] = power_inv[i - 1] * half % MOD
ans = sum((1 - power_inv[i] - power_inv[N - i] + power_inv[N]) % MOD for i in size[2:])
ans -= N * power_inv[1] + power_inv[N] - 1
ans %= MOD
print(ans)

-readline = sys.stdin.buffer.readline +readline = sys.stdin.readline -    lb = 1 << i -root = 1 -stack = [root] +stack = [1] -x = (MOD + 1) // 2 -power_inv = [1] * (N + 100) -for i in range(1, N + 100): -    power_inv[i] = power_inv[i - 1] * x % MOD +half = pow(2, MOD - 2, MOD) +power_inv = [1] * (N + 1) -p_size = [N - 1] * (N + 1) -prod = [1] * (N + 1) -coef = [1] * (N + 1) -for v in order[::-1]: +for i, v in enumerate(order[::-1], 1): -ans = 0 -for i in size[2:]: -    ans += 1 - power_inv[i] - power_inv[N - i] + power_inv[N] -    ans %= MOD -ans = ans - N * power_inv[1] + 1 - power_inv[N] +    power_inv[i] = power_inv[i - 1] * half % MOD +ans = sum((1 - power_inv[i] - power_inv[N - i] + power_inv[N]) % MOD for i in size[2:]) +ans -= N * power_inv[1] + power_inv[N] - 1