#include <bits/stdc++.h>
using namespace std;
const int N = 500005;
const long long mod = 1e9 + 7;
int tam;
int sz[N], p[N];
vector<int> modifications;
int rep(int u) { return p[u] == u ? u : rep(p[u]); }
void add_edge(int u, int v) {
  int a = rep(u), b = rep(v);
  if (sz[a] < sz[b]) swap(a, b);
  if (a != b) {
    tam--;
    p[b] = a;
    modifications.emplace_back(b);
    sz[a] += sz[b];
  }
}
void rollback() {
  int u = modifications.back();
  sz[p[u]] -= sz[u];
  p[u] = u;
  tam++;
  modifications.pop_back();
}
map<long long, vector<pair<int, int>>> cnt;
int n, m, k;
long long c[N], power[N];
int main() {
  power[0] = 1;
  for (int i = 1; i < N; i++) {
    power[i] = power[i - 1] + power[i - 1];
    if (power[i] >= mod) power[i] -= mod;
    p[i] = i;
    sz[i] = 1;
  }
  scanf("%d %d %d", &n, &m, &k);
  tam = n;
  modifications.reserve(n);
  for (int i = 1; i <= n; i++) scanf("%lld", c + i);
  for (int i = 1, a, b; i <= m; i++) {
    scanf("%d %d", &a, &b);
    long long val = c[a] ^ c[b];
    cnt[val].emplace_back(a, b);
  }
  long long ans = 0;
  for (auto &x : cnt) {
    for (auto e : x.second) add_edge(e.first, e.second);
    ans += power[tam];
    if (ans >= mod) ans -= mod;
    while (!modifications.empty()) rollback();
  }
  ans += (power[k] - (int)cnt.size()) * power[n];
  ans %= mod;
  if (ans < 0) ans += mod;
  printf("%lld\n", ans);
}
