#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1e9 + 7;
long long power_mod(long long num, long long power) {
  long long prod = 1;
  num %= MOD;
  while (power > 0) {
    if (power & 1) prod = prod * num % MOD;
    num = num * num % MOD;
    power >>= 1;
  }
  return prod;
}
void add(long long& a, long long b) { a = (a + b + MOD) % MOD; }
int N, M, K;
const int MAX = 500000;
long long C[MAX];
map<long long, vector<pair<int, int>>> K2E;
map<int, bool> used;
map<int, vector<int>> edges;
void dfs(int i) {
  used[i] = true;
  for (auto j : edges[i]) {
    if (!used[j]) dfs(j);
  }
}
int main() {
  long long i, j, k;
  cin >> N >> M >> K;
  for (i = 0; i < N; i++) scanf("%lld", &C[i]);
  for (i = 0; i < M; i++) {
    int a, b;
    scanf("%d %d", &a, &b);
    a--;
    b--;
    K2E[C[a] ^ C[b]].push_back({a, b});
  }
  long long ans = (power_mod(2, K) - K2E.size() + MOD) * power_mod(2, N) % MOD;
  for (auto p : K2E) {
    used.clear();
    edges.clear();
    for (auto e : p.second) {
      edges[e.first].push_back(e.second);
      edges[e.second].push_back(e.first);
      used[e.first] = false;
      used[e.second] = false;
    }
    long long parts = N - used.size();
    for (auto pp : used) {
      if (pp.second) continue;
      dfs(pp.first);
      parts++;
    }
    add(ans, power_mod(2, parts));
  }
  cout << ans << endl;
  return 0;
}
