#include <bits/stdc++.h>
const long long int MOD = 1000000007ll;
const int mxsz = 500005;
const int LG = 30;
using namespace std;
long long int n, m, k;
long long int ar[mxsz];
long long int arr[mxsz], sz[mxsz];
long long int power(long long int x, long long int y, long long int mod) {
  long long int res = 1;
  x %= mod;
  while (y > 0) {
    if (y % 2LL == 1) {
      res = (res * x) % mod;
    }
    y = y / 2LL;
    x = (x * x) % mod;
  }
  return res;
}
int root(int n) {
  if (arr[n] == n) {
    return n;
  } else {
    return arr[n] = root(arr[n]);
  }
}
void unionxy(int x, int y) {
  x = root(x);
  y = root(y);
  if (x == y) {
    return;
  }
  if (sz[x] > sz[y]) {
    swap(x, y);
  }
  sz[y] += sz[x];
  arr[x] = y;
}
int main() {
  std::ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cin >> n >> m >> k;
  long long int pw[mxsz];
  for (long long int i = 0; i < mxsz; i++) {
    pw[i] = power(2LL, i, MOD);
    pw[i] %= MOD;
  }
  for (int i = 1; i <= n; i++) {
    cin >> ar[i];
  }
  set<long long int> st;
  vector<pair<long long int, pair<int, int> > > vt;
  for (int i = 1; i <= m; i++) {
    int a, b;
    cin >> a >> b;
    st.insert(ar[a] ^ ar[b]);
    vt.push_back(make_pair(ar[a] ^ ar[b], make_pair(a, b)));
  }
  sort(vt.begin(), vt.end());
  long long int ans = 0;
  ans += ((pw[k] % MOD - st.size() + MOD) % MOD * pw[n] % MOD) % MOD;
  ans %= MOD;
  for (int i = 1; i <= n; i++) {
    sz[i] = 1;
    arr[i] = i;
  }
  for (int i = 0; i < m; i++) {
    int j = i;
    while (j < m && vt[i].first == vt[j].first) {
      j++;
    }
    vector<long long int> vp;
    for (int k = i; k < j; k++) {
      unionxy(vt[k].second.first, vt[k].second.second);
      vp.push_back(vt[k].second.first);
      vp.push_back(vt[k].second.second);
    }
    long long int cnt = 0, total = 0;
    for (int k = 0; k < vp.size(); k++) {
      if (arr[vp[k]] == vp[k]) {
        cnt++;
        total += (long long int)sz[vp[k]];
      }
      sz[vp[k]] = 1;
      arr[vp[k]] = -1;
    }
    cnt += (n - total + MOD);
    cnt %= MOD;
    ans += pw[cnt] % MOD;
    ans %= MOD;
    for (int k = 0; k < vp.size(); k++) {
      sz[vp[k]] = 1;
      arr[vp[k]] = vp[k];
    }
    i = j - 1;
  }
  cout << ans % MOD;
  return 0;
}
