#include <bits/stdc++.h>
using namespace std;
const long long mod = 1e9 + 7;
long long fast_exp(long long b, long long e) {
  if (e == 0) return 1;
  long long ans = fast_exp(b, e / 2);
  ans = (ans * ans) % mod;
  if (e % 2 == 1) ans = (ans * b) % mod;
  return ans;
}
long long n, m, k, c[500010], pai[500010];
map<long long, vector<pair<long long, long long> > > M;
long long find_pai(long long x) {
  if (pai[x] == x) return x;
  return pai[x] = find_pai(pai[x]);
}
void solve() {
  cin >> n >> m >> k;
  for (long long i = 1; i <= n; i++) {
    cin >> c[i];
    pai[i] = i;
  }
  for (long long i = 1; i <= m; i++) {
    long long a, b;
    cin >> a >> b;
    M[c[a] ^ c[b]].push_back(make_pair(a, b));
  }
  long long ans = ((fast_exp(2, k) - M.size()) * fast_exp(2, n)) % mod;
  for (auto it = M.begin(); it != M.end(); it++) {
    set<long long> tem;
    auto aux = it->second;
    long long quant = n;
    for (auto u : aux) {
      long long a = u.first, b = u.second;
      tem.insert(a);
      tem.insert(b);
      long long A = find_pai(a), B = find_pai(b);
      if (A == B) continue;
      pai[B] = A;
      quant--;
    }
    ans += fast_exp(2, quant);
    ans %= mod;
    for (auto u : tem) pai[u] = u;
  }
  cout << ans;
}
signed main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  solve();
}
