func_code_string: #include <bits/stdc++.h>   using namespace std;   const int maxn = 1000005;   const int MD = 1000 * 1000 * 1000 + 7;   vector<int> g[maxn];   long long dp[maxn][2], mult[maxn][2], ans, cnt[maxn];   bool visited[maxn];   int binPow(int a, int b) {     if (!b) return 1;     if (b & 1) {       return (1LL * binPow(a, b - 1) * a) % MD;     } else {       int half = binPow(a, b / 2);       return (1LL * half * half) % MD;     }   }   long long inv(int a) { return binPow(a, MD - 2); }   void dfs(int v) {     cnt[v] = 1;     visited[v] = true;     mult[v][0] = mult[v][1] = 1;     for (int i = 0; i < g[v].size(); i++) {       int to = g[v][i];       if (visited[to]) continue;       dfs(to);       cnt[v] += cnt[to];       mult[v][0] *= dp[to][0];       mult[v][0] %= MD;       mult[v][1] *= dp[to][1];       mult[v][1] %= MD;     }     if (cnt[v] == 1) {       dp[v][0] = dp[v][1] = 1;     } else {       dp[v][0] = (mult[v][0] + mult[v][1]) % MD;       dp[v][1] = (mult[v][0] + mult[v][1]) % MD;     }   }   void set_root(int v, int to) {     cnt[v] -= cnt[to];     cnt[to] += cnt[v];     mult[v][0] *= inv(dp[to][0]);     mult[v][0] %= MD;     mult[v][1] *= inv(dp[to][1]);     mult[v][1] %= MD;     if (cnt[v] > 1) {       dp[v][0] = (mult[v][0] + mult[v][1]) % MD;       dp[v][1] = (mult[v][0] + mult[v][1]) % MD;     } else {       dp[v][0] = dp[v][1] = 1;     }     mult[to][0] *= dp[v][0];     mult[to][0] %= MD;     mult[to][1] *= dp[v][1];     mult[to][1] %= MD;     dp[to][0] = (mult[to][0] + mult[to][1]) % MD;     dp[to][1] = (mult[to][0] + mult[to][1]) % MD;   }   void calc(int v, int parent) {     ans += dp[v][0];     if (ans >= MD) ans -= MD;     for (auto to : g[v]) {       if (to == parent) continue;       set_root(v, to);       calc(to, v);       set_root(to, v);     }   }   int main() {     ios_base::sync_with_stdio(false);     int n;     cin >> n;     for (int i = 0; i < n - 1; i++) {       int u, v;       cin >> u >> v;       g[u].push_back(v);       g[v].push_back(u);     }     ans = 0;     memset(visited, false, sizeof(visited));     dfs(1);     calc(1, 0);     cout << ans << endl;     return 0;   }   