#include <bits/stdc++.h>
using namespace std;
int uf[1 << 19];
int n, m;
long long v[1 << 19];
int p2[1 << 19];
map<long long, vector<pair<int, int> > > w;
int kk;
int find(int x) {
  if (uf[x] < 0) return x;
  return uf[x] = find(uf[x]);
}
void join(int x, int y) {
  assert(x != y && uf[x] < 0 && uf[y] < 0);
  if (uf[x] > uf[y]) swap(x, y);
  uf[x] += uf[y];
  uf[y] = x;
}
int main() {
  p2[0] = 1;
  for (int i = 1, ThxDem = (1 << 19); i < ThxDem; ++i) {
    p2[i] = p2[i - 1] * 2;
    if (p2[i] >= 1000000007) p2[i] -= 1000000007;
  }
  scanf("%d%d%d", &n, &m, &kk);
  for (int i = 0, ThxDem = n; i < ThxDem; ++i) scanf("%lld", v + i);
  for (int i = 0, ThxDem = m; i < ThxDem; ++i) {
    int x, y;
    scanf("%d%d", &x, &y);
    x--;
    y--;
    w[v[x] ^ v[y]].push_back(make_pair(x, y));
  }
  int r = 0;
  memset(uf, -1, sizeof(uf));
  for (auto _ : w) {
    auto v = _.second;
    int q = n;
    for (auto p : v) {
      int x = p.first, y = p.second;
      x = find(x);
      y = find(y);
      if (x != y) {
        join(x, y);
        q--;
      }
    }
    for (auto p : v) {
      int x = p.first, y = p.second;
      uf[x] = uf[y] = -1;
    }
    r += p2[q];
    if (r >= 1000000007) r -= 1000000007;
  }
  r += 1LL * (((1LL << kk) - ((int)(w).size())) % 1000000007) * p2[n] %
       1000000007;
  if (r >= 1000000007) r -= 1000000007;
  printf("%d\n", r);
  return 0;
}
