#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
using namespace std;
const int N = 500005;
const int MOD = 1e9 + 7;
int i, n, m, k, rs, x, y;
long long val[N];
map<int, int> p;
map<long long, vector<pair<int, int>>> M;
int Pow(int a, int b) {
  int ans = 1;
  while (b) {
    if (b & 1) ans = ((long long)ans * a) % MOD, --b;
    a = ((long long)a * a) % MOD;
    b /= 2;
  }
  return ans;
}
int pfind(int x) {
  if (!p.count(x)) return p[x] = x;
  if (p[x] == x) return p[x] = x;
  return p[x] = pfind(p[x]);
}
void punite(int x, int y) {
  if (rand() & 1)
    p[pfind(x)] = pfind(y);
  else
    p[pfind(y)] = pfind(x);
}
int main() {
  scanf("%d %d %d", &n, &m, &k);
  rs = Pow(2, n + k);
  for (i = 1; i <= n; ++i) scanf("%lld", val + i);
  while (m--) {
    scanf("%d %d", &x, &y);
    M[val[x] ^ val[y]].push_back(make_pair(x, y));
  }
  for (auto it : M) {
    vector<pair<int, int>> v = it.second;
    x = n;
    p.clear();
    for (auto it : v)
      if (pfind(it.first) != pfind(it.second)) {
        punite(it.first, it.second);
        --x;
      }
    rs -= Pow(2, n);
    rs += Pow(2, x);
    if (rs < 0)
      rs += MOD;
    else
      rs %= MOD;
  }
  printf("%d\n", rs);
  return 0;
}
