#include <bits/stdc++.h>
using namespace std;
const long long N = 5e5 + 10;
const long long mod = 1e9 + 7;
map<long long, long long> fa[N];
map<long long, long long> cnt;
long long qkpow(long long a, long long idx) {
  long long sum = 1;
  while (idx) {
    if (idx & 1) sum = 1ll * sum * a % mod;
    idx >>= 1;
    a = 1ll * a * a % mod;
  }
  return sum;
}
long long read() {
  long long ivy;
  scanf("%lld", &ivy);
  return ivy;
}
long long find(long long u, long long x) {
  if (fa[u][x] != u) return fa[u][x] = find(fa[u][x], x);
  return u;
}
long long n, m, k, ans, A[N];
int main() {
  cin >> n >> m >> k;
  ans = 1ll * qkpow(2, n) * qkpow(2, k) % mod;
  for (long long i = 1; i <= n; i++) A[i] = read();
  while (m--) {
    long long u = read(), v = read();
    long long x = A[u] ^ A[v];
    if (fa[u][x] == 0) fa[u][x] = u;
    if (fa[v][x] == 0) fa[v][x] = v;
    if (find(u, x) == find(v, x)) continue;
    fa[find(u, x)][x] = fa[find(v, x)][x];
    cnt[x]++;
    ans = (ans - qkpow(2, n - cnt[x]) + mod) % mod;
  }
  cout << ans;
  return 0;
}
