#include <bits/stdc++.h>
using namespace std;
const int P = 1e9 + 7, INF = 0x3f3f3f3f;
long long gcd(long long a, long long b) { return b ? gcd(b, a % b) : a; }
long long qpow(long long a, long long n) {
  long long r = 1 % P;
  for (a %= P; n; a = a * a % P, n >>= 1)
    if (n & 1) r = r * a % P;
  return r;
}
long long inv(long long first) {
  return first <= 1 ? 1 : inv(P % first) * (P - P / first) % P;
}
inline int rd() {
  int first = 0;
  char p = getchar();
  while (p < '0' || p > '9') p = getchar();
  while (p >= '0' && p <= '9') first = first * 10 + p - '0', p = getchar();
  return first;
}
const int N = 1e6 + 50;
int n, m, k, clk, fa[N], tim[N], pw[N];
long long c[N];
struct _ {
  int u, v;
  long long w;
  bool operator<(const _ &rhs) const { return w < rhs.w; }
} e[N];
void upd(int first) {
  if (tim[first] != clk) tim[first] = clk, fa[first] = 0;
}
int Find(int first) {
  upd(first);
  return fa[first] ? fa[first] = Find(fa[first]) : first;
}
int main() {
  pw[0] = 1;
  scanf("%d%d%d", &n, &m, &k);
  for (int i = 1; i <= n; ++i)
    scanf("%lld", c + i), pw[i] = pw[i - 1] * 2ll % P;
  for (int i = 1; i <= m; ++i) {
    scanf("%d%d", &e[i].u, &e[i].v);
    e[i].w = c[e[i].u] ^ c[e[i].v];
  }
  sort(e + 1, e + 1 + m);
  long long pre = 0;
  int ans = 0;
  for (int i = 1; i <= m; ++i) {
    ++clk;
    int j = i, cnt = n;
    while (j < m && e[j + 1].w == e[j].w) ++j;
    for (int k = i; k <= j; ++k) {
      int u = Find(e[k].u), v = Find(e[k].v);
      if (u != v) fa[u] = v, --cnt;
    }
    ans = (ans + pw[cnt]) % P;
    ans = (ans + (e[i].w - pre) % P * pw[n]) % P;
    pre = e[i].w + 1;
    i = j;
  }
  ans = (ans + ((1ll << k) - pre) % P * pw[n]) % P;
  printf("%d\n", ans);
}
