#include <bits/stdc++.h>
using namespace std;
const int M = 5e5 + 10;
const long long Mod = 1e9 + 7;
long long n, m, k;
long long C[M], ans;
set<int> rec, kua;
int f[M];
int find(int a) { return f[a] == a ? a : f[a] = find(f[a]); }
void merge(int a, int b) {
  rec.insert(a);
  rec.insert(b);
  a = find(a);
  b = find(b);
  if (a != b) f[a] = b;
}
long long fpow(long long a, long long b) {
  long long ans = 1;
  for (; b; b >>= 1, a = (a * a) % Mod) {
    if (b & 1) ans = (ans * a) % Mod;
  }
  return ans;
}
struct edge {
  int u, v;
  long long w;
  void in() {
    scanf("%d%d", &u, &v);
    w = C[u] ^ C[v];
  }
  edge() {}
  edge(int a, int b, long long c) : u(a), v(b), w(c) {}
  bool operator<(const edge &a) const { return w < a.w; }
} E[M];
void turn_back() {
  for (auto a : rec) f[a] = a;
  rec.clear();
  kua.clear();
}
int main() {
  scanf("%I64d%I64d%I64d", &n, &m, &k);
  for (int i = 1; i <= n; i++) scanf("%I64d\n", &C[i]), f[i] = i;
  for (int i = 1; i <= m; i++) E[i].in();
  sort(E + 1, E + m + 1);
  long long last = 0, All = fpow(2ll, n);
  for (int i = 1, j; i <= m;) {
    ans = (ans + All * ((E[i].w - last) % Mod) % Mod) % Mod;
    last = E[i].w;
    for (j = i; j <= m && E[j].w == last; j++) {
      merge(E[j].u, E[j].v);
    }
    for (j = i; j <= m && E[j].w == last; j++) {
      int a = find(E[j].u), b = find(E[j].v);
      kua.insert(a);
      kua.insert(b);
    }
    i = j;
    ans = (ans + (fpow(2ll, n + kua.size() - rec.size()) % Mod)) % Mod;
    turn_back();
    ++last;
  }
  ans = (ans + All * ((fpow(2ll, k) - last) % Mod + Mod) % Mod) % Mod;
  printf("%I64d\n", ans);
  return 0;
}
