#include <bits/stdc++.h>
using namespace std;
int x[1000500];
int y[1000500];
long long c[1000500];
map<long long, int> num;
int n, m, k;
long long z;
long long p2[1000500];
int e;
int cnt[1000500];
map<pair<int, int>, int> parent, sz;
set<int> s[1000500];
void add(int k, int v) {
  if (s[k].find(v) != s[k].end()) return;
  s[k].insert(v);
  cnt[k] += 1;
}
int get_parent(int e, int x) {
  if (parent.find(make_pair(e, x)) == parent.end()) return x;
  return parent[make_pair(e, x)];
}
int get_size(int e, int x) {
  if (sz.find(make_pair(e, x)) == sz.end()) return 1;
  return sz[make_pair(e, x)];
}
int up(int e, int x) {
  int p = get_parent(e, x);
  if (p == x) return x;
  parent[make_pair(e, x)] = up(e, p);
  return parent[make_pair(e, x)];
}
void dbg(int e) {
  for (int i = 1; i <= n; ++i) {
    printf("i=%i:  p=%i   sz=%i\n", i, get_parent(e, i), get_size(e, i));
  }
}
int unite_it(int e, int x, int y) {
  x = up(e, x);
  y = up(e, y);
  if (x == y) return 0;
  if (get_size(e, x) < get_size(e, y)) swap(x, y);
  int tmp = get_size(e, x) + get_size(e, y);
  sz[make_pair(e, x)] = tmp;
  parent[make_pair(e, y)] = x;
  cnt[e] -= 1;
}
int main() {
  scanf("%i%i%i", &n, &m, &k);
  for (int i = 1; i <= n; ++i) scanf("%lld", &c[i]);
  for (int i = 0; i < m; ++i) {
    scanf("%i%i", &x[i], &y[i]);
    z = c[x[i]] ^ c[y[i]];
    if (num.find(z) == num.end()) {
      num[z] = ++e;
    }
    add(num[z], x[i]);
    add(num[z], y[i]);
    unite_it(num[z], x[i], y[i]);
  }
  p2[0] = 1;
  for (int i = 1; i < 1000500; ++i) {
    p2[i] = p2[i - 1] * 2;
    while (p2[i] >= 1000000007) p2[i] -= 1000000007;
  }
  long long ans = p2[n + k];
  for (int i = 1; i <= e; ++i) {
    long long d = p2[s[i].size()] - p2[cnt[i]];
    if (d < 0) d += 1000000007;
    d = d * p2[n - s[i].size()] % 1000000007;
    ans -= d;
    if (ans < 0) ans += 1000000007;
  }
  cout << ans << endl;
}
