import sys

sys.setrecursionlimit(505050)

input = sys.stdin.buffer.readline

N = int(eval(input()))

AB = [list(map(int, input().split())) for _ in range(N-1)]

mod = 10**9+7

half = mod // 2 + 1

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

for a, b in AB:

    G[a].append(b)

    G[b].append(a)

P = [0] * (N+1)

Size = [0] * (N+1)

def dfs(v):

    siz = 1

    p = P[v]

    for u in G[v]:

        if u != p:

            P[u] = v

            dfs(u)

            siz += Size[u]

    Size[v] = siz

dfs(1)

ans = 0

Prob = [0]

h = 1

for i in range(202020):

    h = h * half % mod

    Prob.append(1-h)

for v, (siz_v, Gv) in enumerate(zip(Size[1:], G[1:]), 1):

    if v == 1:

        ps = []

    else:

        ps = [Prob[N-siz_v]]

    par = P[v]

    for u in Gv:

        if par != u:

            siz_u = Size[u]

            ps.append(Prob[siz_u])

    if len(ps)<=1:

        continue

    cumprod1_ps = [1, 1]

    cumprod2_ps = [1, 1]

    cp = 1

    for p in ps:

        cp = cp * (1-p) % mod

        cumprod1_ps.append(cp)

    cp = 1

    for p in ps[::-1]:

        cp = cp * (1-p) % mod

        cumprod2_ps.append(cp)

    cumprod2_ps.reverse()

    an = 1 - cumprod1_ps[-1]

    for cp1, cp2, p in zip(cumprod1_ps[1:-1], cumprod2_ps[1:-1], ps):

        an -= cp1 * cp2 % mod * p

    ans += an

ans = ans % mod * half % mod

print(ans)

import os

import sys

import numpy as np



def solve(N, AB):

    mod = 10**9+7

    half = mod // 2 + 1

    G = [[0]*0 for _ in range(N+1)]

    for i in range(len(AB)):

        a, b = AB[i]

        G[a].append(b)

        G[b].append(a)

    P = [0] * (N+1)

    Size = [0] * (N+1)

    def dfs(v):

        # siz = 1

        # p = P[v]

        # for u in G[v]:

        #     if u != p:

        #         P[u] = v

        #         dfs(u)

        #         siz += Size[u]

        # Size[v] = siz

        st = [(v, 0)]

        while st:

            v, state = st.pop()

            p = P[v]

            if state == 0:

                st.append((v, 1))

                Size[v] = 1

                for u in G[v]:

                    if u != p:

                        P[u] = v

                        st.append((u, 0))

            else:

                Size[p] += Size[v]

    dfs(1)

    ans = 0

    Prob = [0]

    h = 1

    for i in range(202020):

        h = h * half % mod

        Prob.append(1-h)

    for v in range(1, len(G)):

        siz_v = Size[v]

        Gv = G[v]

        if v == 1:

            ps = [0]*0

        else:

            ps = [Prob[N-siz_v]]

        par = P[v]

        for u in Gv:

            if par != u:

                siz_u = Size[u]

                ps.append(Prob[siz_u])

        if len(ps)<=1:

            continue

        cumprod1_ps = [1, 1]

        cumprod2_ps = [1, 1]

        cp = 1

        for p in ps:

            cp = cp * (1-p) % mod

            cumprod1_ps.append(cp)

        cp = 1

        for p in ps[::-1]:

            cp = cp * (1-p) % mod

            cumprod2_ps.append(cp)

        cumprod2_ps.reverse()

        an = 1 - cumprod1_ps[-1]

        for j in range(1, len(cumprod1_ps)-1):

            cp1 = cumprod1_ps[j]

            cp2 = cumprod2_ps[j]

            p = ps[j-1]

            an -= cp1 * cp2 % mod * p

        ans += an

    ans = ans % mod * half % mod

    return ans





def main():

    sys.setrecursionlimit(505050)

    input = sys.stdin.buffer.readline

    N = int(eval(input()))

    AB = np.array(sys.stdin.buffer.read().split(), dtype=np.int64).reshape(N - 1, 2)

    ans = solve(N, AB)

    print(ans)



main()

import sys

