#include <bits/stdc++.h>
using namespace std;
const double eps = 1e-7;
const long long INFF = 1e18;
const int INF = 1e9;
const int mod = 1e9 + 7;
const int MAX = 5e5 + 7;
long long a[MAX];
int siz[MAX], gp[MAX];
pair<long long, pair<int, int> > al[MAX];
int fd(int v) { return gp[v] == v ? v : gp[v] = fd(gp[v]); }
bool uni(int u, int v) {
  u = fd(u);
  v = fd(v);
  if (u == v) return 0;
  if (siz[u] > siz[v]) swap(u, v);
  gp[u] = v;
  siz[v] += siz[u];
  return 1;
}
long long val[MAX];
void build() {
  val[0] = 1;
  for (int i = (1); i < (MAX); ++i) val[i] = val[i - 1] * 2 % mod;
  return;
}
int main(void) {
  build();
  int n, m, k;
  scanf("%d %d %d", &n, &m, &k);
  ;
  for (int i = (1); i < (n + 1); ++i) scanf("%lld", a + i);
  for (int i = (1); i < (n + 1); ++i) siz[i] = 1, gp[i] = i;
  for (int i = (1); i < (m + 1); ++i) {
    int u, v;
    scanf("%d %d", &u, &v);
    ;
    al[i] = make_pair(a[u] ^ a[v], make_pair(u, v));
  }
  sort(al + 1, al + m + 1);
  long long cnt = 1LL << k, ans = 0;
  for (int i = (1); i < (m + 1); ++i) {
    int ed = i;
    cnt--;
    while (ed < m && al[ed + 1].first == al[i].first) ed++;
    int num = n;
    for (int j = (i); j < (ed + 1); ++j) {
      if (uni(al[j].second.first, al[j].second.second)) num--;
    }
    ans = (ans + val[num]) % mod;
    for (int j = (i); j < (ed + 1); ++j) {
      siz[al[j].second.first] = siz[al[j].second.second] = 1;
      gp[al[j].second.first] = al[j].second.first;
      gp[al[j].second.second] = al[j].second.second;
    }
    i = ed;
  }
  ans = (ans + (cnt % mod) * val[n] % mod) % mod;
  printf("%lld\n", ans);
  return 0;
}
