#include <bits/stdc++.h>
using namespace std;
const long long int MAX = 5e5;
const long long int mod = 1e9 + 7;
long long int power[MAX + 1];
long long int c[MAX + 1];
set<long long int> s;
vector<long long int> g[MAX + 1];
map<long long int, vector<long long int>> adj[MAX + 1];
map<long long int, bool> vis[MAX + 1];
map<long long int, long long int> tot;
map<long long int, long long int> comp;
void DFS(long long int v, long long int x) {
  vis[v][x] = true;
  tot[x]++;
  for (auto u : adj[v][x]) {
    if (!vis[u][x]) {
      DFS(u, x);
    }
  }
  return;
}
void solve() {
  long long int n, m, k;
  cin >> n >> m >> k;
  for (long long int j = 1; j <= n; j++) cin >> c[j];
  for (long long int j = 1; j <= m; j++) {
    long long int u, v;
    cin >> u >> v;
    s.insert(c[u] ^ c[v]);
    g[v].push_back(u);
    g[u].push_back(v);
    adj[u][c[u] ^ c[v]].push_back(v);
    adj[v][c[u] ^ c[v]].push_back(u);
  }
  for (long long int v = 1; v <= n; v++) {
    for (auto u : g[v]) {
      long long int x = c[u] ^ c[v];
      if (!vis[v][x]) {
        comp[x]++;
        DFS(v, x);
      }
    }
  }
  long long int ans =
      ((power[k] - (long long int)s.size() + mod) % mod) * (power[n]);
  if (ans >= mod) ans %= mod;
  for (auto x : s) {
    ans += power[n - tot[x]] * power[comp[x]];
    if (ans >= mod) ans %= mod;
  }
  cout << ans << "\n";
  return;
}
signed main() {
  ios::sync_with_stdio(0);
  cin.tie(NULL);
  cout.tie(NULL);
  long long int t;
  t = 1;
  power[0] = 1;
  for (long long int j = 1; j <= MAX; j++) {
    power[j] = power[j - 1] * 2;
    power[j] %= mod;
  }
  while (t--) {
    solve();
  }
  return 0;
}
