import sys readline = sys.stdin.readline sys.setrecursionlimit(10**6) from functools import lru_cache @lru_cache(maxsize=None) def f(n): dp, size = 0, 1 for u in G[n]: a, b = f(u) dp += a + b dp %= mod size += b return dp, size N = int(readline()) mod = 10 ** 9 + 7 G = [[] for i in range(N)] for i in range(N - 1): A, B = map(int, readline().split()) A, B = A - 1, B - 1 G[A].append(B) ans = 0 for i in range(N): a, b = f(i) ans += a ans %= mod print(ans)