#include <bits/stdc++.h>
using namespace std;
const int MX = 5e5 + 7;
const long long M = 1e9 + 7;
vector<int> g[MX];
long long c[MX];
bool us[MX];
long long pw[MX];
map<long long, set<int>> vx;
void dfs(int v, long long x) {
  us[v] = true;
  for (int& u : g[v])
    if (!us[u] && (c[v] ^ c[u]) == x) dfs(u, x);
}
void solve() {
  for (long long i = 0, val = 1; i < MX; ++i, val = (val * 2) % M) pw[i] = val;
  int n, m, k;
  cin >> n >> m >> k;
  for (int(i) = 0; (i) < (n); ++(i)) cin >> c[i];
  for (int(i) = 0; (i) < (m); ++(i)) {
    int v, u;
    cin >> v >> u;
    --v;
    --u;
    g[v].push_back(u);
    g[u].push_back(v);
    long long xr = c[v] ^ c[u];
    vx[xr].insert(v);
    vx[xr].insert(u);
  }
  long long ans = 0;
  int cor_xors = 0;
  for (auto& i : vx) {
    long long x = i.first;
    if (x >= (1LL << k)) continue;
    ++cor_xors;
    int cnt = 0;
    for (const int& j : i.second)
      if (!us[j]) {
        ++cnt;
        dfs(j, x);
      }
    for (const int& j : i.second) us[j] = false;
    ans = (ans + pw[cnt] * pw[n - (int)(i.second).size()]) % M;
  }
  cout << (((1LL << k) - cor_xors) % M * pw[n] % M + ans) % M;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  solve();
}
