#include <bits/stdc++.h>
using namespace std;
int n, m, k;
long long c[500050], e[500050];
int u[500050], v[500050];
int vis[500050];
int T;
int id[500050];
const int mod = 1e9 + 7;
bool cmp(int i, int j) { return e[i] < e[j]; }
long long expmod(long long a, long long b, long long mod) {
  long long rlt = 1;
  for (a %= mod; b; a = a * a % mod, b >>= 1)
    if (b & 1) rlt = rlt * a % mod;
  return rlt;
}
int rt[500050];
int findroot(int x) {
  if (vis[x] < T) {
    vis[x] = T, rt[x] = x;
    return x;
  }
  if (rt[x] != x) rt[x] = findroot(rt[x]);
  return rt[x];
}
int main() {
  scanf("%d%d%d", &n, &m, &k);
  for (int i = 1; i <= n; i++) scanf("%I64d", &c[i]);
  for (int i = 1; i <= m; i++) {
    scanf("%d%d", &u[i], &v[i]);
    e[i] = c[u[i]] ^ c[v[i]];
  }
  for (int i = 1; i <= m; i++) id[i] = i;
  sort(id + 1, id + m + 1, cmp);
  int ans = 0, cnt = 0;
  long long sum = 1ll << k;
  for (int i = 1; i <= m; i++) {
    if (i == 1 || e[id[i]] != e[id[i - 1]]) {
      if (i > 1) ans = (ans + expmod(2, cnt, mod)) % mod;
      cnt = n;
      sum--;
      T++;
    }
    int j = id[i];
    int x = findroot(u[j]), y = findroot(v[j]);
    if (x != y) {
      cnt--;
      rt[x] = y;
    }
  }
  if (m) ans = (ans + expmod(2, cnt, mod)) % mod;
  ans = (ans + expmod(2, n, mod) * (sum % mod)) % mod;
  cout << ans << endl;
}
