#include <bits/stdc++.h>
using namespace std;
const int MOD = 1e9 + 7;
const int C = 26;
void add(int& x, int y) {
  x += y;
  while (x >= MOD) x -= MOD;
  while (x < 0) x += MOD;
}
int fix(int x) {
  while (x >= MOD) x -= MOD;
  while (x < 0) x += MOD;
  return x;
}
int pw(int a, int b) {
  int ret = 1;
  while (b) {
    if (b & 1) ret = 1ll * ret * a % MOD;
    b >>= 1;
    a = 1ll * a * a % MOD;
  }
  return ret;
}
int mul(int a, int b) { return (long long)a * b % MOD; }
const int MAXN = 1e6 + 10;
long long n, m, k, c[MAXN];
int vec[MAXN], sec[MAXN];
vector<int> g[MAXN];
map<long long, vector<pair<int, int>>> bad;
void dfs(int u) {
  sec[u] = 1;
  for (int v : g[u])
    if (!sec[v]) dfs(v);
}
int go(vector<pair<int, int>>& edges) {
  int sz = 0;
  for (auto& [u, v] : edges) {
    vec[sz++] = u;
    vec[sz++] = v;
  }
  sort(vec, vec + sz);
  sz = unique(vec, vec + sz) - vec;
  for (auto& [u, v] : edges) {
    u = lower_bound(vec, vec + sz, u) - vec;
    v = lower_bound(vec, vec + sz, v) - vec;
  }
  for (int i = 0; i < sz; i++) {
    g[i].clear();
  }
  for (auto& [u, v] : edges) {
    g[u].push_back(v);
    g[v].push_back(u);
  }
  memset(sec, 0, 4 * sz);
  int r = 1;
  for (int i = 0; i < sz; i++) {
    if (!sec[i]) {
      r = mul(r, 2);
      dfs(i);
    }
  }
  r = mul(r, pw(2, n - sz));
  return r;
}
void solve() {
  cin >> n >> m >> k;
  for (int i = 0; i < n; i++) {
    cin >> c[i];
  }
  for (int i = 0, u, v; i < m; i++) {
    cin >> u >> v;
    --u, --v;
    bad[c[u] ^ c[v]].emplace_back(u, v);
  }
  int ans = 0;
  for (auto& xx : bad) {
    int r = go(xx.second);
    add(ans, r);
  }
  int others = pw(2, k);
  add(others, -(int)bad.size());
  others = mul(others, pw(2, n));
  add(ans, others);
  cout << ans << "\n";
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int te = 1;
  for (int w = 1; w <= te; w++) {
    solve();
  }
  return 0;
}
