#include <bits/stdc++.h>
using namespace std;
const long long maxn = 5e5 + 11;
const long long mod = 1e9 + 7;
map<long long, vector<long long> > mp;
long long n, m, k, uu[maxn], vv[maxn];
long long a[maxn], po2[maxn], ans;
vector<long long> g[maxn];
bool vis[maxn];
long long dfs(long long u, long long xo) {
  vis[u] = 1;
  long long ret = 1;
  for (auto &v : g[u]) {
    if (!vis[v] and (a[u] ^ a[v]) == xo) ret += dfs(v, xo);
  }
  return ret;
}
int32_t main() {
  ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  po2[0] = 1LL;
  for (long long i = 1; i < maxn; i++) po2[i] = (2LL * po2[i - 1]) % mod;
  cin >> n >> m >> k;
  for (long long i = 0; i < n; i++) cin >> a[i];
  for (long long i = 0; i < m; i++) {
    cin >> uu[i] >> vv[i];
    uu[i]--, vv[i]--;
    g[uu[i]].emplace_back(vv[i]);
    g[vv[i]].emplace_back(uu[i]);
    mp[a[uu[i]] ^ a[vv[i]]].emplace_back(i);
  }
  for (auto &[xo, vec] : mp) {
    long long rem = n;
    for (auto idx : vec) {
      if (!vis[uu[idx]]) rem -= dfs(uu[idx], xo) - 1;
      if (!vis[vv[idx]]) rem -= dfs(vv[idx], xo) - 1;
    }
    for (auto idx : vec) {
      vis[uu[idx]] = 0;
      vis[vv[idx]] = 0;
    }
    ans += po2[rem];
    ans %= mod;
  }
  ans += (po2[k] - (long long)mp.size()) * (po2[n]) % mod;
  ans %= mod;
  while (ans < 0) ans += mod;
  cout << ans << endl;
}
