#include <bits/stdc++.h>
using namespace std;
int n, m, k;
vector<int> g[500005];
long long c[500005];
map<long long, vector<pair<int, int> > > xx;
int mod = 1e9 + 7;
int T = 0;
int was[500005];
int cnt = 0;
void dfs(int v) {
  cnt++;
  was[v] = T;
  for (auto to : g[v]) {
    if (was[to] != T) dfs(to);
  }
}
int bp(int a, int b) {
  if (b == 0) return 1;
  if (b & 1) return 1ll * a * bp(a, b - 1) % mod;
  return bp(1ll * a * a % mod, b / 2);
}
int main() {
  ios::sync_with_stdio(0);
  cin >> n >> m >> k;
  for (int i = 0; i < n; i++) cin >> c[i + 1];
  for (int i = 0; i < m; i++) {
    int a, b;
    cin >> a >> b;
    if ((c[a] ^ c[b]) < (1ll << k)) xx[c[a] ^ c[b]].push_back({a, b});
  }
  long long ans = 0;
  for (auto &xq : xx) {
    vector<int> vv;
    for (auto &e : xq.second) {
      vv.push_back(e.first);
      vv.push_back(e.second);
      g[e.first].push_back(e.second);
      g[e.second].push_back(e.first);
    }
    T++;
    int cnt_mini = n;
    int dp1 = 1;
    int dp2 = 0;
    for (auto v : vv) {
      cnt = 0;
      if (was[v] != T) {
        dfs(v);
        cnt_mini -= cnt;
        dp2 = (1ll * dp1 * ((bp(2, cnt) - 2 + mod) % mod) +
               1ll * dp2 * bp(2, cnt)) %
              mod;
        dp1 = (1ll * dp1 * 2) % mod;
      }
    }
    dp2 = (1ll * dp2 * bp(2, cnt_mini)) % mod;
    ans = (ans + dp2) % mod;
    for (auto &e : xq.second) {
      g[e.first].clear();
      g[e.second].clear();
    }
  }
  cout << (1ll * bp(2, n) * bp(2, k) - ans + mod) % mod;
  return 0;
}
