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

using ll = long long;

const ll inf = 1e17;

struct Match {
	int n0, n1;
	vector< set<int> > adj;
	vector<int> match, used;
	
	bool try_kuhn(int u) {
		if (used[u]) return false;
		used[u] = true;
		for (auto& to: adj[u]) {
			if (match[to] == -1 || try_kuhn(match[to])) {
				match[to] = u;
				return true;
			}
		}
		return false;
	}
	
	int compute() {
		match.assign(n1, -1);
		int ret = 0;
		for (int i = 0; i < n0; i++) {
			used.assign(n0, false);
			ret += try_kuhn(i);
		}
		return ret;
	}
	
	void rm_u(int u, bool in) {
		if (in) {
			for (int i = 0; i < n0; i++) adj[i].erase(u);
		}
		else adj[u].clear();
	}
	
	Match() {};
	Match(int n0, int n1): n0(n0), n1(n1) {
		adj.resize(n0);
	}
};

int n, m, k;
vector< vector<int> > adj;
vector<ll> x, y;

int main() {
	cin.tie(0)->sync_with_stdio(0);
	
	cin >> n >> m >> k;
	adj.resize(n);
	Match mt(n, n);
	for (int i = 0, x, y; i < m; i++) {
		cin >> x >> y;
		x--, y--;
		adj[x].push_back(y);
		//adj[y].push_back(x);
		mt.adj[x].insert(y);
		//mt.adj[y].insert(x);
	}
	x.resize(k); y.resize(k);
	for (int i = 0; i < k; i++) cin >> x[i] >> y[i];
	
	int cnt = mt.compute(), cur = cnt;
	
	//return 0;
	vector<int> v;
	while (cur > 0) {
		int idx = 0;
		for (int i = 0; i < n; i++) {
			auto mt2 = mt;
			mt2.rm_u(i, false);
			if (mt2.compute() == cur - 1) idx = i + 1;
			mt2 = mt;
			mt2.rm_u(i, true);
			if (mt2.compute() == cur - 1) idx = -(i + 1);
		}
		v.push_back(idx);
		mt.rm_u(abs(idx) - 1, idx < 0);
		cur--;
	}
	reverse(v.begin(), v.end());
	
	//return 0;
	
	ll dp[k + 1][cnt + 1];
	int p[k + 1][cnt + 1];
	for (int i = 0; i <= k; i++) {
		for (int j = 0; j <= cnt; j++) {
			dp[i][j] = -inf;
			p[i][j] = 0;
		}
	}
	dp[0][cnt] = 0;
	for (int i = 0; i < k; i++) {
		for (int j = 0; j <= cnt; j++) {
			if (dp[i][j] == -inf) continue;
			for (int z = 0; z <= j; z++) {
				if (i + z >= n - 1) continue;
				//int t = j - z;
				ll add = max(0ll, x[i] - y[i] * (j - z));
				if (dp[i + 1][z] < dp[i][j] + add) {
					dp[i + 1][z] = dp[i][j] + add;
					p[i + 1][z] = j;
				}
			}
		}
	}
	
	//for (int i = 0; i <= cnt; i++) cout << v[i] << " "; cout << "\n";
	cur = max_element(dp[k], dp[k] + cnt + 1) - dp[k];
	vector<int> res;
	for (int i = k; i > 0; i--) {
		res.push_back(0);
		for (int j = p[i][cur] - 1; j >= cur; j--) res.push_back(v[j]);
		cur = p[i][cur];
	}
	reverse(res.begin(), res.end());
	cout << res.size() << "\n";
	for (auto& x: res) cout << x << " ";
	cout << endl;
	
	return 0;
}