#include <bits/stdc++.h>
using namespace std;
const int MX = 500005;
const long long MD = 1000000007;
int mul(int a, int b) { return ((long long)a * (long long)b) % MD; }
int pow(int a, int b) {
  int ans = 1;
  while (b > 0) {
    if (b % 2 == 1) {
      ans = mul(ans, a);
    }
    a = mul(a, a);
    b /= 2;
  }
  return ans;
}
long long c[MX];
map<long long, int> M;
int nxt = 0;
set<int> S[MX];
vector<pair<int, int>> SS[MX];
void add(long long &a, long long b) { a = (a + b) % MD; }
int dsu[MX];
int find(int i) {
  if (i == dsu[i]) return i;
  return dsu[i] = find(dsu[i]);
}
int merge(int u, int v) {
  u = find(u);
  v = find(v);
  if (u == v) return 0;
  dsu[u] = v;
  return 1;
}
int main() {
  ios::sync_with_stdio(false);
  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 u, v;
    cin >> u >> v;
    long long x = c[u] ^ c[v];
    if (M[x] == 0) {
      M[x] = ++nxt;
    }
    S[M[x]].insert(u);
    S[M[x]].insert(v);
    SS[M[x]].emplace_back(u, v);
  }
  for (int i = 1; i <= n; i++) dsu[i] = i;
  long long ans = 0;
  for (int i = 1; i <= nxt; i++) {
    int comps = n;
    for (auto p : SS[i]) {
      comps -= merge(p.first, p.second);
    }
    add(ans, pow(2, comps));
    for (int v : S[i]) {
      dsu[v] = v;
    }
  }
  int tmp = pow(2, n);
  int tmp2 = pow(2, k);
  tmp2 -= nxt;
  if (tmp2 < 0) tmp2 += MD;
  add(ans, mul(tmp, tmp2));
  cout << ans;
}
