#include <bits/stdc++.h>
using namespace std;
const int N = 5e5, M = 1e9 + 7;
int n, m, k, par[N], sz[N];
long long col[N];
map<long long, vector<pair<int, int>>> mp;
int get(int u) { return par[u] == u ? u : par[u] = get(par[u]); }
int power(int base, int to) {
  int ret = 1;
  while (to) {
    if (to & 1) ret = ret * 1LL * base % M;
    to >>= 1;
    base = base * 1LL * base % M;
  }
  return ret;
}
void add(int &a, int b) {
  a += b;
  if (a >= M) a -= M;
}
int main() {
  scanf("%d%d%d", &n, &m, &k);
  for (int i = 0; i < n; i++) scanf("%lld", col + i);
  for (int i = 0, a, b; i < m; i++) {
    scanf("%d%d", &a, &b);
    a--;
    b--;
    mp[col[a] ^ col[b]].push_back({a, b});
  }
  int ans = (((1LL << k) - mp.size()) % M) * power(2, n) % M;
  for (auto i : mp) {
    for (auto j : i.second)
      par[j.second] = j.second, par[j.first] = j.first,
      sz[j.first] = sz[j.second] = 1;
    for (auto j : i.second) {
      int a = get(j.first), b = get(j.second);
      if (a != b) {
        sz[a] += sz[b];
        par[b] = a;
      }
    }
    int temp = 0, comp = 1;
    for (auto j : i.second)
      for (int k = 0; k < 2; k++) {
        if (j.first == par[j.first]) {
          temp += sz[j.first];
          add(comp, comp);
          par[j.first] = -1;
        }
        swap(j.first, j.second);
      }
    add(ans, comp * 1LL * power(2, n - temp) % M);
  }
  printf("%d\n", ans);
}
