#include <bits/stdc++.h>
using namespace std;
long long power(long long a, long long b, long long mod) {
  long long c = 1;
  while (b > 0) {
    if (b % 2) c *= a, c %= mod;
    b /= 2;
    a *= a;
    a %= mod;
  }
  return c;
}
const long long N = (5e5) + 10;
const long long M = 320;
const long long Mod = 1e9 + 7;
long long c[N], two[N];
map<long long, vector<pair<long long, long long> > > mp;
long long parent[N];
long long baap(long long a) {
  if (parent[a] == a) return a;
  parent[a] = baap(parent[a]);
  return parent[a];
}
void unionk(long long a, long long b) {
  long long pa = baap(a);
  long long push_back = baap(b);
  if (pa != push_back) {
    parent[pa] = push_back;
  }
}
long long go(vector<pair<long long, long long> > v) {
  set<long long> s;
  for (auto z : v) s.insert(z.first), s.insert(z.second);
  map<long long, long long> m1;
  long long i, j, k;
  i = 0;
  for (auto z : s) {
    m1[z] = ++i;
  }
  j = (long long)(s).size();
  for (i = 1; i <= j; i++) parent[i] = i;
  for (auto z : v) {
    unionk(m1[z.first], m1[z.second]);
  }
  long long dec = 0;
  for (i = 1; i <= j; i++)
    if (parent[i] == i) dec++;
  dec = j - dec;
  return dec;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cout << setprecision(25);
  long long n, m, k, i, j, a, b, d;
  cin >> n >> m >> k;
  two[0] = 1;
  for (i = 1; i <= max(n, k); i++) two[i] = (two[i - 1] * 2) % Mod;
  for (i = 1; i <= n; i++) cin >> c[i];
  for (i = 1; i <= m; i++) {
    cin >> a >> b;
    d = c[a] ^ c[b];
    mp[d].push_back({a, b});
  }
  long long ans = 0;
  for (auto z : mp) {
    long long dec = go(z.second);
    ans += two[n - dec];
    ans %= Mod;
  }
  ans += (((two[k] - (long long)(mp).size() + Mod) % Mod) * two[n]) % Mod;
  ans %= Mod;
  cout << ans << '\n';
  return 0;
}
