#include <bits/stdc++.h>
using namespace std;
const long long N = 501105;
long long n, m, k, c[N], now, component, p[N], mod = 1e9 + 7, ans;
map<long long, vector<long long> > g[N];
map<long long, vector<long long> > a;
map<long long, bool> mark[N];
map<long long, bool> o;
vector<long long> color;
void dfs(long long v, long long rang) {
  now++;
  mark[v][rang] = 1;
  for (long long i = 0; i < g[v][rang].size(); i++) {
    long long u = g[v][rang][i];
    if (mark[u][rang]) continue;
    dfs(u, rang);
  }
}
int main() {
  p[0] = 1;
  for (long long i = 1; i < N; i++) p[i] = (p[i - 1] * 2) % mod;
  scanf("%lld%lld%lld", &n, &m, &k);
  for (long long i = 1; i <= n; i++) scanf("%lld", &c[i]);
  for (long long i = 1; i <= m; i++) {
    long long u, v, x;
    scanf("%lld%lld", &u, &v);
    x = c[u] xor c[v];
    g[v][x].push_back(u), g[u][x].push_back(v);
    if (!o[x]) color.push_back(x);
    a[x].push_back(v);
    a[x].push_back(u);
    o[x] = 1;
  }
  for (long long i = 0; i < color.size(); i++) {
    long long x = color[i];
    component = now = 0;
    for (long long j = 0; j < a[x].size(); j++) {
      long long v = a[x][j];
      if (mark[v][x]) continue;
      dfs(v, x);
      component++;
    }
    long long q = n - now + component;
    ans = (ans + p[q]) % mod;
  }
  ans = (ans + ((p[k] - color.size() + mod) * (p[n])) % mod) % mod;
  cout << ans;
}
