import sys

input = sys.stdin.readline

sys.setrecursionlimit(10**7)



mod = 10**9+7



N = int(eval(input()))

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

for _ in range(N-1):

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

    graph[a-1].append(b-1)

    graph[b-1].append(a-1)



#互いに素なa,bについて、a*x+b*y=1の一つの解

def extgcd(a,b):

    r = [1,0,a]

    w = [0,1,b]

    while w[2]!=1:

        q = r[2]//w[2]

        r2 = w

        w2 = [r[0]-q*w[0],r[1]-q*w[1],r[2]-q*w[2]]

        r = r2

        w = w2

    #[x,y]

    return [w[0],w[1]]



# aの逆元(mod m)を求める。(aとmは互いに素であることが前提)

def mod_inv(a,m=mod):

    x = extgcd(a,m)[0]

    return (m+x%m)%m





N2 = [1]

n = 1

for _ in range(N+1):

    n = n*2 % mod

    N2.append(n)



Weight = [[] for _ in range(N)]

checked = [False]*N



def dfs(p):

    checked[p] = True

    downs = 0

    for np in graph[p]:

        if not checked[np]:

            downscore = dfs(np)

            Weight[p].append(N-downscore)

            Weight[np].append(downscore)

            downs += N-downscore

    

    return N-(downs+1)



dfs(0)



a = 0

for n in range(N):

    if len(Weight[n]) == 1:

        continue

    c = N2[N-1] - 1

    for w in Weight[n]:

        c = (c - N2[w] + 1) % mod

    a = (a + c) % mod



ans = (a * mod_inv(N2[N])) % mod

print(ans)
import sys

input = sys.stdin.readline



mod = 10**9+7



def dfs(graph, N):

    ans = 0

    Par = [-1]*N

    Childs = [[] for _ in range(N)]

    stack = [0]

    while stack:

        p = stack.pop()

        if p >= 0:

            stack.append(~p)

            for np in graph[p]:

                if np != 0 and Par[np] == -1:

                    stack.append(np)

                    Par[np] = p

        else:

            p = ~p

            score = pow(2, N-1, mod) - 1

            upper = N-1

            for a in Childs[p]:

                upper -= a

                score = (score - pow(2, a, mod) + 1) % mod

            if p != 0:

                score = (score - pow(2, upper, mod) + 1) % mod

            ans = (ans + score) % mod

            Childs[Par[p]].append(N-1-upper+1)

    

    return ans * pow(2, N*(mod-2), mod) % mod



def main():

    N = int(eval(input()))

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

    for _ in range(N-1):

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

        graph[a-1].append(b-1)

        graph[b-1].append(a-1)

    print((dfs(graph, N)))





if __name__ == "__main__":

    main()
import sys

input = sys.stdin.readline
sys.setrecursionlimit(10**7)
mod = 10**9 + 7
N = int(eval(input()))
graph = [[] for _ in range(N)]
for _ in range(N - 1):
    a, b = list(map(int, input().split()))
    graph[a - 1].append(b - 1)
    graph[b - 1].append(a - 1)
# 互いに素なa,bについて、a*x+b*y=1の一つの解
def extgcd(a, b):
    r = [1, 0, a]
    w = [0, 1, b]
    while w[2] != 1:
        q = r[2] // w[2]
        r2 = w
        w2 = [r[0] - q * w[0], r[1] - q * w[1], r[2] - q * w[2]]
        r = r2
        w = w2
    # [x,y]
    return [w[0], w[1]]


# aの逆元(mod m)を求める。(aとmは互いに素であることが前提)
def mod_inv(a, m=mod):
    x = extgcd(a, m)[0]
    return (m + x % m) % m


N2 = [1]
n = 1
for _ in range(N + 1):
    n = n * 2 % mod
    N2.append(n)
Weight = [[] for _ in range(N)]
checked = [False] * N


def dfs(p):
    checked[p] = True
    downs = 0
    for np in graph[p]:
        if not checked[np]:
            downscore = dfs(np)
            Weight[p].append(N - downscore)
            Weight[np].append(downscore)
            downs += N - downscore
    return N - (downs + 1)


