#include <bits/stdc++.h>
using namespace std;
const int dx[8] = {0, -1, 0, 1, 1, -1, -1, 1};
const int dy[8] = {-1, 0, 1, 0, -1, -1, 1, 1};
const long long mod = 1000000007;
const int base = 311;
const int N = 6e5 + 5;
map<long long, vector<pair<int, int>>> e;
int n, m;
long long a[N];
vector<int> dsk[N];
long long pw[N];
int dd[N];
int k;
void dfs(int u, int &d) {
  dd[u] = 1;
  ++d;
  for (int v : dsk[u])
    if (!dd[v]) dfs(v, d);
}
void gogo() {
  cin >> n >> m >> k;
  for (int i = 1; i <= n; ++i) cin >> a[i];
  for (int i = 1; i <= m; ++i) {
    int u, v;
    cin >> u >> v;
    e[a[u] ^ a[v]].push_back(make_pair(u, v));
  }
  pw[0] = 1;
  for (int i = 1; i <= 6e5; ++i) pw[i] = pw[i - 1] * 2 % mod;
  long long ans = pw[k] * pw[n] % mod;
  for (auto it : e) {
    vector<pair<int, int>> tmp = it.second;
    for (pair<int, int> i : tmp) {
      dsk[i.first].push_back(i.second);
      dsk[i.second].push_back(i.first);
    }
    vector<int> cnt;
    for (pair<int, int> i : tmp) {
      int d = 0;
      if (!dd[i.first]) {
        dfs(i.first, d);
        cnt.push_back(d);
      }
    }
    int sum = 0;
    for (int i : cnt) sum += i;
    long long comp = n - sum + ((int)(cnt).size());
    ans = (ans - pw[n] + pw[comp] + mod * mod) % mod;
    for (pair<int, int> i : tmp) {
      dd[i.first] = dd[i.second] = 0;
      dsk[i.first].clear();
      dsk[i.second].clear();
    }
  }
  cout << ans;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  if (fopen("sol"
            ".inp",
            "r")) {
    freopen(
        "sol"
        ".inp",
        "r", stdin);
    freopen(
        "sol"
        ".out",
        "w", stdout);
  }
  gogo();
}
