#include <bits/stdc++.h>
using namespace std;
long long bin_pow(long long a, long long b) {
  if (b == 0) return 1;
  if (b % 2 == 0) {
    long long t = bin_pow(a, b / 2);
    return t * t % 1000000007;
  } else
    return a * bin_pow(a, b - 1) % 1000000007;
}
vector<long long> graph[500000];
bool used[500000];
long long w[500000], comp;
map<pair<long long, long long>, long long> mp1;
void dfs(long long v) {
  used[v] = 1;
  comp++;
  for (auto u : graph[v]) {
    if (w[u] == 0 || used[u] || mp1[{u, v}] == 0) continue;
    dfs(u);
  }
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  long long t = 1, n, m, k = 0, sum = 0, l = 0, r = 0, x = 0, y = 0, z = 0,
            ans = 0, mn = LLONG_MAX, mx = LLONG_MIN;
  cin >> n >> m >> k;
  vector<long long> a(n), b;
  map<long long, vector<pair<long long, long long>>> mp;
  for (int i = 0; i < n; i++) cin >> a[i];
  for (int i = 0; i < m; i++) {
    cin >> x >> y;
    x--, y--;
    z = a[x] ^ a[y];
    b.push_back(z);
    mp[z].push_back({x, y});
    graph[x].push_back(y);
    graph[y].push_back(x);
  }
  sort(b.begin(), b.end());
  b.erase(unique(b.begin(), b.end()), b.end());
  for (int i = 0; i < b.size(); i++) {
    z = b[i];
    long long k1 = 0;
    l = 0;
    for (auto u : mp[z]) {
      x = u.first, y = u.second;
      w[x] = w[y] = 1;
      mp1[{x, y}] = mp1[{y, x}] = 1;
    }
    for (auto u : mp[z]) {
      x = u.first, y = u.second;
      if (used[x]) continue;
      comp = 0;
      dfs(x);
      l += comp;
      k1++;
    }
    x = bin_pow(2, n - l) * bin_pow(2, k1) % 1000000007;
    ans += x;
    ans %= 1000000007;
    for (auto u : mp[z]) {
      x = u.first, y = u.second;
      w[x] = w[y] = used[x] = used[y] = 0;
      mp1[{x, y}] = mp1[{y, x}] = 0;
    }
  }
  t = ((bin_pow(2, k) - (long long)b.size()) % 1000000007 + 1000000007) %
      1000000007;
  t *= bin_pow(2, n);
  t %= 1000000007;
  ans += t;
  ans %= 1000000007;
  cout << ans;
  return 0;
}
