#include <bits/stdc++.h>
using namespace std;
const int mod = 1000000007;
const int Maxn = 500005;
map<long long, int> mp;
vector<pair<int, int> > g[Maxn];
long long c[Maxn];
int pw2[Maxn] = {1}, par[Maxn], n, m, k, sz, ans;
int find(int u) { return par[u] == u ? u : par[u] = find(par[u]); }
int main() {
  scanf("%d%d%d", &n, &m, &k);
  for (int i = 1; i <= n; i++) pw2[i] = pw2[i - 1] * 2 % mod;
  for (int i = 1; i <= n; i++) scanf("%lld", &c[i]);
  for (int i = 1; i <= n; i++) par[i] = i;
  for (int x, y; m--;) {
    scanf("%d%d", &x, &y);
    if (!mp[c[x] ^ c[y]]) mp[c[x] ^ c[y]] = ++sz;
    g[mp[c[x] ^ c[y]]].push_back(make_pair(x, y));
  }
  for (int i = 1; i <= sz; ++i) {
    int s = n;
    for (int j = 0; j < g[i].size(); j++) {
      int x = find(g[i][j].first), y = find(g[i][j].second);
      if (x ^ y) par[x] = y, s--;
    }
    ans = (ans + pw2[s]) % mod;
    for (int j = 0; j < g[i].size(); j++)
      par[g[i][j].first] = g[i][j].first, par[g[i][j].second] = g[i][j].second;
  }
  ans = (ans + (long long)((1ll << k) - sz + mod) % mod * pw2[n] % mod) % mod;
  printf("%d\n", ans);
  return 0;
}
