#include <bits/stdc++.h>
using namespace std;
const long long INF = 1e9 + 7;
const int MAXN = 1e6 + 7;
const double EPS = 1e-8;
long long power(long long a, long long k) {
  if (!k) {
    return 1;
  }
  long long b = power(a, k / 2);
  b = b * b % INF;
  if (k % 2) {
    return a * b % INF;
  } else {
    return b;
  }
}
vector<vector<long long> > gr;
vector<long long> p, r;
long long all_sz = 0;
long long get(long long v) { return (p[v] == v ? v : p[v] = get(p[v])); }
bool uni(long long v, long long u) {
  v = p[v];
  u = p[u];
  if (v == u) {
    return false;
  }
  if (r[v] == r[u]) {
    r[u]++;
  }
  if (r[v] > r[u]) {
    swap(v, u);
  }
  p[v] = u;
  all_sz--;
  return true;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  long long n, m, k;
  cin >> n >> m >> k;
  p.resize(n, 0);
  iota(p.begin(), p.end(), 0);
  r.resize(n, 0);
  vector<long long> c(n);
  for (long long i = 0; i < n; i++) {
    cin >> c[i];
  }
  long long all = power(2, n + k);
  gr.resize(n);
  map<long long, vector<pair<long long, long long> > > d;
  for (long long i = 0; i < m; i++) {
    long long v, u;
    cin >> v >> u;
    v--, u--;
    d[c[v] ^ c[u]].push_back({v, u});
  }
  long long bad = 0;
  for (auto pt : d) {
    all_sz = n;
    set<long long> used;
    for (auto t : pt.second) {
      long long v = t.first, u = t.second;
      used.insert(v);
      used.insert(u);
      if (get(v) == get(u)) continue;
      bad = (bad + power(2, all_sz - 1)) % INF;
      uni(v, u);
    }
    for (long long v : used) {
      p[v] = v;
      r[v] = 0;
    }
  }
  cout << (all - bad + INF) % INF;
}
