#include <bits/stdc++.h>
using namespace std;
const long long M = 1e9 + 7;
const long long MAX = 500005;
vector<long long> g[MAX];
long long U[MAX], V[MAX], ed[MAX];
vector<long long> ned[MAX];
long long enc[MAX];
map<long long, long long> mp;
long long vis[MAX];
long long cov[MAX];
long long to[MAX];
long long cou = 0;
long long curen;
long long aco;
void pre() {
  to[0] = 1;
  for (long long i = 1; i < MAX; i++) {
    (to[i] = to[i - 1] * 2) %= M;
  }
}
void dfs(long long x) {
  long long a, b, c, i, j;
  vis[x] = cou;
  aco++;
  for (auto z : g[x]) {
    if (ed[z] != curen || cov[z] != 0) continue;
    if (x == U[z])
      a = V[z];
    else
      a = U[z];
    cov[z] = 1;
    if (vis[a] == cou) continue;
    dfs(a);
  }
  return;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cout << setprecision(25);
  long long n, m, k, a, b, c, d, e, f, i, j;
  pre();
  long long ans = 0;
  cin >> n >> m >> k;
  for (i = 1; i <= n; i++) cin >> enc[i];
  d = 0;
  for (i = 1; i <= m; i++) {
    cin >> U[i] >> V[i];
    g[U[i]].push_back(i);
    g[V[i]].push_back(i);
    ed[i] = enc[U[i]] ^ enc[V[i]];
    if (!mp.count(ed[i])) {
      mp[ed[i]] = ++d;
    }
    e = mp[ed[i]];
    ned[e].push_back(i);
  }
  ans = (to[n] * to[k]) % M;
  for (i = 1; i <= d; i++) {
    curen = ed[ned[i][0]];
    long long tpr = 0;
    long long tot = 0;
    for (auto z : ned[i]) {
      if (cov[z] == 0) {
        ++cou;
        aco = 0;
        dfs(U[z]);
        tpr++;
        tot += aco;
      }
    };
    a = n - tot;
    b = to[a];
    (b *= to[tpr]) %= M;
    c = (to[n] - b + M) % M;
    ans = (ans - c + M) % M;
  }
  cout << ans;
  return 0;
}
