#include <bits/stdc++.h>
using namespace std;
struct krawedz {
  int a;
  int b;
  long long xr;
};
krawedz kra[1000002];
bool srt(krawedz a, krawedz b) { return a.xr < b.xr; }
long long c[1000002], akt[1000002];
int ojc[1000002];
long long pop = -1, mod = 1000000007;
void aktu(int n) {
  if (akt[n] != pop) {
    ojc[n] = n;
    akt[n] = pop;
    return;
  }
  if (ojc[ojc[n]] != ojc[n]) {
    aktu(ojc[n]);
    ojc[n] = ojc[ojc[n]];
  }
}
int pot(int a, int b) {
  if (b == 0) return 1;
  long long res = pot(a, b / 2);
  res *= res;
  if (b % 2 == 1) res *= a;
  res %= mod;
  return res;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  int n, m, k;
  cin >> n >> m >> k;
  for (int i = 1; i <= n; i++) {
    cin >> c[i];
  }
  for (int i = 0; i < m; i++) {
    int a, b;
    cin >> a >> b;
    kra[i] = {a, b, c[a] ^ c[b]};
  }
  sort(kra, kra + m, srt);
  long long wyn = 0;
  int sp = 0, ile = 0;
  for (int i = 0; i < m; i++) {
    if (kra[i].xr != pop) {
      if (pop != -1) {
        wyn += pot(2, sp);
        wyn %= mod;
      }
      sp = n;
      ile++;
    }
    pop = kra[i].xr;
    aktu(kra[i].a);
    aktu(kra[i].b);
    if (ojc[kra[i].a] != ojc[kra[i].b]) {
      ojc[ojc[kra[i].a]] = ojc[kra[i].b];
      sp--;
    }
  }
  if (pop != -1) {
    wyn += pot(2, sp);
    wyn %= mod;
  }
  long long reszta = (1ll << k);
  reszta -= ile;
  reszta %= mod;
  wyn += reszta * pot(2, n);
  wyn %= mod;
  cout << wyn;
}
