#include <bits/stdc++.h>
using namespace std;
constexpr int mod = 1e9 + 7, maxn = 5e5 + 10;
int n, m, k, pow2[maxn] = {};
long long vals[maxn];
void dfs(const int cur, map<int, vector<int>>& vec, map<int, bool>& viz) {
  viz[cur] = true;
  for (auto next : vec[cur])
    if (!viz[next]) dfs(next, vec, viz);
}
int find_solution_for(set<int>& nodes, map<int, vector<int>>& vec) {
  int ret = pow2[n - nodes.size()];
  map<int, bool> viz;
  for (auto x : nodes)
    if (!viz[x]) {
      ret = (2 * ret) % mod;
      dfs(x, vec, viz);
    }
  return ret;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin >> n >> m >> k;
  set<long long> possible_vals;
  map<long long, set<int>> all_nodes;
  map<long long, map<int, vector<int>>> all_vec;
  for (int i = 1; i <= n; ++i) cin >> vals[i];
  for (int i = 0, x, y; i < m; ++i) {
    cin >> x >> y;
    possible_vals.insert(vals[x] ^ vals[y]);
    all_nodes[vals[x] ^ vals[y]].insert(x);
    all_nodes[vals[x] ^ vals[y]].insert(y);
    all_vec[vals[x] ^ vals[y]][x].push_back(y);
    all_vec[vals[x] ^ vals[y]][y].push_back(x);
  }
  pow2[0] = 1;
  for (int i = 1; i < maxn; ++i) pow2[i] = (2 * pow2[i - 1]) % mod;
  int ret = ((((1ll << k) - possible_vals.size()) % mod) * pow2[n]) % mod;
  for (auto pv : possible_vals)
    ret = (ret + find_solution_for(all_nodes[pv], all_vec[pv])) % mod;
  cout << ret << endl;
  return 0;
}
