#include <bits/stdc++.h>
using namespace std;
const int BigInt = 2000 * 1000 * 1000;
const int magic = 1000 * 1000 * 1000 + 7;
const bool debug = false;
const int maxn = 500100;
long long p2[maxn];
int n, m, k;
long long cs[maxn];
map<long long, vector<pair<int, int> > > allEdges;
struct DSU {
  unordered_map<int, int> gs;
  unordered_map<int, int> ss;
  int get(int v) {
    auto it = gs.find(v);
    if (it != gs.end()) {
      int res = it->second;
      return v == res ? v : (gs[v] = this->get(res));
    }
    gs[v] = v;
    ss[v] = 1;
    return v;
  }
  int unite(int a, int b) {
    a = this->get(a);
    b = this->get(b);
    if (a == b) return a;
    if (ss[a] >= ss[b]) {
      ss[a] += ss[b];
      gs[b] = a;
      return a;
    } else {
      ss[b] += ss[a];
      gs[a] = b;
      return b;
    }
  }
  vector<int> allSizes() {
    vector<int> res;
    for (auto [v, p] : this->gs)
      if (v == p) res.push_back(ss[v]);
    return res;
  }
};
int main() {
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  cin >> n >> m >> k;
  for (int i = 1; i <= n; i++) cin >> cs[i];
  p2[0] = 1;
  for (int i = 1; i <= n + 50; i++) p2[i] = (p2[i - 1] * 2) % magic;
  for (int i = 0; i < m; i++) {
    int u, v;
    cin >> u >> v;
    long long dif = cs[u] ^ cs[v];
    allEdges[dif].push_back({u, v});
  }
  long long totalBad = 0;
  for (const auto& [dif, edges] : allEdges) {
    DSU dsu;
    for (const auto& [u, v] : edges) dsu.unite(u, v);
    if (debug) {
      cout << "Processing dif=" << dif << endl;
      cout << "DSU: " << endl;
      for (auto [v, p] : dsu.gs)
        cout << v << " " << p << " " << dsu.ss[v] << endl;
      cout << "DSU end" << endl;
    }
    vector<int> allSizes = dsu.allSizes();
    int count = allSizes.size();
    int sum = 0;
    for (int size : allSizes) sum += size;
    int restCount = n - sum;
    long long curBad1 = (p2[sum] - p2[count] + magic) % magic;
    long long curBad2 = (curBad1 * p2[restCount]) % magic;
    if (debug)
      cout << "Dif: " << dif << ", sum: " << sum << ", count: " << count
           << ", curBad1: " << curBad1 << ", curBad2: " << curBad2 << endl;
    totalBad = (totalBad + curBad2) % magic;
    if (debug) cout << endl;
  }
  long long total = (p2[n] * p2[k]) % magic;
  long long answer = (total - totalBad + magic) % magic;
  cout << answer << endl;
  return 0;
}
