#include <bits/stdc++.h>
using namespace std;
const int inf = 1000000000;
long long mod = 1000000007LL;
long long mod2 = 998244353LL;
int n, m, k;
long long c[500005];
unordered_map<long long, vector<pair<int, int>>> es;
vector<int> edges[500005];
bool vis[500005];
void dfs(int u, int& cnt) {
  if (vis[u]) {
    return;
  }
  cnt++;
  vis[u] = true;
  for (int i = 0; i < edges[u].size(); ++i) {
    int v = edges[u][i];
    dfs(v, cnt);
  }
}
long long getpw(long long a, long long b) {
  long long res = 1LL;
  while (b) {
    if (b & 1) res = res * a % mod;
    a = a * a % mod;
    b /= 2;
  }
  return res;
}
int main() {
  es.clear();
  cin >> n >> m >> k;
  for (int i = 1; i <= n; ++i) {
    scanf("%lld", &c[i]);
  }
  vector<pair<long long, pair<int, int>>> rk;
  rk.clear();
  for (int i = 1; i <= m; ++i) {
    int u, v;
    scanf("%d%d", &u, &v);
    rk.push_back(make_pair(c[u] ^ c[v], make_pair(u, v)));
  }
  sort(rk.begin(), rk.end());
  memset(vis, false, sizeof(vis));
  long long ans = 0LL;
  int i = 0;
  long long tot = (1LL << k);
  while (i < rk.size()) {
    int j = i;
    unordered_set<int> vs;
    vs.clear();
    while (j < rk.size() && rk[j].first == rk[i].first) {
      int u = rk[j].second.first;
      int v = rk[j].second.second;
      vs.insert(u);
      vs.insert(v);
      edges[u].push_back(v);
      edges[v].push_back(u);
      j++;
    }
    long long tmp = 1LL;
    vector<int> vv(vs.begin(), vs.end());
    for (auto v : vv) {
      if (!vis[v]) {
        int cnt = 0;
        dfs(v, cnt);
        tmp = tmp * 2LL % mod;
      }
    }
    long long det = n - (long long)vv.size();
    tmp = tmp * getpw(2LL, det) % mod;
    ans = (ans + tmp) % mod;
    for (auto v : vv) {
      vis[v] = false;
      edges[v].clear();
    }
    tot--;
    i = j;
  }
  tot %= mod;
  ans = (ans + tot * getpw(2LL, n) % mod) % mod;
  cout << ans << endl;
  return 0;
}
