#include <bits/stdc++.h>
using namespace std;
const int mod = 1e9 + 7;
const int maxn = 5e5 + 5;
int n, m, k;
long long a[maxn];
map<long long, int> vis;
vector<pair<int, int>> vec[maxn];
int tot = 0;
int fa[maxn];
long long power[maxn];
int find(int x) {
  if (fa[x] != x) fa[x] = find(fa[x]);
  return fa[x];
}
int main() {
  scanf("%d%d%d", &n, &m, &k);
  for (int i = 1; i <= n; i++) scanf("%lld", &a[i]);
  for (int i = 1; i <= m; i++) {
    int u, v;
    scanf("%d%d", &u, &v);
    if (vis[a[u] ^ a[v]] == 0) {
      vis[a[u] ^ a[v]] = ++tot;
      vec[tot].push_back(make_pair(u, v));
    } else
      vec[vis[a[u] ^ a[v]]].push_back(make_pair(u, v));
  }
  power[0] = 1;
  for (int i = 1; i <= n; i++) power[i] = power[i - 1] * 2 % mod;
  long long ans = ((1ll << k) - tot) % mod * power[n] % mod;
  for (int i = 1; i <= tot; i++) {
    int cnt = 0;
    for (int j = 0; j < vec[i].size(); j++) {
      fa[vec[i][j].first] = vec[i][j].first;
      fa[vec[i][j].second] = vec[i][j].second;
    }
    for (int j = 0; j < vec[i].size(); j++) {
      int fau = find(vec[i][j].first);
      int fav = find(vec[i][j].second);
      if (fau != fav) {
        fa[fau] = fav;
        cnt++;
      }
    }
    ans += power[n - cnt];
    ans %= mod;
  }
  printf("%lld\n", ans);
  return 0;
}
