#include <bits/stdc++.h>
using namespace std;
const int N = 5e5 + 6;
const int mod = 1e9 + 7;
int n, m, k, p2[N], id, fa[N];
long long key[N];
unordered_map<long long, int> ump;
vector<pair<int, int> > vlist[N];
int getfa(int a) {
  if (fa[a] != a) fa[a] = getfa(fa[a]);
  return fa[a];
}
int main(void) {
  cin >> n >> m >> k;
  p2[0] = 1;
  id = 0;
  for (int i = 1; i <= n; ++i) {
    scanf("%I64d", &key[i]);
    fa[i] = i;
  }
  for (int i = 1; i < N; ++i) {
    p2[i] = p2[i - 1] * 2 % mod;
  }
  int u, v;
  for (int i = 0; i < m; ++i) {
    scanf("%d%d", &u, &v);
    long long val = key[u] ^ key[v];
    if (!ump.count(val)) {
      ump[val] = id++;
    }
    vlist[ump[val]].push_back({u, v});
  }
  long long rt = 0;
  for (int i = 0; i < id; ++i) {
    int cal = n;
    for (auto it : vlist[i]) {
      int fx = getfa(it.first), fy = getfa(it.second);
      if (fx != fy) {
        cal--;
        fa[fy] = fx;
      }
    }
    rt = (rt + p2[cal]) % mod;
    for (auto it : vlist[i]) {
      fa[it.first] = it.first;
      fa[it.second] = it.second;
    }
  }
  rt = (rt + 1LL * p2[n] * (p2[k] - id + mod) % mod) % mod;
  cout << rt << endl;
}
