#include <bits/stdc++.h>
using namespace std;
const int MAXN = 500500, MOD = 1e9 + 7;
long long expmod(long long b, long long e) {
  long long ans = 1;
  while (e) {
    if (e & 1) ans = ans * b % MOD;
    b = b * b % MOD;
    e >>= 1;
  }
  return ans;
}
int uf[MAXN];
int uf_find(int x) { return uf[x] < 0 ? x : uf[x] = uf_find(uf[x]); }
bool uf_join(int x, int y) {
  x = uf_find(x);
  y = uf_find(y);
  if (x == y) return false;
  if (uf[x] > uf[y]) swap(x, y);
  uf[x] += uf[y];
  uf[y] = x;
  return true;
}
int n, m, k;
long long V[MAXN];
map<long long, vector<pair<int, int>>> M;
long long solve(vector<pair<int, int>> &E) {
  vector<int> R;
  int grps = n;
  for (pair<int, int> e : E) {
    R.push_back(e.first);
    R.push_back(e.second);
    if (uf_join(e.first, e.second)) grps--;
  }
  for (int i : R) uf[i] = -1;
  return expmod(2, grps);
}
int main() {
  while (scanf("%d %d %d", &n, &m, &k) >= 1) {
    M.clear();
    for (int i = (0); i < (int)(n); i++) scanf("%lld", &V[i]);
    for (int i = (0); i < (int)(m); i++) {
      int u, v;
      scanf("%d %d", &u, &v);
      u--;
      v--;
      long long val = V[u] ^ V[v];
      M[val].push_back({u, v});
    }
    long long ans = ((1LL << k) - ((int)M.size())) % MOD * expmod(2, n) % MOD;
    for (int i = (0); i < (int)(MAXN); i++) uf[i] = -1;
    for (auto t : M) ans = (ans + solve(t.second)) % MOD;
    printf("%lld\n", ans);
  }
  return 0;
}
