#include <bits/stdc++.h>
using namespace std;
int n, m, k;
long long a[600010];
map<long long, vector<pair<int, int>>> possiblex;
long long p2[600010];
void genp2() {
  p2[0] = 1;
  for (int i = 0; i++ < 600010 - 1;) {
    p2[i] = p2[i - 1] * 2 % ((long long)1e9 + 7);
  }
}
int dsu[600010];
int setcnt;
int findp(int u) {
  if (dsu[u] == u) return u;
  return dsu[u] = findp(dsu[u]);
}
void join(int u, int v) {
  if (rand() & 1) swap(u, v);
  u = findp(u);
  v = findp(v);
  if (u == v) return;
  dsu[u] = v;
  setcnt--;
}
int main() {
  genp2();
  srand((unsigned)time(0));
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> n >> m >> k;
  for (int i = 0; i++ < n;) {
    cin >> a[i];
    dsu[i] = i;
  }
  for (int i = -1; ++i < m;) {
    int u, v;
    cin >> u >> v;
    possiblex[a[u] ^ a[v]].push_back(pair<int, int>(u, v));
  }
  long long ans = (p2[k] - ((int)possiblex.size()) + ((long long)1e9 + 7)) %
                  ((long long)1e9 + 7) * p2[n] % ((long long)1e9 + 7);
  for (auto& i : possiblex) {
    setcnt = n;
    for (auto& f : i.second) {
      join(f.first, f.second);
    }
    (ans += p2[setcnt]) %= ((long long)1e9 + 7);
    for (auto& f : i.second) {
      dsu[f.first] = f.first;
      dsu[f.second] = f.second;
    }
  }
  cout << ans;
  return 0;
}