dfs(0)
a = 0
for n in range(N):
    if len(Weight[n]) == 1:
        continue
    c = N2[N - 1] - 1
    for w in Weight[n]:
        c = (c - N2[w] + 1) % mod
    a = (a + c) % mod
ans = (a * mod_inv(N2[N])) % mod
print(ans)

import sys

input = sys.stdin.readline
mod = 10**9 + 7


def dfs(graph, N):
    ans = 0
    Par = [-1] * N
    Childs = [[] for _ in range(N)]
    stack = [0]
    while stack:
        p = stack.pop()
        if p >= 0:
            stack.append(~p)
            for np in graph[p]:
                if np != 0 and Par[np] == -1:
                    stack.append(np)
                    Par[np] = p
        else:
            p = ~p
            score = pow(2, N - 1, mod) - 1
            upper = N - 1
            for a in Childs[p]:
                upper -= a
                score = (score - pow(2, a, mod) + 1) % mod
            if p != 0:
                score = (score - pow(2, upper, mod) + 1) % mod
            ans = (ans + score) % mod
            Childs[Par[p]].append(N - 1 - upper + 1)
    return ans * pow(2, N * (mod - 2), mod) % mod


def main():
    N = int(eval(input()))
    graph = [[] for _ in range(N)]
    for _ in range(N - 1):
        a, b = list(map(int, input().split()))
        graph[a - 1].append(b - 1)
        graph[b - 1].append(a - 1)
    print((dfs(graph, N)))


if __name__ == "__main__":
    main()

-sys.setrecursionlimit(10**7) -N = int(eval(input())) -graph = [[] for _ in range(N)] -for _ in range(N - 1): -    a, b = list(map(int, input().split())) -    graph[a - 1].append(b - 1) -    graph[b - 1].append(a - 1) -# 互いに素なa,bについて、a*x+b*y=1の一つの解 -def extgcd(a, b): -    r = [1, 0, a] -    w = [0, 1, b] -    while w[2] != 1: -        q = r[2] // w[2] -        r2 = w -        w2 = [r[0] - q * w[0], r[1] - q * w[1], r[2] - q * w[2]] -        r = r2 -        w = w2 -    # [x,y] -    return [w[0], w[1]] -# aの逆元(mod m)を求める。(aとmは互いに素であることが前提) -def mod_inv(a, m=mod): -    x = extgcd(a, m)[0] -    return (m + x % m) % m +def dfs(graph, N): +    ans = 0 +    Par = [-1] * N +    Childs = [[] for _ in range(N)] +    stack = [0] +    while stack: +        p = stack.pop() +        if p >= 0: +            stack.append(~p) +            for np in graph[p]: +                if np != 0 and Par[np] == -1: +                    stack.append(np) +                    Par[np] = p +        else: +            p = ~p +            score = pow(2, N - 1, mod) - 1 +            upper = N - 1 +            for a in Childs[p]: +                upper -= a +                score = (score - pow(2, a, mod) + 1) % mod +            if p != 0: +                score = (score - pow(2, upper, mod) + 1) % mod +            ans = (ans + score) % mod +            Childs[Par[p]].append(N - 1 - upper + 1) +    return ans * pow(2, N * (mod - 2), mod) % mod -N2 = [1] -n = 1 -for _ in range(N + 1): -    n = n * 2 % mod -    N2.append(n) -Weight = [[] for _ in range(N)] -checked = [False] * N +def main(): +    N = int(eval(input())) +    graph = [[] for _ in range(N)] +    for _ in range(N - 1): +        a, b = list(map(int, input().split())) +        graph[a - 1].append(b - 1) +        graph[b - 1].append(a - 1) +    print((dfs(graph, N))) -def dfs(p): -    checked[p] = True -    downs = 0 -    for np in graph[p]: -        if not checked[np]: -            downscore = dfs(np) -            Weight[p].append(N - downscore) -            Weight[np].append(downscore) -            downs += N - downscore -    return N - (downs + 1) - - -dfs(0) -a = 0 -for n in range(N): -    if len(Weight[n]) == 1: -        continue -    c = N2[N - 1] - 1 -    for w in Weight[n]: -        c = (c - N2[w] + 1) % mod -    a = (a + c) % mod -ans = (a * mod_inv(N2[N])) % mod -print(ans) +if __name__ == "__main__": +    main()