#include <bits/stdc++.h>
using namespace std;
const int M = 1e9 + 7;
long long addM(long long a, long long b) { return (a + b) % M; }
long long mulM(long long a, long long b) { return (a * b) % M; }
long long powM(long long x, long long e) {
  long long res = 1;
  while (e > 0) {
    if (e & 0x1) {
      res = mulM(res, x);
    }
    x = mulM(x, x);
    e >>= 1;
  }
  return res;
}
class Solution {
 public:
  long long count(vector<pair<int, int>>& edges, vector<long long>& ks, int n,
                  int k) {
    auto cmp = [&](const pair<int, int>& l, const pair<int, int>& r) {
      return (ks[l.first] ^ ks[l.second]) < (ks[r.first] ^ ks[r.second]);
    };
    sort(edges.begin(), edges.end(), cmp);
    vector<vector<int>> graph(n);
    map<long long, vector<int>> sets;
    for (auto& p : edges) {
      int u = p.first, v = p.second;
      long long x = ks[u] ^ ks[v];
      sets[x].push_back(u);
      sets[x].push_back(v);
      graph[u].push_back(v);
      graph[v].push_back(u);
    }
    vector<int> time(n, 0);
    int clock = 0;
    map<long long, int> cnts;
    vector<int> next(n, 0);
    for (auto& p : sets) {
      long long x = p.first;
      auto& nodes = p.second;
      sort(nodes.begin(), nodes.end());
      nodes.erase(unique(nodes.begin(), nodes.end()), nodes.end());
      int cnt = 0;
      ++clock;
      for (auto u : nodes) {
        if (time[u] == clock) {
          continue;
        }
        ++cnt;
        dfs(u, -1, graph, next, time, clock, x, ks);
      }
      cnts[x] = cnt;
    }
    long long res = 0;
    long long kn = 1ULL << k;
    kn = (kn - sets.size()) % M;
    res = addM(res, mulM(powM(2, n), kn));
    for (auto& p : sets) {
      long long x = p.first;
      auto& nodes = p.second;
      long long m = n - nodes.size() + cnts[x];
      res = addM(res, powM(2, m));
    }
    return res;
  }

 private:
  void dfs(int u, int p, vector<vector<int>>& graph, vector<int>& next,
           vector<int>& time, int clock, long long x, vector<long long>& ks) {
    if (time[u] >= clock) {
      assert(time[u] == clock);
      return;
    }
    time[u] = clock;
    for (int& i = next[u]; i < graph[u].size(); ++i) {
      int v = graph[u][i];
      if (v == p) {
        continue;
      }
      long long diff = ks[u] ^ ks[v];
      if (diff > x) {
        break;
      }
      if (diff == x) {
        dfs(v, u, graph, next, time, clock, x, ks);
      }
    }
  }
};
int main(int argc, char** argv) {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n, m, k;
  cin >> n >> m >> k;
  vector<long long> ks(n);
  for (int i = 0; i < n; ++i) {
    cin >> ks[i];
  }
  vector<pair<int, int>> edges;
  edges.reserve(m);
  for (int i = 0, x = 0, y = 0; i < m; ++i) {
    cin >> x >> y;
    edges.emplace_back(x - 1, y - 1);
  }
  Solution sol;
  cout << sol.count(edges, ks, n, k) << endl;
  return 0;
}
