#include <bits/stdc++.h>
using namespace std;
const int MAXN = 500100;
long long a[MAXN];
int n, m, k, u[MAXN], v[MAXN], f[MAXN], pw2[MAXN];
bool cmp(const int &o, const int &p) {
  return (a[u[o]] ^ a[v[o]]) < (a[u[p]] ^ a[v[p]]);
}
int h[MAXN];
const int mod = 1e9 + 7;
int getfa(int o) {
  if (f[o] == o) return o;
  return f[o] = getfa(f[o]);
}
int main() {
  scanf("%d%d%d", &n, &m, &k);
  for (int i = 0; i < n; ++i) {
    scanf("%lld", &a[i]);
  }
  pw2[0] = 1;
  for (int i = 1; i < MAXN; ++i) {
    pw2[i] = pw2[i - 1] * 2;
    if (pw2[i] >= mod) pw2[i] -= mod;
  }
  for (int i = 0; i < m; ++i) {
    scanf("%d%d", &u[i], &v[i]);
    u[i]--;
    v[i]--;
    h[i] = i;
  }
  sort(h, h + m, cmp);
  long long tot = 1LL << k;
  for (int i = 0; i < n; ++i) {
    f[i] = i;
  }
  int ans = 0;
  for (int i = 0; i < m;) {
    int j = i;
    tot--;
    int now = n;
    while (j < m && !cmp(h[i], h[j])) {
      if (getfa(u[h[j]]) != getfa(v[h[j]])) {
        now--;
        f[getfa(u[h[j]])] = getfa(v[h[j]]);
      }
      j++;
    }
    ans += pw2[now];
    if (ans >= mod) ans -= mod;
    for (int k = i; k < j; ++k) {
      f[u[h[k]]] = u[h[k]];
      f[v[h[k]]] = v[h[k]];
    }
    i = j;
  }
  ans += tot % mod * pw2[n] % mod;
  if (ans >= mod) ans -= mod;
  printf("%d\n", ans);
  return 0;
}
