func_code_string: #include <bits/stdc++.h>   using namespace std;   const long long MOD = 1000000007LL;   long long N;   vector<long long> E[100000];   long long dp[100000][2];   long long ans = 0;   long long mod_inv(long long n) {     long long t = MOD - 2, p = 1, q = n;     while (t > 0) {       if (t % 2 == 1) p = (p * q) % MOD;       q = (q * q) % MOD;       t /= 2;     }     return p % MOD;   }   void dfs(long long v, long long p) {     bool leaf = true;     for (long long u : E[v])       if (u != p) {         dfs(u, v);         leaf = false;       }     if (leaf) {       dp[v][0] = 1;       dp[v][1] = 1;     } else {       long long ev = 1, od = 1;       for (long long u : E[v])         if (u != p) {           (ev *= dp[u][0]) %= MOD;           (od *= dp[u][1]) %= MOD;         }       dp[v][0] = (ev + od) % MOD;       dp[v][1] = (od + ev) % MOD;     }   }   void dfs2(long long v, long long p, long long ev, long long od) {     long long _ev = 1, _od = 1;     for (long long u : E[v])       if (u != p) {         (_ev *= dp[u][0]) %= MOD;         (_od *= dp[u][1]) %= MOD;       }     if (p != -1) {       long long d = _ev * ev % MOD + _od * od % MOD;       ans += d;       ans %= MOD;     } else {       ans += dp[v][0];       ans %= MOD;     }     long long cnt = 0;     for (long long u : E[v])       if (u != p) {         cnt++;       }     for (long long u : E[v])       if (u != p) {         long long nev, nod, s;         if (cnt == 1) {           s = ev + od;           nev = s;           nod = s;         } else if (p == -1) {           s = _ev * mod_inv(dp[u][0]) % MOD + _od * mod_inv(dp[u][1]) % MOD;           nev = s;           nod = s;         } else {           s = _ev * mod_inv(dp[u][0]) % MOD * ev % MOD +               _od * mod_inv(dp[u][1]) % MOD * od % MOD;           nev = s;           nod = s;         }         nev %= MOD;         nod %= MOD;         dfs2(u, v, nev, nod);       }   }   int main(void) {     cin >> N;     for (long long i = ((long long)0); i < ((long long)N - 1); i++) {       long long A, B;       cin >> A >> B;       A--;       B--;       E[A].push_back(B);       E[B].push_back(A);     }     dfs(0, -1);     dfs2(0, -1, 1, 0);     cout << ans << endl;   }   