#include <bits/stdc++.h>
using namespace std;
const long long mod = (1000000000LL + 7LL);
long long n, m, k, v[500020], pot[500020], ans;
vector<pair<long long, long long> > edge[500020];
vector<long long> lista, grafo[500020];
struct DSU {
  long long pai[500020], peso[500020], yes[500020];
  vector<long long> caras;
  long long Find(long long x) {
    if (!yes[x]) {
      yes[x] = 1;
      peso[x] = 0;
      pai[x] = x;
      caras.push_back(x);
    }
    if (pai[x] == x) return x;
    return pai[x] = Find(pai[x]);
  }
  void join(long long a, long long b) {
    a = Find(a), b = Find(b);
    if (a == b) return;
    if (peso[a] < peso[b]) swap(a, b);
    pai[b] = a;
    if (peso[a] == peso[b]) peso[a]++;
  }
  void clear() {
    for (auto x : caras) {
      pai[x] = x;
      peso[x] = 0;
      yes[x] = 0;
    }
    caras.clear();
  }
  long long query() {
    set<long long> ss, tt;
    for (auto x : caras) tt.insert(x), ss.insert(Find(x));
    long long free = (n - (long long)tt.size());
    return pot[(long long)ss.size() + free];
  }
} T;
int32_t main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cin >> n >> m >> k;
  pot[0] = 1;
  for (long long i = 1; i < 500020; i++) pot[i] = (2 * pot[i - 1]) % mod;
  for (long long i = 1; i <= n; i++) cin >> v[i];
  for (long long i = 1, a, b; i <= m; i++) {
    cin >> a >> b;
    grafo[a].push_back(b);
    grafo[b].push_back(a);
    long long c = (v[a] ^ v[b]);
    lista.push_back(c);
  }
  sort(lista.begin(), lista.end());
  lista.erase(unique(lista.begin(), lista.end()), lista.end());
  for (long long i = 1; i <= n; i++)
    for (auto j : grafo[i])
      if (j > i) {
        long long x = (v[i] ^ v[j]);
        long long c =
            upper_bound(lista.begin(), lista.end(), x) - lista.begin();
        edge[c].push_back({i, j});
      }
  for (auto val : lista) {
    long long c = upper_bound(lista.begin(), lista.end(), val) - lista.begin();
    T.clear();
    for (auto par : edge[c]) {
      long long x = par.first, y = par.second;
      T.join(x, y);
    }
    ans = (ans + T.query()) % mod;
  }
  long long qtd = (pot[k] - (long long)lista.size() + mod) % mod;
  ans = (ans + qtd * pot[n]) % mod;
  ans += mod;
  ans %= mod;
  cout << ans << "\n";
}
