import java.util.*; public class Main { static int N; static ArrayList> edge; static long[] dp; static long[] cnt; static int mod = 1_000_000_007; public static void solve(int i) { if (dp[i] != -1) return; long val = 0; long val_cnt = 1; for (Integer tmp : edge.get(i)) { solve(tmp); val = (val+dp[tmp]+cnt[tmp])%mod; val_cnt += cnt[tmp]; } dp[i] = val; cnt[i] = val_cnt; } public static void main(String[] args) { Scanner sc = new Scanner(System.in); N = sc.nextInt(); edge = new ArrayList>(); for (int i=0;i add = new ArrayList(); edge.add(add); } boolean[] not_root = new boolean[N]; for (int i=0;i