#include <bits/stdc++.h>
using namespace std;
const int maxN = 5e5 + 9, MOD = 1e9 + 7;
struct Graph {
  vector<vector<int>> adj;
  long long key;
  map<int, int> mp;
  vector<bool> v;
  void insertNode(int nd) { mp[nd]; }
  void dfs(int nd) {
    v[nd] = 1;
    for (int sn : adj[nd]) {
      if (!v[sn]) {
        dfs(sn);
      }
    }
  }
  int countComp() {
    int ret = 0;
    for (int i = 0; i < mp.size(); i++) {
      if (v[i]) continue;
      ret++;
      dfs(i);
    }
    return ret;
  }
  void mapNodes() {
    int ct = 0;
    for (auto it = mp.begin(); it != mp.end(); it++) {
      it->second = ct++;
      adj.push_back(vector<int>());
      v.push_back(0);
    }
  }
  void putEdge(int u, int v) {
    adj[mp[u]].push_back(mp[v]), adj[mp[v]].push_back(mp[u]);
  }
} graphs[maxN];
int n, m, k;
int edges[maxN][2];
long long keys[maxN];
map<long long, int> tog;
long long fastPow(long long a, long long b) {
  long long ret = 1;
  while (b) {
    if (b & 1) ret = ret * a % MOD;
    b >>= 1, a = a * a % MOD;
  }
  return ret;
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0), cout.tie(0);
  cin >> n >> m >> k;
  for (int i = 0; i < n; i++) {
    cin >> keys[i];
  }
  int gc = 0;
  for (int i = 0; i < m; i++) {
    cin >> edges[i][0] >> edges[i][1];
    edges[i][0]--, edges[i][1]--;
    long long xx = keys[edges[i][0]] ^ keys[edges[i][1]];
    if (tog.find(xx) == tog.end()) {
      tog[xx] = gc++;
    }
    graphs[tog[xx]].insertNode(edges[i][0]);
    graphs[tog[xx]].insertNode(edges[i][1]);
  }
  for (int i = 0; i < gc; i++) {
    graphs[i].mapNodes();
  }
  for (int i = 0; i < m; i++) {
    long long xx = keys[edges[i][0]] ^ keys[edges[i][1]];
    graphs[tog[xx]].putEdge(edges[i][0], edges[i][1]);
  }
  long long ans =
      (fastPow(2, k) + MOD - tog.size()) % MOD * fastPow(2, n) % MOD;
  for (int i = 0; i < gc; i++) {
    ans = (ans + fastPow(2, graphs[i].countComp() + n - graphs[i].mp.size())) %
          MOD;
  }
  cout << ans << '\n';
}
