#include <bits/stdc++.h>
using namespace std;
const int maxn = 1200005, P = 1e9 + 7;
int n, m, K, b[maxn];
long long w[maxn];
struct data {
  int x, y;
  long long w;
} Es[maxn];
bool _cmp(const data &A, const data &B) { return A.w < B.w; }
long long pw[maxn];
int fa[maxn];
int getfa(int x) { return fa[x] == x ? x : fa[x] = getfa(fa[x]); }
int ID(int x) { return lower_bound(b + 1, b + 1 + b[0], x) - b; }
int main() {
  scanf("%d%d%d", &n, &m, &K);
  pw[0] = 1;
  for (int i = 1; i <= n + K; i++) pw[i] = pw[i - 1] * 2 % P;
  for (int i = 1; i <= n; i++) scanf("%lld", &w[i]);
  for (int i = 1; i <= m; i++) {
    scanf("%d%d", &Es[i].x, &Es[i].y);
    Es[i].w = w[Es[i].x] ^ w[Es[i].y];
  }
  sort(Es + 1, Es + 1 + m, _cmp);
  int ans = 0;
  for (int i = 1, j; i <= m;) {
    b[0] = 0;
    j = i;
    while (j <= m && Es[i].w == Es[j].w)
      b[++b[0]] = Es[j].x, b[++b[0]] = Es[j].y, j++;
    sort(b + 1, b + 1 + b[0]);
    b[0] = unique(b + 1, b + 1 + b[0]) - b - 1;
    for (int k = 1; k <= b[0]; k++) fa[k] = k;
    for (int k = i; k <= j - 1; k++)
      fa[getfa(ID(Es[k].x))] = getfa(ID(Es[k].y));
    int cnt = 0;
    for (int k = 1; k <= b[0]; k++)
      if (getfa(k) == k) cnt++;
    (ans += pw[n - b[0]] * (pw[b[0]] - pw[cnt]) % P) %= P;
    i = j;
  }
  ans = ((pw[n + K] - ans) % P + P) % P;
  printf("%d\n", ans);
  return 0;
}
