#include <bits/stdc++.h>
using namespace std;
const long long int MOD = 1000000007LL;
const int MAXN = 500005, MAXM = 500005;
int n, m, k, u[MAXM], v[MAXM], id[MAXM], cnt, f_[MAXN], ver[MAXN], V;
long long int c[MAXN], w[MAXM], pw[MAXN];
inline bool cmp(const int &a, const int &b) { return w[a] < w[b]; }
inline int &f(int x) {
  if (ver[x] != V) ver[x] = V, f_[x] = 0;
  return f_[x];
}
int find(int x) { return f(x) ? (f(x) = find(f(x))) : x; }
int main() {
  int i, j, ans;
  scanf("%d%d%d", &n, &m, &k);
  for (i = 1; i <= n; ++i) scanf("%I64d", &c[i]);
  for (i = 1; i <= m; ++i) {
    scanf("%d%d", &u[i], &v[i]);
    w[i] = c[u[i]] ^ c[v[i]], id[i] = i;
  }
  sort(id + 1, id + 1 + m, cmp);
  for (i = pw[0] = 1; i <= n; ++i)
    if ((pw[i] = pw[i - 1] << 1) >= MOD) pw[i] -= MOD;
  for (ans = pw[n], i = 1; i <= k; ++i)
    if ((ans <<= 1) >= MOD) ans -= MOD;
  for (i = 1; i <= m; i = j) {
    for (j = V = i, cnt = n; j <= m && w[id[j]] == w[id[i]]; ++j)
      if (find(u[id[j]]) != find(v[id[j]]))
        f(find(u[id[j]])) = find(v[id[j]]), --cnt;
    ans = (ans - pw[n] + pw[cnt] + MOD) % MOD;
  }
  printf("%d\n", ans);
  return 0;
}
