#include <bits/stdc++.h>
using std::make_pair;
template <typename T>
inline T read() {
  T x = 0;
  char ch = std::getchar();
  bool f = 0;
  while (!std::isdigit(ch)) {
    f = (ch == '-');
    ch = std::getchar();
  }
  while (std::isdigit(ch)) {
    x = x * 10 + (ch - '0');
    ch = std::getchar();
  }
  return f ? -x : x;
}
template <typename T>
void print(T x) {
  if (x < 0) {
    x = -x;
    std::putchar('-');
  }
  if (x < 10) {
    std::putchar(x + 48);
    return;
  }
  print<T>(x / 10);
  std::putchar(x % 10 + 48);
  return;
}
namespace Solution {
using std::cin;
using std::cout;
using std::deque;
using std::endl;
using std::map;
using std::pair;
using std::queue;
using std::set;
using std::vector;
const int N = 500100, mod = 1e9 + 7;
int n, m, k, tot, f[N], ans;
long long c[N];
pair<int, int> p[N];
inline long long sn(pair<int, int> p) { return c[p.first] ^ c[p.second]; }
bool cmp(pair<int, int> a, pair<int, int> b) { return sn(a) < sn(b); }
int find(int x) { return x == f[x] ? x : f[x] = find(f[x]); }
int FQOW(int x) {
  int res = 1, I = 2;
  for (; x; x >>= 1, I = (long long)I * I % mod)
    if (x & 1) res = (long long)res * I % mod;
  return res;
}
void Fakemain() {
  std::ios::sync_with_stdio(false), std::cin.tie(0), std::cout.tie(0);
  cin >> n >> m >> k;
  for (int i = 1; i <= n; ++i) cin >> c[i];
  for (int i = 1; i <= m; ++i) cin >> p[i].first >> p[i].second;
  std::sort(p + 1, p + 1 + m, cmp);
  int s = 1;
  for (int i = 1; i <= n; ++i) f[i] = i;
  for (int i = 2; i <= m; ++i)
    if (sn(p[i - 1]) != sn(p[i])) {
      tot++;
      int sum = n;
      for (int j = s; j <= i - 1; ++j)
        if (find(p[j].first) != find(p[j].second))
          --sum, f[find(p[j].first)] = find(p[j].second);
      ans = ((long long)ans + FQOW(sum)) % mod;
      for (int j = s; j <= i - 1; ++j)
        f[p[j].first] = p[j].first, f[p[j].second] = p[j].second;
      s = i;
    }
  int sum = n;
  tot++;
  for (int j = s; j <= m; ++j)
    if (find(p[j].first) != find(p[j].second))
      --sum, f[find(p[j].first)] = find(p[j].second);
  ans = ((long long)ans + FQOW(sum)) % mod;
  ans = ((long long)ans +
         (FQOW(k) - tot + mod) % mod * (long long)FQOW(n) % mod) %
        mod;
  cout << ans;
  return;
}
}  // namespace Solution
int main(int argc, char* argv[]) {
  Solution::Fakemain();
  return 0;
}
