#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx")
using namespace std;
const int N = 500500;
const int Maxn = (5e8);
const long long INF = (1e17) + 777;
const int mod = 1e9 + 7;
long long a[500001];
map<long long, vector<pair<long long, long long> > > all;
set<long long> st;
long long pw[500001];
long long used[500001];
vector<long long> g[500001];
long long timer, sum;
long long ans;
void dfs(long long v) {
  sum++;
  used[v] = timer;
  for (auto to : g[v]) {
    if (used[to] != timer) dfs(to);
  }
}
int main() {
  ios_base::sync_with_stdio(0);
  long long n, m, k;
  cin >> n >> m >> k;
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
  }
  pw[0] = 1;
  for (int i = 1; i <= 500000; i++) pw[i] = (pw[i - 1] * 2ll) % mod;
  for (int i = 1; i <= m; i++) {
    long long x, y;
    cin >> x >> y;
    long long need = a[x] ^ a[y];
    all[need].push_back(make_pair(x, y));
    st.insert(need);
  }
  long long kol = (1ll << k) - st.size();
  kol %= mod;
  ans = (kol * pw[n]) % mod;
  for (auto to : st) {
    vector<int> qwe;
    for (auto df : all[to]) {
      long long x = df.first;
      long long y = df.second;
      g[x].push_back(y);
      g[y].push_back(x);
      qwe.push_back(x);
    }
    long long res = 0;
    sum = 0;
    timer++;
    for (auto qw : qwe) {
      if (used[qw] != timer) {
        dfs(qw);
        res++;
      }
    }
    for (auto df : all[to]) {
      long long x = df.first;
      long long y = df.second;
      g[x].clear();
      g[y].clear();
    }
    long long cur = pw[n - sum + res];
    ans = (ans + cur) % mod;
  }
  cout << ans - 1 + 2 - 1;
  return 0;
}
