#include <bits/stdc++.h>
using namespace std;
template <typename T>
inline void read(T &x) {
  x = 0;
  T f = 1;
  char ch = getchar();
  while (ch < '0' || ch > '9') {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') {
    x = x * 10 + ch - 48;
    ch = getchar();
  }
  x *= f;
}
const int N = 5e5 + 7;
const long long MOD = 1e9 + 7;
int fa[N];
struct E {
  int u, v;
  long long c;
  bool operator<(const E &rhs) const { return c < rhs.c; }
} e[N];
int n, m;
long long k;
long long a[N];
set<int> st;
void M(long long &x) {
  if (x < 0) x = -x;
  x %= MOD;
}
long long qp(long long a, long long b) {
  long long res = 1;
  while (b) {
    if (b & 1) M(res *= a);
    M(a *= a);
    b >>= 1;
  }
  return res;
}
int getfa(int x) { return x == fa[x] ? x : fa[x] = getfa(fa[x]); }
void merge(int u, int v, int &sz) {
  st.insert(u);
  st.insert(v);
  u = getfa(u);
  v = getfa(v);
  if (u != v) {
    sz--;
    fa[v] = u;
  }
}
int main() {
  read(n);
  read(m);
  read(k);
  for (int i = 1; i <= n; i++) read(a[i]), fa[i] = i;
  for (int i = 1; i <= m; i++) {
    read(e[i].u);
    read(e[i].v);
    e[i].c = a[e[i].u] ^ a[e[i].v];
  }
  sort(e + 1, e + m + 1);
  long long ans = 0;
  long long cnt = 0;
  for (int i = 1; i <= m;) {
    for (auto u : st) fa[u] = u;
    st.clear();
    int j = i;
    int sz = n;
    for (; e[j].c == e[i].c && j <= m; j++) merge(e[j].u, e[j].v, sz);
    i = j;
    cnt++;
    M(ans += qp(2, sz));
  }
  long long temp = 0;
  M(temp += qp(2, k) - cnt);
  M(ans += temp * qp(2, n));
  printf("%lld\n", ans);
  return 0;
}
