#include <bits/stdc++.h>
using namespace std;
const long long Mod = 1000000007LL, INF = 1e9, LINF = 1e18;
const long double PI = 3.141592653589793116, EPS = 1e-9,
                  GOLD = ((1 + sqrt(5)) / 2);
long long keymod[] = {1000000007LL, 1000000009LL, 1000000021LL, 1000000033LL};
vector<long long> HashMod(keymod, keymod + sizeof(keymod) / sizeof(long long));
template <class T>
int getbit(T s, int i) {
  return (s >> i) & 1;
}
template <class T>
T onbit(T s, int i) {
  return s | (T(1) << i);
}
template <class T>
T offbit(T s, int i) {
  return s & (~(T(1) << i));
}
template <class T>
int cntbit(T s) {
  return __builtin_popcount(s);
}
auto TimeStart = chrono::steady_clock::now();
auto TimeEnd = chrono::steady_clock::now();
void ControlIO(int argc, char* argv[]);
void TimerStart();
void TimerStop();
void Exit();
long long n, m, k, u, v;
vector<long long> c;
map<long long, vector<pair<long long, long long>>> edge;
long long modPow(long long a, long long b) {
  if (b == 0) return 1;
  if (b == 1) return a;
  long long tmp = modPow(a, b / 2);
  if (b % 2 == 0) return ((tmp * tmp) % Mod);
  return ((((tmp * tmp) % Mod) * a) % Mod);
}
pair<long long, long long> graphDiagnosis(long long key) {
  set<long long> vertex;
  map<long long, vector<long long>> Adj;
  for (auto z : edge[key]) {
    vertex.insert(z.first);
    vertex.insert(z.second);
    Adj[z.first].push_back(z.second);
    Adj[z.second].push_back(z.first);
  }
  long long cc = 0, Rem = n - vertex.size();
  queue<long long> Q;
  while (!vertex.empty()) {
    Q.push(*vertex.begin());
    vertex.erase(vertex.begin());
    cc++;
    while (!Q.empty()) {
      long long z = Q.front();
      Q.pop();
      for (auto t : Adj[z]) {
        if (vertex.find(t) == vertex.end()) continue;
        vertex.erase(t);
        Q.push(t);
      }
    }
  }
  return make_pair(cc, Rem);
}
void Input() {
  cin >> n >> m >> k;
  c.resize(n);
  for (long long i = 0; i < n; i++) cin >> c[i];
  while (m--) {
    cin >> u >> v;
    u--;
    v--;
    edge[c[u] ^ c[v]].push_back(make_pair(u, v));
  }
}
void Solve() {
  long long siz = edge.size();
  long long ans = (modPow(2, n) * ((modPow(2, k) - siz + Mod * 4) % Mod)) % Mod;
  for (auto it = edge.begin(); it != edge.end(); it++) {
    long long key = it->first;
    pair<long long, long long> x = graphDiagnosis(key);
    long long cc = x.first, Rem = x.second;
    ans += (modPow(2, cc) * modPow(2, Rem)) % Mod;
    ans %= Mod;
  }
  cout << ans;
}
int main(int argc, char* argv[]) {
  ios_base::sync_with_stdio(0);
  cin.tie(NULL);
  ControlIO(argc, argv);
  Input();
  TimerStart();
  Solve();
  TimerStop();
  return 0;
}
void ControlIO(int argc, char* argv[]) {}
void TimerStart() {}
void TimerStop() {}
void Exit() {
  TimerStop();
  exit(0);
}
