import sys

sys.setrecursionlimit(1000000)

readline = sys.stdin.readline



N = int(readline())



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

for i in range(N - 1):

    A, B = list(map(int, readline().split()))

    A -= 1

    B -= 1

    adj[A].append(B)

    adj[B].append(A)



mod = 10 ** 9 + 7

pow2 = [1] * (N + 1)

for i, j in zip(list(range(N)), list(range(1, N + 1))):

    pow2[j] = pow2[i] * 2 % mod



ans = 0





def dfs(node, parent):

    global ans

    cnt = 1

    

    for child in adj[node]:

        if child != parent:

            cnt += dfs(child, node)

    

    ans += (pow2[cnt] - 1) * (pow2[N-cnt] - 1)

    ans %= mod

    

    return cnt



dfs(0, None)



ans = (ans - N * pow2[N-1] + pow2[N] - 1) % mod

ans = ans * pow(pow2[N], mod - 2, mod) % 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]  # vの子孫ノード数（自分も含む）をとる

    size[p] += x  # 親にノード数を加算

    power_inv[i] = power_inv[i - 1] * half % MOD  # [1, 1/2, 1/4, ...]



ans = sum((1 - power_inv[i] - power_inv[N - i] + power_inv[N]) % MOD for i in size[2:])  # 解法1の確率式(ノード1を除く)

ans += (1 - power_inv[N]) - N * power_inv[1]  # +  - N/2 

ans %= MOD



print(ans)
import sys

sys.setrecursionlimit(1000000)
readline = sys.stdin.readline
N = int(readline())
adj = [[] for i in range(N)]
for i in range(N - 1):
    A, B = list(map(int, readline().split()))
    A -= 1
    B -= 1
    adj[A].append(B)
    adj[B].append(A)
mod = 10**9 + 7
pow2 = [1] * (N + 1)
for i, j in zip(list(range(N)), list(range(1, N + 1))):
    pow2[j] = pow2[i] * 2 % mod
ans = 0


def dfs(node, parent):
    global ans
    cnt = 1
    for child in adj[node]:
        if child != parent:
            cnt += dfs(child, node)
    ans += (pow2[cnt] - 1) * (pow2[N - cnt] - 1)
    ans %= mod
    return cnt


dfs(0, None)
ans = (ans - N * pow2[N - 1] + pow2[N] - 1) % mod
ans = ans * pow(pow2[N], mod - 2, mod) % 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]  # vの子孫ノード数（自分も含む）をとる
    size[p] += x  # 親にノード数を加算
    power_inv[i] = power_inv[i - 1] * half % MOD  # [1, 1/2, 1/4, ...]
ans = sum(
    (1 - power_inv[i] - power_inv[N - i] + power_inv[N]) % MOD for i in size[2:]
)  # 解法1の確率式(ノード1を除く)
ans += (1 - power_inv[N]) - N * power_inv[1]  # +  - N/2
ans %= MOD
print(ans)

-sys.setrecursionlimit(1000000) -adj = [[] for i in range(N)] +graph = [[] for _ in range(N + 1)] -    A, B = list(map(int, readline().split())) -    A -= 1 -    B -= 1 -    adj[A].append(B) -    adj[B].append(A) -mod = 10**9 + 7 -pow2 = [1] * (N + 1) -for i, j in zip(list(range(N)), list(range(1, N + 1))): -    pow2[j] = pow2[i] * 2 % mod -ans = 0 - - -def dfs(node, parent): -    global ans -    cnt = 1 -    for child in adj[node]: -        if child != parent: -            cnt += dfs(child, node) -    ans += (pow2[cnt] - 1) * (pow2[N - cnt] - 1) -    ans %= mod -    return cnt - - -dfs(0, None) -ans = (ans - N * pow2[N - 1] + pow2[N] - 1) % mod -ans = ans * pow(pow2[N], mod - 2, mod) % mod +    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]  # vの子孫ノード数（自分も含む）をとる +    size[p] += x  # 親にノード数を加算 +    power_inv[i] = power_inv[i - 1] * half % MOD  # [1, 1/2, 1/4, ...] +ans = sum( +    (1 - power_inv[i] - power_inv[N - i] + power_inv[N]) % MOD for i in size[2:] +)  # 解法1の確率式(ノード1を除く) +ans += (1 - power_inv[N]) - N * power_inv[1]  # +  - N/2 +ans %= MOD