#include <bits/stdc++.h>
using namespace std;
const int Mod = 1000000000 + 7;
const int oo = 0x3f3f3f3f;
using pii = pair<int, int>;
using vi = vector<int>;
using LL = long long;
using QMax = priority_queue<int>;
using QMin = priority_queue<int, vector<int>, greater<int>>;
const int N = 500000 + 9;
int n, m, k;
map<LL, vector<pii>> mp;
LL res, c[N];
map<LL, LL> fa, vis;
LL fid(LL x) {
  if (fa[x] == x) return x;
  return fa[x] = fid(fa[x]);
}
void un(LL x, LL y) {
  x = fid(x);
  y = fid(y);
  fa[x] = y;
}
void add(LL &a, LL b) {
  a = a + b;
  if (a >= Mod) a -= Mod;
}
LL pw(LL a, LL b) {
  LL ret = 1;
  while (b) {
    if (b & 1) ret = ret * a % Mod;
    a = a * a % Mod;
    b >>= 1;
  }
  return ret;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  scanf("%d%d%d", &n, &m, &k);
  for (int i = 1; i <= n; i++) scanf("%I64d", &c[i]);
  ;
  for (int i = 1; i <= m; i++) {
    int u, v;
    scanf("%d%d", &u, &v);
    LL t = c[u] ^ c[v];
    mp[t].push_back({u, v});
  }
  LL cal = 0;
  for (auto i : mp) {
    cal++;
    LL least = 0, block = 0;
    vector<pii> &f = i.second;
    for (int j = 0; j < (int)f.size(); j++) {
      fa[f[j].first] = f[j].first;
      fa[f[j].second] = f[j].second;
    }
    least = n - fa.size();
    for (int j = 0; j < (int)f.size(); j++) {
      un(f[j].first, f[j].second);
    }
    for (int j = 0; j < (int)f.size(); j++) {
      if (!vis.count(f[j].first) && fid(f[j].first) == f[j].first) {
        vis[f[j].first] = 1;
        block++;
      }
      if (!vis.count(f[j].second) && fid(f[j].second) == f[j].second) {
        vis[f[j].second] = 1;
        block++;
      }
    }
    add(res, pw(2LL, block + least));
    fa.clear();
    vis.clear();
  }
  add(res, (pw(2, k) - cal) * pw(2LL, n) % Mod);
  printf("%I64d\n", res);
}
