#include <bits/stdc++.h>
using namespace std;
const int N = 500005;
const long long mod = 1e9 + 7;
int n, m, k;
long long c[N], p[N];
struct DSU {
  int n;
  map<int, int> p;
  DSU(int sz = 0) : n(sz) {}
  int f(int x) {
    if (!p.count(x)) return p[x] = x;
    if (p[x] == x) return x;
    return p[x] = f(p[x]);
  }
  void join(int a, int b) {
    a = f(a), b = f(b);
    if (a == b) return;
    n--;
    p[a] = b;
  }
};
map<long long, DSU> cnt;
int main() {
  p[0] = 1;
  for (int i = 1; i < N; i++) {
    p[i] = p[i - 1] + p[i - 1];
    if (p[i] >= mod) p[i] -= mod;
  }
  scanf("%d %d %d", &n, &m, &k);
  for (int i = 1; i <= n; i++) scanf("%lld", c + i);
  for (int i = 1, a, b; i <= m; i++) {
    scanf("%d %d", &a, &b);
    long long val = c[a] ^ c[b];
    if (!cnt.count(val)) cnt.emplace(val, DSU(n));
    cnt[val].join(a, b);
  }
  long long ans = 0;
  for (auto &x : cnt) {
    ans += p[x.second.n];
    if (ans >= mod) ans -= mod;
  }
  ans += (p[k] - (int)cnt.size()) * p[n];
  ans %= mod;
  if (ans < 0) ans += mod;
  printf("%lld\n", ans);
}
