#include <bits/stdc++.h>
using namespace std;
const int MOD = 1000000007;
long long modpow(long long b, long long e, long long m) {
  long long r = 1;
  while (e) {
    if (e % 2) {
      r *= b;
      r %= m;
    }
    b *= b;
    b %= m;
    e /= 2;
  }
  return r;
}
int n, m, k;
long long l[500005];
int ufpar[500005];
int find(int x) { return ufpar[x] == x ? x : (ufpar[x] = find(ufpar[x])); }
bool merge(int x, int y) {
  int fx = find(x);
  int fy = find(y);
  if (fx == fy) return false;
  ufpar[fx] = fy;
  return true;
}
void ufreset(vector<int>& v) {
  for (int out : v) {
    ufpar[out] = out;
  }
}
map<long long, vector<pair<int, int>>> edges;
int main() {
  scanf("%d%d%d", &n, &m, &k);
  for (int i = 0; i < n; i++) {
    scanf("%lld", &l[i]);
  }
  while (m--) {
    int a, b;
    scanf("%d%d", &a, &b);
    a--;
    b--;
    edges[l[a] ^ l[b]].push_back(pair<int, int>(a, b));
  }
  long long twopow = modpow(2, n, MOD);
  long long ret = (1LL << k);
  ret %= MOD;
  ret *= twopow;
  ret %= MOD;
  for (auto out : edges) {
    ret += MOD - twopow;
    if (ret >= MOD) ret -= MOD;
    int nc = n;
    {
      vector<int> all;
      for (pair<int, int> out2 : out.second) {
        all.push_back(out2.first);
        all.push_back(out2.second);
      }
      ufreset(all);
    }
    for (pair<int, int> out2 : out.second) {
      int lhs = find(out2.first);
      int rhs = find(out2.second);
      if (merge(lhs, rhs)) nc--;
    }
    ret += modpow(2, nc, MOD);
    if (ret >= MOD) ret -= MOD;
  }
  printf("%lld\n", ret);
}
