#include <bits/stdc++.h>
using namespace std;
const int MOD = 1e9 + 7;
long long key[500000], ckey[500000];
int color[500000];
vector<tuple<long long, int, int>> P;
map<long long, pair<set<int>, int>> cnt;
long long fast_pow(long long a, long long b) {
  long long ret = 1;
  for (; b; b >>= 1) {
    if (b & 1) {
      ret *= a;
      ret %= MOD;
    }
    a *= a;
    a %= MOD;
  }
  return ret;
}
int find_(int a, long long key) {
  if (ckey[a] != key || color[a] == a) {
    ckey[a] = key;
    return color[a] = a;
  }
  return color[a] = find_(color[a], key);
}
void union_(int a, int b, long long key) {
  a = find_(a, key);
  b = find_(b, key);
  color[a] = color[b] = min(a, b);
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  ((void)0);
  ((void)0);
  int N, M, K;
  long long ans;
  memset(ckey, -1, sizeof(ckey));
  cin >> N >> M >> K;
  P.resize(M);
  ans = fast_pow(2, N);
  for (int i = 0; i < N; i++) {
    cin >> key[i];
  }
  for (auto &[k, a, b] : P) {
    cin >> a >> b;
    k = key[--a] ^ key[--b];
  }
  sort(P.begin(), P.end());
  for (auto &[key, a, b] : P) {
    if (ckey[a] != key && ckey[b] != key) {
      cnt[key].second++;
      union_(a, b, key);
    } else if (ckey[a] != key || ckey[b] != key) {
      union_(a, b, key);
    } else if (find_(a, key) != find_(b, key)) {
      union_(a, b, key);
      cnt[key].second--;
    }
    cnt[key].first.insert(a);
    cnt[key].first.insert(b);
  }
  ans *= ((1LL << K) - cnt.size()) % MOD;
  ans %= MOD;
  for (auto &[a, b] : cnt) {
    ans += fast_pow(2, N - b.first.size() + b.second);
    ans %= MOD;
  }
  cout << ans << '\n';
  return 0;
}
