#P2796. Facer的程序

Facer的程序

Description

Facer is a cute coder. He wrote NN programs. The programs are cleverly related: any two programs are connected by exactly one chain.

Specifically, for programs a,ba, b, there exists and only exists one sequence a,x1,x2,,xn,ba,x_1,x_2,\dots ,x_n,b such that a,x1a,x_1 are directly connected, x1,x2x_1,x_2 are directly connected, and so on, xn,bx_n,b are directly connected. A set of programs that satisfies this is called a program block.

Now, given the connections within one program block, determine how many sub-blocks it has. That is, choose a subset SS of programs such that SS also satisfies the condition above.

Input Format

The first line contains a positive integer NN.

The next N1N-1 lines each contain two integers, representing two programs that are directly connected.

Output Format

Output the number of sub-blocks, modulo 109+710^9+7.

3
1 2
2 3
6

Hint

Sample Explanation:

The subsets {1},{2},{3},{1,2},{2,3},{1,2,3}\{1\},\{2\},\{3\},\{1,2\},\{2,3\},\{1,2,3\} satisfy the condition above.

Constraints

For 10%10\% of the testdata, 1N201\le N\le20.

For 40%40\% of the testdata, 1N5001\le N\le 500.

For 100%100\% of the testdata, 1N1051\le N\le10^5.

Translated by ChatGPT 5