#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
#pragma GCC target( \
    "sse,sse2,sse3,ssse3,sse4,sse4.1,sse4.2,popcnt,abm,mmx,avx,tune=native")
using namespace std;
const int MOD = 1000000007;
const int UNDEF = -1;
const int INF = 1 << 30;
template <typename T>
inline bool chkmax(T &aa, T bb) {
  return aa < bb ? aa = bb, true : false;
}
template <typename T>
inline bool chkmin(T &aa, T bb) {
  return aa > bb ? aa = bb, true : false;
}
int rint() {
  int x;
  scanf("%d", &x);
  return x;
}
long long rlong() {
  long long x;
  scanf("%lld", &x);
  return x;
}
const int mn = (5e5) + 4;
long long c[mn];
map<long long, vector<pair<int, int> > > sig2e;
map<int, vector<int> > h;
set<int> seen;
int cnt = 0;
void dfs(int x) {
  seen.insert(x);
  for (auto &y : h[x]) {
    if (seen.find(y) == seen.end()) {
      --cnt;
      dfs(y);
    }
  }
}
int ptwo[mn];
int main() {
  int n = rint(), m = rint(), k = rint();
  ptwo[0] = 1;
  for (int i = 1; i < mn; i++) {
    ptwo[i] = ptwo[i - 1] * 2;
    if (ptwo[i] >= MOD) ptwo[i] -= MOD;
  }
  for (int x = 1; x <= n; x++) c[x] = rlong();
  for (int i = 0; i < m; i++) {
    int x = rint(), y = rint();
    long long sig = c[x] ^ c[y];
    sig2e[sig].push_back(make_pair(x, y));
  }
  int rem = (ptwo[k] - (int)sig2e.size() + MOD) % MOD;
  int ans = (rem * (long long)ptwo[n]) % MOD;
  for (auto &sigve : sig2e) {
    auto &ve = sigve.second;
    h.clear();
    seen.clear();
    for (auto &e : ve) {
      int x = e.first, y = e.second;
      h[x].push_back(y);
      h[y].push_back(x);
    }
    cnt = n;
    for (auto &e : ve) {
      int x = e.first, y = e.second;
      if (seen.find(x) == seen.end()) dfs(x);
      if (seen.find(y) == seen.end()) dfs(y);
    }
    ans += ptwo[cnt];
    if (ans >= MOD) ans -= MOD;
  }
  printf("%d\n", ans);
}
