#include <bits/stdc++.h>
using namespace std;
const long long ff = 1e6 + 15;
const long long M = 1e9 + 7;
const long long inf = 1e18 + 1;
long long ksm(long long x, long long y) {
  return (y % 2 == 1 ? x : 1) * (y ? ksm(x * x % M, y >> 1) : 1) % M;
}
struct node {
  long long x, y, vlas;
};
stack<node> stk;
long long n, m, k, fa[ff], a[ff], va[ff], blk;
long long find(long long x) { return fa[x] == x ? x : fa[x] = find(fa[x]); }
void merge(long long x, long long y) {
  x = find(x);
  y = find(y);
  if (x == y) return;
  --blk;
  node haha = (node){x, y, va[y]};
  stk.push(haha);
  fa[x] = y;
  va[y] += va[x];
}
map<long long, long long> used;
struct Node {
  long long u, v, w;
} e[ff], p[ff];
bool cmp(Node x, Node y) { return x.w < y.w; }
void init() {
  long long knd = 0;
  cin >> n >> m >> k;
  for (long long i = 1; i <= n; ++i) scanf("%lld", &a[i]), fa[i] = i, va[i] = 1;
  for (long long i = 1; i <= m; ++i)
    scanf("%lld %lld", &e[i].u, &e[i].v), e[i].w = (a[e[i].u] ^ a[e[i].v]),
                                          knd += (used[e[i].w] ^ 1),
                                          used[e[i].w] = 1;
  sort(e + 1, e + 1 + m, cmp);
  long long tp = 0, ans = 0;
  for (long long i = 1; i <= m; ++i) {
    tp = 0;
    p[++tp] = e[i];
    while (i < m && e[i + 1].w == p[1].w) ++i, p[++tp] = e[i];
    blk = n;
    for (long long j = 1; j <= tp; ++j) merge(p[j].u, p[j].v);
    while (!stk.empty()) {
      node haha = stk.top();
      stk.pop();
      fa[haha.x] = haha.x;
      va[haha.y] = haha.vlas;
    }
    ans = (ans + ksm(2, blk)) % M;
  }
  ans = (ans + (ksm(2, k) - knd) * ksm(2, n) % M) % M;
  if (ans < 0) ans += M;
  cout << ans << "\n";
}
signed main() {
  long long Ts = 1;
  for (long long i = 1; i <= Ts; ++i) init();
}
