#include <bits/stdc++.h>
using namespace std;
const double pi = acos(-1.0);
const int INF = 0x3f3f3f3f;
const int MOD = 1e9 + 7;
const double EPS = 1e-9;
int n, m;
long long k, c[500015];
map<long long, int> mmp;
long long mpow(long long x, long long y) {
  long long res = 1;
  while (y) {
    if (y & 1) res = res * x % MOD;
    x = x * x % MOD;
    y >>= 1;
  }
  return res;
}
vector<int> vec;
int p[500015];
void ini() {
  for (int i = 0; i < vec.size(); ++i) {
    int x = vec[i];
    p[x] = x;
  }
}
int Find(int x) { return x == p[x] ? x : p[x] = Find(p[x]); }
bool uni(int x, int y) {
  x = Find(x), y = Find(y);
  if (x == y) return false;
  p[x] = y;
  return true;
}
int u[500015], v[500015];
vector<int> e[500015];
int main() {
  scanf("%d%d%lld", &n, &m, &k);
  for (int i = 1; i <= n; ++i) {
    scanf("%lld", &c[i]);
  }
  for (int i = 1; i <= m; ++i) {
    scanf("%d%d", &u[i], &v[i]);
    mmp[c[u[i]] ^ c[v[i]]];
  }
  int cnt = 0;
  for (map<long long, int>::iterator it = mmp.begin(); it != mmp.end(); ++it) {
    it->second = ++cnt;
  }
  for (int i = 1; i <= m; ++i) {
    e[mmp[c[u[i]] ^ c[v[i]]]].push_back(i);
  }
  long long K = 1ll << k;
  long long ans = (K - mmp.size()) % MOD * mpow(2, n) % MOD;
  for (int i = 1; i <= n; ++i) vec.push_back(i);
  for (int i = 1; i <= cnt; ++i) {
    ini();
    vec.clear();
    int tcnt = n;
    for (int j = 0; j < e[i].size(); ++j) {
      int id = e[i][j];
      vec.push_back(u[id]), vec.push_back(v[id]);
      tcnt -= uni(u[id], v[id]);
    }
    ans += mpow(2, tcnt);
  }
  printf("%lld\n", (ans % MOD + MOD) % MOD);
  return 0;
}
