#include <bits/stdc++.h>
using namespace std;
vector<vector<int>> gr;
vector<long long> c;
vector<int> parent;
vector<int> size;
vector<char> used;
void make_set(int v) {
  parent[v] = v;
  size[v] = 1;
}
int find_set(int v) {
  if (v == parent[v]) return v;
  return parent[v] = find_set(parent[v]);
}
void union_sets(int a, int b) {
  a = find_set(a);
  b = find_set(b);
  if (a != b) {
    if (size[a] < size[b]) swap(a, b);
    parent[b] = a;
    size[a] += size[b];
  }
}
long long binpow(long long a, int n) {
  long long res = 1;
  while (n) {
    if (n & 1) {
      res *= a;
      res %= 1000000007;
    }
    a *= a;
    a %= 1000000007;
    n >>= 1;
  }
  return res;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int n, m;
  long long k;
  cin >> n >> m >> k;
  c.resize(n);
  for (int i = 0; i < n; ++i) cin >> c[i];
  vector<map<long long, int>> adjacent(n);
  vector<pair<int, int>> edges(m);
  parent.resize(m);
  size.resize(m);
  used.resize(m, 0);
  for (int i = 0; i < m; ++i) {
    make_set(i);
    int a, b;
    cin >> a >> b;
    --a, --b;
    edges[i].first = a;
    edges[i].second = b;
  }
  for (int i = 0; i < m; ++i) {
    int from = edges[i].first;
    int to = edges[i].second;
    long long xr = c[to] ^ c[from];
    {
      auto found = adjacent[from].find(xr);
      if (found != adjacent[from].end()) {
        union_sets(i, found->second);
      } else {
        adjacent[from][xr] = i;
      }
    }
    {
      auto found = adjacent[to].find(xr);
      if (found != adjacent[to].end()) {
        union_sets(i, found->second);
      } else {
        adjacent[to][xr] = i;
      }
    }
  }
  vector<set<int>> subgraphs(m);
  for (int i = 0; i < m; ++i) {
    int comp = find_set(i);
    int from = edges[i].first;
    int to = edges[i].second;
    subgraphs[comp].insert(from);
    subgraphs[comp].insert(to);
  }
  long long ans = binpow(2, n + k);
  map<long long, long long> q;
  for (int i = 0; i < m; ++i) {
    int comp = find_set(i);
    if (!used[comp]) {
      used[comp] = 1;
      int from = edges[i].first;
      int to = edges[i].second;
      long long xr = c[to] ^ c[from];
      q[xr] += subgraphs[comp].size() - 1;
    }
  }
  for (auto it = q.begin(); it != q.end(); ++it) {
    ans -= binpow(2, n);
    if (ans < 0) ans += 1000000007;
    ans += binpow(2, n - it->second);
    ans %= 1000000007;
  }
  cout << ans << '\n';
  return 0;
}
