#include <bits/stdc++.h>
using namespace std;
template <typename Arg1>
void __f(const char* name, Arg1&& arg1) {
  cerr << name << " : " << arg1 << std::endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args) {
  const char* comma = strchr(names + 1, ',');
  cerr.write(names, comma - names) << " : " << arg1 << " | ";
  __f(comma + 1, args...);
}
const long long int mod = 1e9 + 7;
const long long int max_p = 308983067;
long long int x[2000010];
struct dsu {
  int comps;
  vector<int> P, rank;
  dsu(int n) : P(n), rank(n) {
    for (int i = 0; i < n; i++) {
      P[i] = i;
      rank[i] = 0;
    }
    comps = 0;
  }
  int fnd(int i) {
    if (i != P[i]) P[i] = fnd(P[i]);
    return P[i];
  }
  void join(int x, int y) {
    int PX = fnd(x);
    int PY = fnd(y);
    comps--;
    if (rank[PX] > rank[PY])
      P[PY] = PX;
    else
      P[PX] = PY;
    if (rank[PX] == rank[PY]) rank[PY] = rank[PX] + 1;
  }
};
map<long long int, int> e;
long long int pwm[2000010];
map<long long int, vector<pair<long long int, long long int> > > mpp;
vector<pair<int, int> > vct;
int main() {
  ios_base::sync_with_stdio(false);
  int n, m, k;
  cin >> n >> m >> k;
  pwm[0] = 1;
  for (int i = 1; i <= n; ++i) pwm[i] = (pwm[i - 1] * 2ll) % mod;
  for (int i = 1; i <= n; ++i) cin >> x[i];
  for (int i = 1, u, v; i <= m; ++i) {
    cin >> u >> v;
    vct.push_back({u, v});
    mpp[x[u] ^ x[v]].push_back({u, v});
  }
  int cnt = 0;
  long long int ans = ((((1ll << k) - mpp.size()) % mod) * pwm[n]) % mod;
  dsu d(n + 2);
  d.comps = n;
  for (auto i : mpp) {
    set<int> ss;
    for (auto j : i.second) {
      ss.insert(j.first);
      ss.insert(j.second);
      if (d.fnd(j.first) != d.fnd(j.second)) {
        d.join(j.first, j.second);
      }
    }
    ans = (ans + pwm[d.comps]) % mod;
    d.comps = n;
    for (auto j : ss) {
      d.P[j] = j;
      d.rank[j] = 0;
    }
  }
  cout << ans << endl;
}
