#include <bits/stdc++.h>
using namespace std;
const int N = 5e5 + 5;
const int mod = 1e9 + 7;
void add(int &x, int y) {
  x += y;
  if (x >= mod) x -= mod;
}
int mul(int x, int y) { return (long long)x * y % mod; }
int n, m, k;
long long c[N];
int pw[N], par[N];
vector<int> buf;
map<long long, vector<pair<int, int>>> vals;
int anc(int u) {
  if (par[u] == u) return u;
  buf.push_back(u);
  par[u] = anc(par[u]);
  return par[u];
}
bool join(int u, int v) {
  u = anc(u), v = anc(v);
  if (u == v) return 0;
  par[v] = u;
  buf.push_back(v);
  return 1;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin >> n >> m >> k;
  pw[0] = 1;
  for (int i = 1; i < N; ++i) pw[i] = mul(pw[i - 1], 2);
  for (int i = 1; i <= n; ++i) {
    cin >> c[i];
    par[i] = i;
  }
  for (int i = 1; i <= m; ++i) {
    int u, v;
    cin >> u >> v;
    vals[c[u] ^ c[v]].push_back({u, v});
  }
  int res = 0;
  for (auto val : vals) {
    auto &edges = val.second;
    for (int v : buf) par[v] = v;
    buf.clear();
    int comp = n;
    for (auto edge : edges) comp -= join(edge.first, edge.second);
    add(res, pw[comp]);
  }
  int coef = pw[k];
  add(coef, mod - vals.size());
  coef = mul(coef, pw[n]);
  add(res, coef);
  cout << res << '\n';
}
