#include <bits/stdc++.h>
const int inf = (1ll << 30) - 1;
const int maxn = (int)1e5 + 10;
using namespace std;
int n;
int k;
int m;
map<long long, vector<int> > M;
long long a[500500], b[500500], c[500500], P[500500];
long long mod = 1000 * 1000 * 1000 + 7;
int p[500500];
long long ans = 0;
int SZ;
void clr(int x) { p[x] = x; }
int get(int x) {
  if (p[x] == x) return x;
  return p[x] = get(p[x]);
}
void merge(int x, int y) {
  x = get(x);
  y = get(y);
  if (x == y) return;
  SZ--;
  p[x] = y;
}
void solve() {
  cin >> n >> m >> k;
  for (int i = 0; i < n; i++) {
    scanf("%lld", &c[i]);
    p[i] = i;
  }
  for (int i = 0; i < m; i++) {
    scanf("%lld%lld", &a[i], &b[i]);
    --a[i];
    --b[i];
    long long d = c[a[i]] ^ c[b[i]];
    M[d].push_back(i);
  }
  long long g = (1ll << k) - M.size();
  P[0] = 1;
  for (int i = 1; i <= n; i++) {
    P[i] = P[i - 1] * 2 % mod;
  }
  ans = (g % mod * P[n]) % mod;
  for (__typeof(M.begin()) it = M.begin(); it != M.end(); it++) {
    SZ = n;
    for (__typeof(it->second.begin()) it2 = it->second.begin();
         it2 != it->second.end(); it2++) {
      merge(a[*it2], b[*it2]);
    }
    ans = (ans + P[SZ]) % mod;
    for (__typeof(it->second.begin()) it2 = it->second.begin();
         it2 != it->second.end(); it2++) {
      clr(a[*it2]);
      clr(b[*it2]);
    }
  }
  cout << ans << "\n";
}
int main() {
  int t = 1;
  for (int i = 1; i <= t; i++) {
    solve();
  }
  return 0;
}
