#include <bits/stdc++.h>
using namespace std;
using LLI = long long;
long long NWD(long long a, long long b) { return (b == 0) ? a : NWD(b, a % b); }
long long NWW(long long a, long long b) { return a / NWD(a, b) * b; }
const int N = 1e6 + 400, MOD = 1e9 + 7;
int n, m, k, R[N], rozm[N];
long long c[N], blep, pot[N];
bool czy[N];
vector<pair<long long, pair<int, int> > > T;
inline long long normalize(long long x) { return (x % MOD + MOD) % MOD; }
int Find(int w) { return (R[w] == w) ? w : R[w] = Find(R[w]); }
void Union(int a, int b) {
  a = Find(a);
  b = Find(b);
  if (a != b) {
    if (rozm[a] < rozm[b]) {
      R[a] = b;
      rozm[b] += rozm[a];
    } else {
      R[b] = a;
      rozm[a] += rozm[b];
    }
  }
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cin >> n >> m >> k;
  for (int i = 1; i <= n; i++) cin >> c[i], R[i] = i, rozm[i] = 1;
  pot[0] = 1;
  for (int i = 1; i <= n + k; i++) pot[i] = (pot[i - 1] * 2LL) % MOD;
  for (int i = 1; i <= m; i++) {
    int a, b;
    cin >> a >> b;
    T.push_back(make_pair(c[a] ^ c[b], make_pair(a, b)));
  }
  sort((T).begin(), (T).end());
  for (int i = 0; i < ((int)(T).size()); i++) {
    int j = i;
    while (j < ((int)(T).size()) && T[i].first == T[j].first) {
      Union(T[j].second.first, T[j].second.second);
      j++;
    }
    j = i;
    int r = 0;
    int S = 0;
    while (j < ((int)(T).size()) && T[i].first == T[j].first) {
      int x = Find(T[j].second.first);
      if (czy[x] == false) {
        r += rozm[x];
        S++;
        czy[x] = true;
      }
      j++;
    }
    j = i;
    blep = normalize(blep + normalize(normalize(pot[r] - pot[S]) * pot[n - r]));
    while (j < ((int)(T).size()) && T[i].first == T[j].first) {
      int a = T[j].second.first;
      int b = T[j].second.second;
      R[a] = a;
      rozm[a] = 1;
      czy[a] = false;
      R[b] = b;
      rozm[b] = 1;
      czy[b] = false;
      j++;
    }
    i = j - 1;
  }
  cout << normalize(pot[n + k] - blep) << endl;
  getchar();
  getchar();
  return 0;
}
