#include <bits/stdc++.h>
using namespace std;
const long long N = 1e6 + 10;
const long long MOD = 1e9 + 7;
struct edge {
  long long u, v;
  edge(long long u = 0, long long v = 0) : u(u), v(v) {}
} e[N];
long long n, ne, k;
long long c[N];
long long power[N];
map<long long, vector<long long> > mp;
long long root[N];
int findSet(long long u) {
  if (root[u] != u) root[u] = findSet(root[u]);
  return root[u];
}
bool unite(long long u, long long v) {
  u = findSet(u);
  v = findSet(v);
  if (u == v) return false;
  root[u] = v;
  return true;
}
long long does(vector<long long> ed) {
  vector<long long> ver;
  for (auto i : ed) {
    ver.push_back(e[i].u);
    ver.push_back(e[i].v);
  }
  long long ntt = n;
  for (auto i : ed) {
    ntt -= unite(e[i].u, e[i].v);
  }
  for (auto u : ver) {
    root[u] = u;
  }
  return power[ntt];
}
long long powermod(long long a, long long p) {
  long long res = 1;
  while (p) {
    if (p & 1) res = 1LL * res * a % MOD;
    a = a * a % MOD;
    p /= 2;
  }
  return res;
}
int main() {
  ios ::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cin >> n >> ne >> k;
  for (long long i = 1; i <= n; i++) {
    cin >> c[i];
  }
  for (long long i = 1; i <= ne; i++) {
    long long u, v;
    cin >> u >> v;
    e[i] = edge(u, v);
  }
  power[0] = 1;
  for (long long u = 1; u <= n; u++) {
    root[u] = u;
    power[u] = power[u - 1] * 2 % MOD;
  }
  set<long long> s;
  for (long long i = 1; i <= ne; i++) {
    long long u = e[i].u;
    long long v = e[i].v;
    s.insert(c[u] ^ c[v]);
    mp[c[u] ^ c[v]].push_back(i);
  }
  long long ret = 0;
  for (auto P : mp) {
    ret += does(P.second);
    ret %= MOD;
  }
  ret += (((((1LL << k)) - s.size()) % MOD) * power[n]) % MOD;
  ret %= MOD;
  cout << ret;
  return 0;
}
