#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int MOD = (ll)1e9 + 7;
const int MAXN = 5000001;
map<ll, int> compress;
map<int, vector<int>> edges[MAXN];
vector<int> pw;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(nullptr);
  pw.resize(MAXN);
  pw[0] = 1;
  for (int i = 1; i < MAXN; ++i) {
    pw[i] = pw[i - 1] * 2;
    pw[i] %= MOD;
  }
  int n, m, k;
  cin >> n >> m >> k;
  vector<ll> c(n);
  for (int i = 0; i < n; ++i) {
    cin >> c[i];
  }
  int id = 0;
  for (int i = 0; i < m; ++i) {
    int v, u;
    cin >> v >> u;
    --v;
    --u;
    ll x = c[v] ^ c[u];
    auto it = compress.find(x);
    int idx;
    if (it == compress.end()) {
      idx = id;
      compress.emplace(x, id++);
    } else {
      idx = it->second;
    }
    edges[idx][v].push_back(u);
    edges[idx][u].push_back(v);
  }
  vector<int> used(n, -1);
  int vtx = n;
  function<void(int, int)> dfs = [&](const int v, const int x) {
    used[v] = x;
    --vtx;
    for (auto to : edges[x][v]) {
      if (used[to] == x) {
        continue;
      }
      dfs(to, x);
    }
  };
  ll f = pw[k] - id;
  if (f < 0) f += MOD;
  ll ret = (ll)f * pw[n];
  ret %= MOD;
  int comp = 0;
  for (int i = 0; i < id; ++i) {
    comp = 0;
    vtx = n;
    for (auto it : edges[i]) {
      if (used[it.first] == i) {
        continue;
      }
      dfs(it.first, i);
      ++comp;
    }
    ll add = (ll)pw[comp] * pw[vtx];
    add %= MOD;
    ret += add;
    if (ret >= MOD) {
      ret -= MOD;
    }
  }
  cout << ret << endl;
  return 0;
}
