#include <bits/stdc++.h>
using namespace std;
const int mod = (1e9) + 7;
const double eps = 1e-6;
const int siz = 5e5 + 5, siz2 = 1049659, siz3 = 5032108;
int n, m, k, ver[siz], iter = 1, co;
long long c[siz];
vector<int> adj[siz];
unordered_map<long long, unordered_map<int, vector<int>>> xcomp;
int mul(long long a, int b) { return (a * b) % mod; }
int add(int a, int b) { return (a + b) % mod; }
int sub(int a, int b) { return (a - b + mod) % mod; }
int modpow(int x, int y) {
  if (y == 0) {
    return 1;
  }
  int p = modpow(x, y / 2);
  p = mul(p, p);
  return y % 2 ? mul(x, p) : p;
}
void dfs(int node, unordered_map<int, vector<int>>& xadj) {
  ver[node] = iter;
  co++;
  for (auto a : xadj[node]) {
    if (ver[a] != iter) {
      dfs(a, xadj);
    }
  }
}
int main() {
  scanf("%d%d%d", &n, &m, &k);
  for (int i = 1; i <= n; i++) {
    scanf("%I64d", &c[i]);
  }
  for (int i = 0; i < m; i++) {
    int u, v;
    scanf("%d%d", &u, &v);
    adj[u].push_back(v);
    adj[v].push_back(u);
  }
  for (int i = 1; i <= n; i++) {
    for (auto a : adj[i]) {
      long long x = c[i] ^ c[a];
      xcomp[x][i].push_back(a);
    }
  }
  long long ans = 0;
  for (auto x : xcomp) {
    auto& comp = x.second;
    int compco = 0;
    for (auto node : comp) {
      if (ver[node.first] != iter) {
        dfs(node.first, comp);
        compco++;
      }
    }
    ans = add(ans, mul(modpow(2, n - co), modpow(2, compco)));
    co = 0;
    iter++;
  }
  ans = add(ans, mul(modpow(2, n), sub(modpow(2, k), (int)xcomp.size())));
  printf("%d\n", ans);
  return 0;
}
