#include <bits/stdc++.h>
using namespace std;

#define ll long long

ll mod = (int) 1e9 + 7;

ll modpow(ll a, ll b) {
	ll res = 1;
	while (b) {
		if (b % 2 == 1) res = (res*a) % mod;
		a = (a*a)%mod;
		b /= 2;
	}
	return res;
}

struct Graph {
	int N;
	vector<pair<int,int>> e;

	Graph(vector<pair<int, int>> e, int N) : N(N), e(e) { }

	ll ans(ll k) {
		if (e.size() == 0) return modpow(k, N);

		auto [a, b] = e.back();
		if (a > b) swap(a,b);
		if (a == b) return 0;


		auto e_cp = e;
		int comp = comps();

		e_cp.pop_back();

		auto gminus = Graph(e_cp, N);

		vector<pair<int ,int >> cont_e;

		for (auto &[x, y] : e_cp) {
			if (y == b) cont_e.push_back({a, x});
			else if (x == b) cont_e.push_back({a, y});
			else cont_e.push_back({x, y});
		}

		auto gcontract = Graph(cont_e, N - 1);

		if (gminus.comps() > comp) return (k - 1) * gcontract.ans(k) % mod;
		return (gminus.ans(k) - gcontract.ans(k) + mod) % mod;
	}

	int comps() {
		if (e.size() == 0) return N;
		int ans = 0;
		map<int, vector<int>> sus;
		for (auto [a, b] : e) {
			if (a == b) continue;
			sus[a].push_back(b);
			sus[b].push_back(a);
		}
		set<int> mam;

		for (auto [i, _] : sus) if (mam.find(i) != mam.end()) {
			ans ++;

			vector<int> que = {i};
			while (que.size()) {
				auto cur = que.back();
				if (mam.find(cur) != mam.end()) continue;
				mam.insert(cur);
				que.pop_back();


				for (auto j : sus[cur]) if(mam.find(j) != mam.end()) {
					que.push_back(j);
				}
			}
		}
		return ans;
	}
};

int main() {
	vector<ll> fact={1};
	for(int i=1; i<2000000; i++) fact.push_back(i*fact.back() % mod);
	int n, m, t; cin >> n >> m >> t;

	vector<int> farby(t);
	for (auto &i : farby) cin >> i;
	vector<pair<int, int>> edges(m);
	for (auto &[a, b]: edges) cin >> a >> b;

	auto g = Graph(edges, n);

	vector<ll> ofarbenia;

	ll sm = 0;

	for (int i = 1; i <= n; i++) {
		ll val = (g.ans(i)-sm + mod) % mod;
		ofarbenia.push_back(val);
		sm+=val;
		sm%=mod;
	}

	for(int q : farby){
		ll ans = 0;
		for(int i=1; i<=n; i++){
			if(q>=i) 
				ans+=ofarbenia[i-1] * fact[q] % mod * modpow(fact[q-i], mod-2) % mod * modpow(fact[i], mod-2) % mod; 
			ans%=mod;
		}	
		cout<<ans<<'\n';
	}
}
