#include <bits/stdc++.h>
using namespace std;
long long n, m, k, a, b, ans = 0, V = 1, f = 0;
long long v[500010], vis[500010]{0};
list<long long> g[500010];
unordered_map<long long, unordered_set<long long>> B;
unordered_set<long long> X;
void dfs(long long src, long long val) {
  vis[src] = V;
  for (auto it : g[src])
    if (vis[it] < V && (v[it] ^ v[src]) == val) dfs(it, val);
}
long long Pow(long long x, long long y) {
  if (x == 0) return x;
  if (y == 0) return 1;
  long long s = Pow(x, y / 2) % 1000000007;
  s = (s * s) % 1000000007;
  if (y & 1) s = (s * x % 1000000007) % 1000000007;
  return s % 1000000007;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cin >> n >> m >> k;
  long long one = 1;
  long long kk = one << k;
  for (long long i = 1; i <= n; i++) {
    cin >> v[i];
    if (!f) f = v[i];
  }
  for (long long i = 0; i < m; i++) {
    cin >> a >> b;
    g[a].push_back(b);
    g[b].push_back(a);
    long long x = v[a] ^ v[b];
    if (x > kk || x < 0) continue;
    X.insert(x);
    B[x].insert(a);
    B[x].insert(b);
  }
  for (auto it : B) {
    long long d = 0;
    for (auto i : it.second) {
      if (vis[i] < V) {
        dfs(i, it.first);
        d++;
      }
    }
    long long pp = d + n - it.second.size();
    ans = (ans + Pow(2, pp) % 1000000007) % 1000000007;
    V++;
  }
  long long sz = (kk - X.size()) % 1000000007;
  long long P = Pow(2, n) % 1000000007;
  P = (P * sz) % 1000000007;
  ans = (ans % 1000000007 + P) % 1000000007;
  cout << ans;
  return 0;
}
