#include <bits/stdc++.h>
using namespace std;
long long int n, m, a[1000005];
vector<long long int> v[1000005];
map<long long int, long long int> mp;
pair<long long int, long long int> e[1000005];
long long int bexpo(long long int x, long long int n, long long int m) {
  long long int r = 1;
  while (n > 0) {
    if (n % 2) r = (r * x) % m;
    x = (x * x) % m;
    n = n / 2;
  }
  return r;
}
long long int id[1000005];
long long int sz[1000005];
void ini() {
  for (long long int i = 0; i < 1000005; i++) id[i] = i, sz[i] = 1;
}
long long int root(long long int i) {
  while (i != id[i]) id[i] = id[id[i]], i = id[i];
  return i;
}
void uni(long long int a, long long int b) {
  long long int ra = root(a);
  long long int rb = root(b);
  if (ra == rb) return;
  if (sz[ra] > sz[rb])
    id[rb] = ra, sz[ra] += sz[rb];
  else
    id[ra] = rb, sz[rb] += sz[ra];
}
set<long long int> st;
long long int c[1000005];
int main() {
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  long long int k;
  cin >> n >> m >> k;
  for (long long int i = 1; i <= n; i++) cin >> c[i];
  for (long long int i = 1; i <= m; i++) {
    long long int a, b;
    cin >> a >> b;
    e[i] = {a, b};
    mp[c[a] ^ c[b]] = 1;
  }
  long long int kk = 0;
  for (auto &w : mp) w.second = ++kk;
  for (long long int i = 1; i <= m; i++)
    v[mp[c[e[i].first] ^ c[e[i].second]]].push_back(i);
  long long int ans = bexpo(2, n, 1000000007);
  long long int tot = 1LL << k;
  tot %= 1000000007;
  tot = (tot - kk + 1000000007) % 1000000007;
  ans = (ans * tot) % 1000000007;
  ini();
  for (long long int i = 1; i <= kk; i++) {
    for (auto w : v[i]) {
      uni(e[w].first, e[w].second);
      st.insert(e[w].first);
      st.insert(e[w].second);
    }
    long long int temp = 1;
    for (auto w : st) {
      if (root(w) == w) {
        temp = temp * 2;
        temp %= 1000000007;
      }
    }
    temp = (temp * bexpo(2, n - (long long int)st.size(), 1000000007)) %
           1000000007;
    ans = (ans + temp) % 1000000007;
    for (auto w : st) {
      id[w] = w;
      sz[w] = 1;
    }
    st.clear();
  }
  cout << ans;
  return 0;
}
