#include <bits/stdc++.h>
using namespace std;
long long n, m, k, X[1000010], L[1000010], R[1000010], Fa[1000010], _2[1000010],
    tim = 0;
map<long long, long long> hsh;
vector<long long> V[1000010];
long long getf(long long x) { return Fa[x] == x ? x : Fa[x] = getf(Fa[x]); }
signed main() {
  scanf("%lld%lld%lld", &n, &m, &k);
  _2[0] = 1;
  for (long long i = 1; i < 1000010; i++) _2[i] = _2[i - 1] * 2 % 1000000007;
  for (long long i = 1; i <= n; i++) scanf("%lld", &X[i]);
  for (long long i = 1; i <= m; i++) {
    scanf("%lld%lld", &L[i], &R[i]);
    long long t = X[L[i]] ^ X[R[i]];
    if (!hsh.count(t)) hsh[t] = ++tim;
    V[hsh[t]].push_back(i);
  }
  long long ans = (_2[k] - tim) * _2[n] % 1000000007;
  for (long long i = 1; i <= tim; i++) {
    vector<long long> Vx;
    Vx.clear();
    long long tot = 0;
    for (long long j = 0; j < V[i].size(); j++) {
      long long a = L[V[i][j]], b = R[V[i][j]];
      Fa[a] = a;
      Fa[b] = b;
      Vx.push_back(a);
      Vx.push_back(b);
    }
    tot = 0;
    for (long long j = 0; j < V[i].size(); j++) {
      long long a = L[V[i][j]], b = R[V[i][j]];
      if (getf(a) != getf(b)) {
        tot++;
        Fa[getf(a)] = getf(b);
      }
    }
    ans = (ans + _2[n - tot]) % 1000000007;
  }
  printf("%lld\n", (ans % 1000000007 + 1000000007) % 1000000007);
}