sys.setrecursionlimit(505050)
input = sys.stdin.buffer.readline
N = int(eval(input()))
AB = [list(map(int, input().split())) for _ in range(N - 1)]
mod = 10**9 + 7
half = mod // 2 + 1
G = [[] for _ in range(N + 1)]
for a, b in AB:
    G[a].append(b)
    G[b].append(a)
P = [0] * (N + 1)
Size = [0] * (N + 1)


def dfs(v):
    siz = 1
    p = P[v]
    for u in G[v]:
        if u != p:
            P[u] = v
            dfs(u)
            siz += Size[u]
    Size[v] = siz


dfs(1)
ans = 0
Prob = [0]
h = 1
for i in range(202020):
    h = h * half % mod
    Prob.append(1 - h)
for v, (siz_v, Gv) in enumerate(zip(Size[1:], G[1:]), 1):
    if v == 1:
        ps = []
    else:
        ps = [Prob[N - siz_v]]
    par = P[v]
    for u in Gv:
        if par != u:
            siz_u = Size[u]
            ps.append(Prob[siz_u])
    if len(ps) <= 1:
        continue
    cumprod1_ps = [1, 1]
    cumprod2_ps = [1, 1]
    cp = 1
    for p in ps:
        cp = cp * (1 - p) % mod
        cumprod1_ps.append(cp)
    cp = 1
    for p in ps[::-1]:
        cp = cp * (1 - p) % mod
        cumprod2_ps.append(cp)
    cumprod2_ps.reverse()
    an = 1 - cumprod1_ps[-1]
    for cp1, cp2, p in zip(cumprod1_ps[1:-1], cumprod2_ps[1:-1], ps):
        an -= cp1 * cp2 % mod * p
    ans += an
ans = ans % mod * half % mod
print(ans)

import os
import sys
import numpy as np


def solve(N, AB):
    mod = 10**9 + 7
    half = mod // 2 + 1
    G = [[0] * 0 for _ in range(N + 1)]
    for i in range(len(AB)):
        a, b = AB[i]
        G[a].append(b)
        G[b].append(a)
    P = [0] * (N + 1)
    Size = [0] * (N + 1)

    def dfs(v):
        # siz = 1
        # p = P[v]
        # for u in G[v]:
        #     if u != p:
        #         P[u] = v
        #         dfs(u)
        #         siz += Size[u]
        # Size[v] = siz
        st = [(v, 0)]
        while st:
            v, state = st.pop()
            p = P[v]
            if state == 0:
                st.append((v, 1))
                Size[v] = 1
                for u in G[v]:
                    if u != p:
                        P[u] = v
                        st.append((u, 0))
            else:
                Size[p] += Size[v]

    dfs(1)
    ans = 0
    Prob = [0]
    h = 1
    for i in range(202020):
        h = h * half % mod
        Prob.append(1 - h)
    for v in range(1, len(G)):
        siz_v = Size[v]
        Gv = G[v]
        if v == 1:
            ps = [0] * 0
        else:
            ps = [Prob[N - siz_v]]
        par = P[v]
        for u in Gv:
            if par != u:
                siz_u = Size[u]
                ps.append(Prob[siz_u])
        if len(ps) <= 1:
            continue
        cumprod1_ps = [1, 1]
        cumprod2_ps = [1, 1]
        cp = 1
        for p in ps:
            cp = cp * (1 - p) % mod
            cumprod1_ps.append(cp)
        cp = 1
        for p in ps[::-1]:
            cp = cp * (1 - p) % mod
            cumprod2_ps.append(cp)
        cumprod2_ps.reverse()
        an = 1 - cumprod1_ps[-1]
        for j in range(1, len(cumprod1_ps) - 1):
            cp1 = cumprod1_ps[j]
            cp2 = cumprod2_ps[j]
            p = ps[j - 1]
            an -= cp1 * cp2 % mod * p
        ans += an
    ans = ans % mod * half % mod
    return ans


def main():
    sys.setrecursionlimit(505050)
    input = sys.stdin.buffer.readline
    N = int(eval(input()))
    AB = np.array(sys.stdin.buffer.read().split(), dtype=np.int64).reshape(N - 1, 2)
    ans = solve(N, AB)
    print(ans)


main()

