题目描述
Problem Description
Given an undirected tree, find the number of distinct independent sets.
Input Format
The first line contains an integer \( n \), the number of nodes in the tree (\( n \leq 5 \times 10^5 \)).
The next \( n-1 \) lines each contain two integers \( u \) and \( v \), indicating an edge between nodes \( u \) and \( v \).
Output Format
Output a single integer, the number of distinct independent sets modulo \( 10^9 + 7 \).
Sample Input and Output
Sample Input #1
1
Sample Output #1
2
Sample Input #2
5
1 2
1 3
1 4
1 5
Sample Output #2
6
Sample Input #3
6
1 2
1 3
1 4
4 5
4 6
Sample Output #3
9
输入格式
见题面 Input 部分
输出格式
见题面 Output 部分
样例输入
1
样例输出
2