func_code_string: #include <bits/stdc++.h>   using namespace std;   const long long oo = 1e16;   template <class P>   P gcd(P a, P b) {     return b ? gcd(b, a % b) : a;   };   long long read() {     char c = getchar();     long long d = 0, f = 1;     for (; c <  0  || c >  9 ; c = getchar())       if (c ==  - ) f = -1;     for (; c >=  0  && c <=  9 ; d = d * 10 + c - 48, c = getchar())       ;     return d * f;   }   const int N = 100001;   const int M = 400001;   const int mod = 1e9 + 7;   int n, m, cnt, cyc_amount, head[N];   long long cyc_tot, ans, qz[N], _m2[201], record[62], f[62][2];   bool exist[N];   struct xint {     int to, next;     long long s;   } e[M];   inline void addedge(int x, int y, long long s) {     e[++cnt].to = y;     e[cnt].next = head[x];     e[cnt].s = s;     head[x] = cnt;   }   inline void dfs(int fa, int x, long long s) {     exist[x] = 1;     for (int i = 0; i <= 61; i++) f[i][s >> i & 1]++;     qz[x] = s;     for (int i = head[x]; i; i = e[i].next) {       int y = e[i].to;       if (y == fa) continue;       if (!exist[y])         dfs(x, y, s ^ e[i].s);       else {         long long t = qz[x] ^ qz[y] ^ e[i].s;         cyc_tot |= t;         for (int i = 61; i >= 0; i--) {           if ((t & (1LL << i)) && !record[i]) {             record[i] = t;             cyc_amount++;             break;           }           t = min(t, t ^ record[i]);         }       }     }   }   int main() {     n = read(), m = read();     for (int i = 1; i <= n; i++) exist[i] = 1;     for (int i = 1; i <= m; i++) {       int x = read(), y = read();       long long s = read();       exist[x] = exist[y] = 0;       addedge(x, y, s);       addedge(y, x, s);     }     _m2[0] = 1;     for (int i = 1; i <= 200; i++) _m2[i] = _m2[i - 1] * 2 % mod;     for (int i = 1; i <= n; i++)       if (!exist[i]) {         cyc_amount = cyc_tot = 0;         for (int j = 0; j <= 61; j++) f[j][0] = f[j][1] = record[j] = 0;         memset(qz, 0, sizeof qz);         dfs(0, i, 0);         for (int j = 0; j <= 61; j++)           if (cyc_tot & (1LL << j))             ans = (ans + (f[j][0] + f[j][1]) * (f[j][0] + f[j][1] - 1) / 2 % mod *                              _m2[j + cyc_amount - 1] % mod) %                   mod;           else             ans =                 (ans + f[j][0] * f[j][1] % mod * _m2[j + cyc_amount] % mod) % mod;       }     cout << ans << endl;   }   