#include <bits/stdc++.h>
using namespace std;
struct UF {
  long long comps;
  int n;
  map<int, int> p;
  UF() {}
  UF(int n) : n(n) { comps = n; }
  int find(int i) {
    if (!p.count(i)) p[i] = i;
    return (p[i] == i) ? i : (p[i] = find(p[i]));
  }
  void join(int i, int j) {
    p[find(i)] = p[find(j)];
    --comps;
  }
};
long long n, m, k, a, b;
long long num[500020];
map<long long, UF> mapa;
void join(long long a, long long b) {
  long long x = num[a] ^ num[b];
  if (!mapa.count(x)) mapa[x] = UF(n);
  UF &uf = mapa[x];
  if (uf.find(a) != uf.find(b)) uf.join(a, b);
}
long long binpow(long long x, long long p) {
  long long ans = 1;
  while (p) {
    if (p & 1LL) ans = (ans * x) % 1000000007;
    x = (x * x) % 1000000007;
    p >>= 1;
  }
  return ans % 1000000007;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cin >> n >> m >> k;
  for (int i = 1; i <= n; ++i) cin >> num[i];
  for (int i = 0; i < m; ++i) {
    cin >> a >> b;
    join(a, b);
  }
  long long ans = 0;
  for (auto p : mapa) {
    ans = (ans + binpow(2, p.second.comps)) % 1000000007;
  }
  long long sz = mapa.size();
  long long tot =
      ((((binpow(2, k) - sz) + 1000000007) % 1000000007) * binpow(2, n)) %
      1000000007;
  ans = (tot + ans) % 1000000007;
  cout << ans << endl;
  return 0;
}
