#include <bits/stdc++.h>
using namespace std;
int n, m, k;
unsigned long long c[500001];
int S[500001], T[500001];
unsigned long long X[500001], P[500001];
bool cmp(int i, int j) { return X[i] < X[j]; }
int f[500001];
int ff(int x) { return f[x] ? f[x] = ff(f[x]) : x; }
int Ans;
int qPow(int b, int e) {
  int a = 1;
  for (; e; e >>= 1, b = (unsigned long long)b * b % 1000000007)
    if (e & 1) a = (unsigned long long)a * b % 1000000007;
  return a;
}
int main() {
  scanf("%d%d%d", &n, &m, &k);
  int _2n = qPow(2, n);
  for (int i = 1; i <= n; ++i) scanf("%lld", c + i);
  for (int i = 1; i <= m; ++i) scanf("%d%d", S + i, T + i);
  for (int i = 1; i <= m; ++i) X[i] = c[S[i]] ^ c[T[i]], P[i] = i;
  Ans = (unsigned long long)(1ll << k) % 1000000007 * _2n % 1000000007;
  sort(P + 1, P + m + 1, cmp);
  for (int i = 1; i <= m;) {
    int j = i, cnt = n;
    f[S[P[i]]] = T[P[i]];
    --cnt;
    while (j < m && X[P[j + 1]] == X[P[j]]) {
      ++j;
      if (ff(S[P[j]]) != ff(T[P[j]])) {
        f[ff(S[P[j]])] = ff(T[P[j]]);
        --cnt;
      }
    }
    Ans = ((unsigned long long)Ans - _2n + qPow(2, cnt) + 1000000007) %
          1000000007;
    while (i <= j) f[S[P[i]]] = f[T[P[i]]] = 0, ++i;
  }
  printf("%d", Ans);
  return 0;
}
