#include <bits/stdc++.h>
using namespace std;
const int N = 5e5 + 5;
long long n, m, k, mod = 1e9 + 7, mx;
long long a[N], par[N], sz[N];
vector<pair<long long, long long> > ed;
map<long long, vector<pair<long long, long long> > > mp;
long long fp(long long base, long long exp) {
  if (exp == 0) return 1;
  long long ans = fp(base, exp / 2);
  ans = (ans * ans) % mod;
  if (exp % 2 != 0) ans = (ans * (base % mod)) % mod;
  return ans;
}
int findPar(int node) {
  if (par[node] == node) return node;
  return par[node] = findPar(par[node]);
}
void mergeCom(int node, int node2) {
  int led = findPar(node), led2 = findPar(node2);
  if (led == led2) return;
  if (sz[led] < sz[led2]) swap(led, led2);
  par[led2] = led, sz[led] += sz[led2];
}
int main() {
  ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  cin >> n >> m >> k;
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
    par[i] = i, sz[i] = 1;
  }
  mx = 1ll << k;
  mx--;
  for (int i = 1; i <= m; i++) {
    int x, y;
    cin >> x >> y;
    ed.push_back({x, y});
    if ((a[x] ^ a[y]) <= mx) {
      mp[(a[x] ^ a[y])].push_back({x, y});
    }
  }
  long long ans = ((fp(2, n) % mod) * ((mx - (long long)mp.size() + 1) % mod)) %
                  mod,
            com, tmp;
  for (auto it : mp) {
    com = n;
    for (int j = 0; j < it.second.size(); j++) {
      int v = it.second[j].first, u = it.second[j].second;
      if (findPar(v) != findPar(u)) {
        com--;
        mergeCom(v, u);
      }
    }
    ans = (ans + fp(2, com)) % mod;
    for (int j = 0; j < it.second.size(); j++) {
      int v = it.second[j].first, u = it.second[j].second;
      par[v] = v, par[u] = u;
      sz[v] = 1, sz[u] = 1;
    }
  }
  cout << ans << '\n';
}
