#include <bits/stdc++.h>
using namespace std;
int Rand(int x) { return rand() * rand() % x + 1; }
const int INF = 0x3f3f3f3f, N = 5000005, M = 2000005, MOD = 1e9 + 7;
long long qpow(long long a, long long b) {
  long long ret = 1;
  for (; b; b >>= 1, a = a * a % MOD)
    if (b & 1) ret = ret * a % MOD;
  return ret;
}
long long val[N];
map<int, int> g[N];
map<long long, int> has;
int find(int id, int x) {
  if (x == g[id][x]) return x;
  return g[id][x] = find(id, g[id][x]);
}
void Union(int id, int x, int y) {
  int fx = find(id, x), fy = find(id, y);
  if (fx == fy) return;
  g[id][fy] = fx;
}
int cnt[N], ss;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0), cout.tie(0);
  int n, m, c;
  cin >> n >> m >> c;
  for (int i = 1; i <= n; i++) cin >> val[i];
  long long ans = qpow(2, c) * qpow(2, n) % MOD;
  for (int i = 1; i <= m; i++) {
    int u, v;
    cin >> u >> v;
    long long x = val[u] ^ val[v];
    if (!has.count(x)) has[x] = ++ss, cnt[ss] = n;
    x = has[x];
    if (!g[x][u]) g[x][u] = u;
    if (!g[x][v]) g[x][v] = v;
    if (find(x, u) == find(x, v)) continue;
    Union(x, u, v);
    ans = (ans - qpow(2, cnt[x]) + MOD) % MOD;
    cnt[x]--;
    ans = (ans + qpow(2, cnt[x]) + MOD) % MOD;
  }
  cout << ans << endl;
  return 0;
}
