#include <bits/stdc++.h>
using namespace std;
map<long long, int> MP;
int Q = 1;
vector<pair<int, int> > adj[500005];
long long C[500005];
set<int> S;
int p[500005];
long long pw(int x) {
  if (!x) return 1LL;
  if (x & 1) return 2 * pw(x - 1) % 1000000007;
  long long hf = pw(x / 2);
  return hf * hf % 1000000007;
}
int par(int x) {
  if (p[x] == x) return x;
  return p[x] = par(p[x]);
}
int main() {
  int N, M, K;
  scanf("%d%d%d", &N, &M, &K);
  long long X = (1LL << K);
  for (int i = 1; i <= N; i++) scanf("%lld", &C[i]);
  for (int i = 0; i < M; i++) {
    int u, v;
    scanf("%d%d", &u, &v);
    long long x = C[u] ^ C[v];
    int t = MP[x];
    if (!t) {
      MP[x] = Q;
      adj[Q].push_back(pair<int, int>(u, v));
      Q++;
    } else {
      adj[t].push_back(pair<int, int>(u, v));
    }
  }
  int ans = 0;
  for (int i = 1; i <= N; i++) p[i] = i;
  for (int i = 1; i < Q; i++) {
    int sz = N;
    for (pair<int, int> j : adj[i]) {
      int u = j.first, v = j.second;
      S.insert(u);
      S.insert(v);
      if (par(u) != par(v)) {
        sz--;
        p[p[v]] = p[u];
      }
    }
    ans = (ans + pw(sz)) % 1000000007;
    while (S.size()) {
      int now = *(S.begin());
      p[now] = now;
      S.erase(S.begin());
    }
  }
  printf("%lld\n",
         ((X - Q + 1) % 1000000007 * pw(N) % 1000000007 + ans) % 1000000007);
  return 0;
}
