#include <bits/stdc++.h>
const long long MXN = 5e6 + 200;
const long long MNN = 1e3 + 1;
const long long MOD = 1e9 + 7;
const long long INF = 1e18;
const long long OO = 1e9 + 500;
using namespace std;
long long b[MXN], u, v, n, m, k, ans, pr[MXN];
vector<pair<int, int> > p[MXN];
set<int> st;
map<long long, int> c;
long long binpow(long long a, long long b) {
  if (b == 0) {
    return 1;
  }
  if (b % 2 == 1) {
    return binpow(a, b - 1) * a % MOD;
  } else {
    long long x = binpow(a, b / 2);
    return x * x % MOD;
  }
}
int get_p(int x) {
  if (pr[x] == x) return x;
  return pr[x] = get_p(pr[x]);
}
int main() {
  ios_base::sync_with_stdio(0), cout.tie(0), cin.tie(0);
  ;
  set<long long> st;
  cin >> n >> m >> k;
  for (int i = 1; i <= n; i++) {
    cin >> b[i];
    pr[i] = i;
  }
  int cnt = 1;
  for (int i = 1; i <= m; i++) {
    cin >> u >> v;
    long long x = (b[u] ^ b[v]);
    if (c[x] == 0) {
      c[x] = cnt;
      cnt++;
    }
    p[c[x]].push_back(make_pair(u, v));
  }
  for (int i = 1; i < cnt; i++) {
    int sz = 0;
    for (int j = 0; j < p[i].size(); j++) {
      int u = p[i][j].first, v = p[i][j].second;
      st.insert(u);
      st.insert(v);
      if (get_p(u) != get_p(v)) {
        pr[pr[v]] = pr[u];
        sz++;
      }
    }
    ans = (ans + binpow(2, n - sz)) % MOD;
    while (st.size()) {
      int x = *(st.begin());
      pr[x] = x;
      st.erase(st.begin());
    }
  }
  cout << ((binpow(2, k) - cnt + 1) % MOD * binpow(2, n) + ans) % MOD;
  return 0;
}
