#include <bits/stdc++.h>
using namespace std;
const int N = 500000;
int n, e;
vector<vector<int> > v;
vector<vector<pair<int, int> > > E;
map<long long, int> mp;
long long a[N];
int idx(long long x) {
  auto it = mp.insert(make_pair(x, -1)).first;
  if (it->second != -1) return it->second;
  it->second = v.size();
  v.push_back(vector<int>());
  E.push_back(vector<pair<int, int> >());
  return it->second;
}
const int M = 1000000007;
int Pow(int b, int p) {
  if (!p) return 1;
  long long z = Pow(b, p / 2);
  if (p & 1) return z * z % M * b % M;
  return z * z % M;
}
int p[N];
int find(int u) {
  if (p[u] == u) return u;
  return p[u] = find(p[u]);
}
int main() {
  int k;
  scanf("%d%d%d", &n, &e, &k);
  for (int i = 0; i < n; ++i) scanf("%lld", &a[i]);
  v.reserve(max(n, e));
  E.reserve(max(n, e));
  for (int u, v, i = 0; i < e; ++i) {
    scanf("%d%d", &u, &v);
    --u;
    --v;
    long long z = a[u] ^ a[v];
    int at = idx(z);
    ::v[at].push_back(u);
    ::v[at].push_back(v);
    E[at].push_back({u, v});
  }
  int bad = v.size();
  int res = ((Pow(2, k) - bad) % M + M) % M;
  res = (long long)res * Pow(2, n) % M;
  int cur = 0;
  for (auto &w : v) {
    sort(w.begin(), w.end());
    w.resize(unique(w.begin(), w.end()) - w.begin());
    for (int i = 0; i < w.size(); ++i) p[i] = i;
    int all = n;
    for (auto &e : E[cur]) {
      int a = lower_bound(w.begin(), w.end(), e.first) - w.begin();
      int b = lower_bound(w.begin(), w.end(), e.second) - w.begin();
      a = find(a);
      b = find(b);
      if (a != b) {
        p[a] = b;
        --all;
      }
    }
    res = (res + (long long)Pow(2, all)) % M;
    ++cur;
  }
  printf("%d\n", res);
  return 0;
}
