#include <bits/stdc++.h>
using namespace std;
const int mod = 1e9 + 7;
int expmod(int a, int b) {
  int rlt = 1;
  while (b) {
    if (b & 1) rlt = 1ll * a * rlt % mod;
    a = 1ll * a * a % mod;
    b >>= 1;
  }
  return rlt;
}
map<long long, int> mp;
int n, m, k;
long long c[505050];
vector<pair<int, int> > u[505050];
vector<int> v[505050];
int id[505050 << 1];
bool vis[505050];
int q[505050];
int solve(vector<pair<int, int> > &u) {
  int sz = u.size();
  assert(sz);
  int e = 0;
  for (int i = 0; i < sz; i++) id[++e] = u[i].first, id[++e] = u[i].second;
  sort(id + 1, id + e + 1);
  int ee = 0;
  for (int i = 1; i <= e; i++)
    if (i == 1 || id[i] != id[i - 1]) id[++ee] = id[i];
  e = ee;
  for (int i = 0; i < sz; i++) {
    v[u[i].first].push_back(u[i].second);
    v[u[i].second].push_back(u[i].first);
  }
  int tot = n;
  for (int i = 1; i <= e; i++)
    if (!vis[id[i]]) {
      int g = 0;
      q[++g] = id[i];
      vis[id[i]] = 1;
      for (int f = 1; f <= g; f++) {
        int x = q[f];
        for (int i = 0; i < v[x].size(); i++) {
          int y = v[x][i];
          if (vis[y]) continue;
          q[++g] = y;
          vis[y] = 1;
        }
      }
      tot -= g - 1;
    }
  for (int i = 1; i <= e; i++) v[id[i]].clear(), vis[id[i]] = 0;
  return expmod(2, tot);
}
int main() {
  scanf("%d %d %d", &n, &m, &k);
  for (int i = 1; i <= n; i++) scanf("%I64d", &c[i]);
  int e = 0;
  for (int i = 1, x, y; i <= m; i++) {
    scanf("%d %d", &x, &y);
    assert(c[x] != c[y]);
    long long val = c[x] ^ c[y];
    if (!mp.count(val)) mp[val] = ++e;
    u[mp[val]].push_back(make_pair(x, y));
  }
  int ans = 0;
  ans = 1ll * (expmod(2, k) - e + mod) * expmod(2, n) % mod;
  for (int i = 1; i <= e; i++) ans = (ans + solve(u[i])) % mod;
  printf("%d\n", ans);
  return 0;
}
