#include <bits/stdc++.h>
using namespace std;
using lli = long long int;
using pii = pair<int, int>;
using vi = vector<int>;
using vb = vector<bool>;
using vvi = vector<vector<int>>;
using vlli = vector<long long int>;
using vpii = vector<pair<int, int>>;
const int N = 500005;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
lli n, m, k, u, v, x, ans, curr, T;
vlli c(N);
lli fast_exp(lli base, lli exp) {
  lli res = 1;
  base = base % 1000000007;
  while (exp > 0) {
    if (exp % 2) res = (res * base) % 1000000007;
    base = (base * base) % 1000000007;
    exp /= 2;
  }
  return res % 1000000007;
}
template <class T>
struct DSU {
  map<T, T> par;
  T comp_sz = n;
  T get(T u) {
    if (par.find(u) == par.end()) return u;
    return par[u] = get(par[u]);
  }
  void unite(T x, T y) {
    T X = get(x), Y = get(y);
    if (X == Y) return;
    par[X] = Y;
    --comp_sz;
  }
};
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cin >> n >> m >> k;
  map<lli, DSU<lli>> virus;
  for (int i = 1; i <= n; i++) cin >> c[i];
  for (int i = 1; i <= m; i++) {
    cin >> u >> v;
    x = c[u] ^ c[v];
    virus[x].unite(u, v);
  }
  ans = ((fast_exp(2, k) - virus.size() + 1000000007) * fast_exp(2, n)) %
        1000000007;
  for (auto i : virus) {
    curr = (i.second).comp_sz;
    ans = (ans + fast_exp(2, curr)) % 1000000007;
  }
  cout << ans;
}
