#include <bits/stdc++.h>
using namespace std;
const int M = 500005;
const int MOD = 1e9 + 7;
long long read() {
  long long x = 0, f = 1;
  char c;
  while ((c = getchar()) < '0' || c > '9') {
    if (c == '-') f = -1;
  }
  while (c >= '0' && c <= '9') {
    x = (x << 3) + (x << 1) + (c ^ 48);
    c = getchar();
  }
  return x * f;
}
long long n, m, k, ans, cnt, sum, fa[M], c[M];
struct node {
  long long u, v, c;
  bool operator<(const node &b) const { return c < b.c; }
} a[M];
long long find(long long x) {
  if (fa[x] != x) fa[x] = find(fa[x]);
  return fa[x];
}
void merge(long long u, long long v) {
  long long x = find(u), y = find(v);
  if (x != y) fa[x] = y, sum--;
}
long long qkpow(long long a, long long b) {
  long long r = 1;
  while (b > 0) {
    if (b & 1) r = r * a % MOD;
    a = a * a % MOD;
    b >>= 1;
  }
  return r;
}
signed main() {
  n = read();
  m = read();
  k = read();
  for (long long i = 1; i <= n; i++) c[i] = read(), fa[i] = i;
  for (long long i = 1; i <= m; i++) {
    long long u = read(), v = read();
    a[i] = node{u, v, c[u] ^ c[v]};
  }
  sort(a + 1, a + 1 + m);
  for (long long i = 1, j = 1; i <= m;) {
    cnt++;
    sum = n;
    for (; j <= m; j++) {
      if (a[i].c != a[j].c) break;
      merge(a[j].u, a[j].v);
    }
    ans = (ans + qkpow(2, sum)) % MOD;
    for (; i < j; i++) {
      fa[a[i].u] = a[i].u;
      fa[a[i].v] = a[i].v;
    }
  }
  ans += (qkpow(2, k) - cnt) * qkpow(2, n);
  printf("%lld\n", (ans % MOD + MOD) % MOD);
}
