atcoder#ABC149F. [ABC149F] Surrounded Nodes

[ABC149F] Surrounded Nodes

Score : 600600 points

Problem Statement

Given is a tree TT with NN vertices. The ii-th edge connects Vertex AiA_i and BiB_i (1Ai,BiN1 \leq A_i,B_i \leq N).

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

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

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

Notes

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

Then, you need to print the only integer zz between 00 and 109+610^9 + 6, inclusive, that satisfies xzy(mod109+7)xz \equiv y \pmod{10^9 + 7}.

Constraints

  • 2N2×1052 \leq N \leq 2 \times 10^5
  • 1Ai,BiN1 \leq A_i,B_i \leq N
  • The given graph is a tree.

Input

Input is given from Standard Input in the following format:

NN

A1A_1 B1B_1

::

AN1A_{N-1} BN1B_{N-1}

Output

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

3
1 2
2 3
125000001

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

Otherwise, the holeyness is 00, so the expected holeyness is 1/81/8.

Since 8×1250000011(mod109+7)8 \times 125000001 \equiv 1 \pmod{10^9+7}, we should print 125000001125000001.

4
1 2
2 3
3 4
375000003

The expected holeyness is 3/83/8.

Since 8×3750000033(mod109+7)8 \times 375000003 \equiv 3 \pmod{10^9+7}, we should print 375000003375000003.

4
1 2
1 3
1 4
250000002

The expected holeyness is 1/41/4.

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