#include <bits/stdc++.h>
using namespace std;
const int MOD = 1e9 + 7;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  int n, m, k;
  cin >> n >> m >> k;
  vector<long long> a(n + 1);
  for (int i = 1; i <= n; i++) cin >> a[i];
  vector<vector<int>> gr(n + 1);
  unordered_map<long long, unordered_map<int, vector<int>>> rgr;
  unordered_map<long long, set<int>> sp;
  set<long long> vals;
  for (int i = 0; i < m; i++) {
    int x, y;
    cin >> x >> y;
    gr[x].push_back(y);
    gr[y].push_back(x);
    long long z = a[x] ^ a[y];
    rgr[z][x].push_back(y);
    rgr[z][y].push_back(x);
    vals.insert(z);
    sp[z].insert(x);
    sp[z].insert(y);
  }
  int N = 500000;
  vector<long long> tp(N + 1);
  tp[0] = 1;
  for (int i = 1; i <= N; i++) {
    tp[i] = tp[i - 1] * 2;
    tp[i] %= MOD;
  }
  vector<bool> vis(n + 1);
  long long ans = tp[k] - vals.size();
  ans %= MOD;
  if (ans < 0) ans += MOD;
  ans *= tp[n];
  ans %= MOD;
  for (long long z : vals) {
    auto grt = rgr[z];
    vector<int> allVis;
    int nct = 0, cct = 0;
    for (int i : sp[z]) {
      if (vis[i]) continue;
      nct++;
      cct++;
      vis[i] = 1;
      allVis.push_back(i);
      queue<int> q;
      q.push(i);
      while (q.size()) {
        int cur = q.front();
        q.pop();
        for (int y : grt[cur]) {
          if (!vis[y]) {
            vis[y] = 1;
            q.push(y);
            nct++;
            allVis.push_back(y);
          }
        }
      }
    }
    cct += n - nct;
    ans += tp[cct];
    ans %= MOD;
    for (int i : allVis) vis[i] = 0;
  }
  cout << ans;
  return 0;
}