+import os - -sys.setrecursionlimit(505050) -input = sys.stdin.buffer.readline -N = int(eval(input())) -AB = [list(map(int, input().split())) for _ in range(N - 1)] -mod = 10**9 + 7 -half = mod // 2 + 1 -G = [[] for _ in range(N + 1)] -for a, b in AB: -    G[a].append(b) -    G[b].append(a) -P = [0] * (N + 1) -Size = [0] * (N + 1) +import numpy as np -def dfs(v): -    siz = 1 -    p = P[v] -    for u in G[v]: -        if u != p: -            P[u] = v -            dfs(u) -            siz += Size[u] -    Size[v] = siz +def solve(N, AB): +    mod = 10**9 + 7 +    half = mod // 2 + 1 +    G = [[0] * 0 for _ in range(N + 1)] +    for i in range(len(AB)): +        a, b = AB[i] +        G[a].append(b) +        G[b].append(a) +    P = [0] * (N + 1) +    Size = [0] * (N + 1) + +    def dfs(v): +        # siz = 1 +        # p = P[v] +        # for u in G[v]: +        #     if u != p: +        #         P[u] = v +        #         dfs(u) +        #         siz += Size[u] +        # Size[v] = siz +        st = [(v, 0)] +        while st: +            v, state = st.pop() +            p = P[v] +            if state == 0: +                st.append((v, 1)) +                Size[v] = 1 +                for u in G[v]: +                    if u != p: +                        P[u] = v +                        st.append((u, 0)) +            else: +                Size[p] += Size[v] + +    dfs(1) +    ans = 0 +    Prob = [0] +    h = 1 +    for i in range(202020): +        h = h * half % mod +        Prob.append(1 - h) +    for v in range(1, len(G)): +        siz_v = Size[v] +        Gv = G[v] +        if v == 1: +            ps = [0] * 0 +        else: +            ps = [Prob[N - siz_v]] +        par = P[v] +        for u in Gv: +            if par != u: +                siz_u = Size[u] +                ps.append(Prob[siz_u]) +        if len(ps) <= 1: +            continue +        cumprod1_ps = [1, 1] +        cumprod2_ps = [1, 1] +        cp = 1 +        for p in ps: +            cp = cp * (1 - p) % mod +            cumprod1_ps.append(cp) +        cp = 1 +        for p in ps[::-1]: +            cp = cp * (1 - p) % mod +            cumprod2_ps.append(cp) +        cumprod2_ps.reverse() +        an = 1 - cumprod1_ps[-1] +        for j in range(1, len(cumprod1_ps) - 1): +            cp1 = cumprod1_ps[j] +            cp2 = cumprod2_ps[j] +            p = ps[j - 1] +            an -= cp1 * cp2 % mod * p +        ans += an +    ans = ans % mod * half % mod +    return ans -dfs(1) -ans = 0 -Prob = [0] -h = 1 -for i in range(202020): -    h = h * half % mod -    Prob.append(1 - h) -for v, (siz_v, Gv) in enumerate(zip(Size[1:], G[1:]), 1): -    if v == 1: -        ps = [] -    else: -        ps = [Prob[N - siz_v]] -    par = P[v] -    for u in Gv: -        if par != u: -            siz_u = Size[u] -            ps.append(Prob[siz_u]) -    if len(ps) <= 1: -        continue -    cumprod1_ps = [1, 1] -    cumprod2_ps = [1, 1] -    cp = 1 -    for p in ps: -        cp = cp * (1 - p) % mod -        cumprod1_ps.append(cp) -    cp = 1 -    for p in ps[::-1]: -        cp = cp * (1 - p) % mod -        cumprod2_ps.append(cp) -    cumprod2_ps.reverse() -    an = 1 - cumprod1_ps[-1] -    for cp1, cp2, p in zip(cumprod1_ps[1:-1], cumprod2_ps[1:-1], ps): -        an -= cp1 * cp2 % mod * p -    ans += an -ans = ans % mod * half % mod -print(ans) +def main(): +    sys.setrecursionlimit(505050) +    input = sys.stdin.buffer.readline +    N = int(eval(input())) +    AB = np.array(sys.stdin.buffer.read().split(), dtype=np.int64).reshape(N - 1, 2) +    ans = solve(N, AB) +    print(ans) + + +main()