#include <bits/stdc++.h>
using namespace std;
const int nmax = 5e5;
const int mod = 1e9 + 7;
long long v[nmax + 1], p2[nmax + 1];
vector<int> g[nmax + 1];
int n, nodes;
bool viz[nmax + 1];
vector<pair<long long, pair<int, int>>> w;
void dfs(int nod) {
  viz[nod] = 1;
  ++nodes;
  for (auto i : g[nod]) {
    if (viz[i] == 0) dfs(i);
  }
}
long long solve(int x, int y) {
  for (int i = x; i <= y; ++i) {
    g[w[i].second.first].push_back(w[i].second.second);
    g[w[i].second.second].push_back(w[i].second.first);
  }
  int comp = 0;
  nodes = 0;
  for (int i = x; i <= y; ++i) {
    int a = w[i].second.first, b = w[i].second.second;
    if (viz[a] == 0) {
      ++comp;
      dfs(a);
    }
    if (viz[b] == 0) {
      ++comp;
      dfs(b);
    }
  }
  for (int i = x; i <= y; ++i) {
    int a = w[i].second.first, b = w[i].second.second;
    viz[a] = viz[b] = 0;
    g[a].clear();
    g[b].clear();
  }
  return p2[n - nodes + comp];
}
int main() {
  int m, k;
  fscanf(stdin, "%d%d%d", &n, &m, &k);
  for (int i = 1; i <= n; ++i) fscanf(stdin, "%I64d", &v[i]);
  for (int i = 1; i <= m; ++i) {
    int x, y;
    fscanf(stdin, "%d%d", &x, &y);
    w.push_back({v[x] ^ v[y], {x, y}});
  }
  sort(w.begin(), w.end());
  long long ans = 0, total = 1LL << k;
  p2[0] = 1;
  for (int i = 1; i <= n; ++i) {
    p2[i] = p2[i - 1] * 2 % mod;
  }
  for (int i = 0; i < (int)w.size();) {
    int j = i;
    while (j < (int)w.size() && w[i].first == w[j].first) ++j;
    --total;
    ans += solve(i, j - 1);
    ans %= mod;
    i = j;
  }
  total %= mod;
  ans += total * p2[n];
  ans %= mod;
  fprintf(stdout, "%I64d\n", ans);
  return 0;
}
