#include <bits/stdc++.h>
using namespace std;
const long long int mod = 1e9 + 7;
long long int pws[500009], numvals, a[500009], ans = 0;
vector<pair<long long int, int> > lol;
vector<pair<int, int> > edges;
vector<int> temp;
int par[500009], sz[500009], n, tots;
int find(int node) {
  if (par[node] != node) {
    return par[node] = find(par[node]);
  }
  return node;
}
void merge(int x, int y) {
  x = find(x);
  y = find(y);
  if (x == y) {
    return;
  }
  if (sz[x] < sz[y]) {
    sz[y] += sz[x];
    par[x] = y;
  } else {
    sz[x] += sz[y];
    par[y] = x;
  }
  tots--;
  return;
}
void solve() {
  int i, j, t1, t2, t3, t4;
  long long int buf1, buf2, buf3, buf4;
  buf1 = pws[tots];
  ans = (ans + buf1) % mod;
  for (auto it : temp) {
    par[edges[it].first] = edges[it].first;
    par[edges[it].second] = edges[it].second;
    sz[edges[it].first] = sz[edges[it].second] = 1;
  }
  temp.clear();
  tots = n;
  numvals--;
  return;
}
int main() {
  int i, j, t1, t2, t3, t4, m, k;
  long long int buf1, buf2, buf3, buf4;
  scanf("%d %d %d", &n, &m, &k);
  for (i = 1; i <= n; i++) {
    scanf("%lld", &a[i]);
  }
  for (i = 0; i < m; i++) {
    scanf("%d %d", &t1, &t2);
    edges.push_back(make_pair(t1, t2));
    lol.push_back(make_pair(a[t1] ^ a[t2], i));
  }
  pws[0] = 1;
  for (i = 1; i <= 500003; i++) {
    pws[i] = (pws[i - 1] * 2) % mod;
  }
  for (i = 1; i <= n; i++) {
    par[i] = i;
    sz[i] = 1;
  }
  tots = n;
  numvals = pws[k];
  sort(lol.begin(), lol.end());
  for (i = 0; i < (int)lol.size(); i++) {
    if (i > 0 && lol[i].first != lol[i - 1].first) {
      solve();
    }
    t1 = lol[i].second;
    temp.push_back(t1);
    t2 = find(edges[t1].first);
    t3 = find(edges[t1].second);
    merge(t2, t3);
  }
  if (!temp.empty()) {
    solve();
  }
  buf1 = (numvals * pws[n]) % mod;
  ans = (ans + buf1) % mod;
  printf("%lld\n", ans);
  return 0;
}
