#include <bits/stdc++.h>
using namespace std;
map<long long int, set<int> > m;
map<long long int, vector<pair<int, int> > > ed;
long long int mod = 1e9 + 7;
long long int ans = 0;
long long int p(long long int a, long long int b) {
  long long int r = 1;
  while (b) {
    if (b % 2) r = (r * a) % mod;
    a = (a * a) % mod;
    b /= 2;
  }
  return r;
}
vector<int> v[1000005];
long long int a[1000005];
int n, q, k;
int vis[1000005];
void dfs(int at) {
  vis[at] = 1;
  for (__typeof(v[at].begin()) it = v[at].begin(); it != v[at].end(); it++) {
    if (vis[*it] == 0) {
      dfs(*it);
    }
  }
}
void go(long long int id) {
  set<int> ver = m[id];
  for (__typeof(ed[id].begin()) it = ed[id].begin(); it != ed[id].end(); it++) {
    int x = it->first;
    int y = it->second;
    v[x].push_back(y);
    v[y].push_back(x);
  }
  long long int kk = p(2, n - ver.size());
  for (__typeof(ver.begin()) it = ver.begin(); it != ver.end(); it++) {
    if (vis[*it] == 0) {
      kk = (kk * 2) % mod;
      dfs(*it);
    }
  }
  ans = (ans + kk) % mod;
  for (__typeof(ver.begin()) it = ver.begin(); it != ver.end(); it++) {
    v[*it].clear();
    vis[*it] = 0;
  }
}
int main() {
  scanf("%d", &n);
  scanf("%d", &q);
  scanf("%d", &k);
  for (int i = 1; i <= n; i++) scanf("%lld", &a[i]);
  while (q--) {
    int x, y;
    scanf("%d", &x);
    scanf("%d", &y);
    long long int kk = (a[x] ^ a[y]);
    m[kk].insert(x);
    m[kk].insert(y);
    ed[kk].push_back(make_pair(x, y));
  }
  long long int cc = p(2, n);
  long long int rem = p(2, k) - m.size();
  rem %= mod;
  ans = (cc * rem) % mod;
  for (__typeof(m.begin()) it = m.begin(); it != m.end(); it++) {
    go(it->first);
  }
  ans = (ans + mod) % mod;
  printf("%lld", ans);
  return 0;
}
