#include <bits/stdc++.h>
using namespace std;
const int N = int(6e5) + 5;
const int inf = (int)1e9 + 7;
int n, m, k;
long long c[N];
map<long long, vector<pair<int, int> > > all;
vector<int> g[N];
set<int> now, u;
int cnt, cntc;
int bpow(int x, int y) {
  if (y == 0) {
    return 1;
  }
  int z = bpow(x, y >> 1);
  z = z * 1ll * z % inf;
  if (y & 1) {
    z = z * 1ll * x % inf;
  }
  return z;
}
void dfs(int v) {
  ++cnt;
  u.insert(v);
  for (int i : g[v]) {
    if (!u.count(i)) {
      dfs(i);
    }
  }
}
int main() {
  scanf("%d %d %d", &n, &m, &k);
  for (int i = 1; i <= n; ++i) {
    scanf("%lld", c + i);
  }
  for (int i = 1; i <= m; ++i) {
    int x, y;
    scanf("%d %d", &x, &y);
    all[c[x] ^ c[y]].push_back({x, y});
  }
  int ans = 0;
  long long tot = (1LL << k);
  for (auto i : all) {
    tot--;
    cnt = 0, cntc = 0;
    for (auto j : i.second) {
      now.insert(j.first);
      now.insert(j.second);
      g[j.first].push_back(j.second);
      g[j.second].push_back(j.first);
    }
    for (int j : now) {
      if (!u.count(j)) {
        ++cntc;
        dfs(j);
      }
    }
    cnt = n - cnt;
    ans += bpow(2, cnt + cntc);
    ans %= inf;
    for (int j : now) {
      g[j].clear();
    }
    now.clear();
    u.clear();
  }
  ans += ((tot % inf) * 1ll * bpow(2, n) % inf);
  ans %= inf;
  printf("%d", ans);
  return 0;
}
