#include <bits/stdc++.h>
#define endl '\n'
using namespace std;

long long n, m, k, a, b, match[5005], num[105][105], dp[105][105], vis[5005], v[5005], tot;

vector<int> tu[105], w, ans;

int dfs(int x){
	for(int i : tu[x]) if(!vis[i] && !v[i + n]){
		vis[i] = 1;
		if(!match[i] || dfs(match[i])){
			match[i] = x;
			return 1;
		}
	}
	return 0;
}

int cal(){
	int ret = 0;
	memset(match, 0, sizeof(match));
	for(int i = 1; i <= n; i++){
		if(v[i]) continue;
		memset(vis, 0, sizeof(vis));
		ret += dfs(i);
	}
	return ret;
}

int main(){
	cin >> n >> m >> k;
	for(int i = 1; i <= m; i++)
		cin >> a >> b, tu[a].push_back(b);
	for(int i = (tot = cal()) - 1; i >= n - k - 1; i--)
		for(int j = 1; j <= n + n; j++) if(!v[j]){
            v[j] = 1, v[j] = (cal() == i);
            if(v[j]){
                w.push_back(j > n ? -(j - n) : j);
                break;
            }
        }
	for(int i = 0; i <= k; i++)
		for(int j = 0; j <= w.size(); j++)
			dp[i][j] = -1e18;
	dp[0][0] = 0;
	for(int i = 1; i <= k; i++){
		cin >> a >> b;
		for(int j = max(0ll, tot - n + i + 1); j <= w.size(); j++)
			for(int l = 0; l <= j; l++){
				long long pro = dp[i - 1][j - l] + max(0ll, a - 1ll * l * b);
				if(pro > dp[i][j]) dp[i][j] = pro, num[i][j] = l;
			}
	}
	int pro = w.size();
	for(int i = k; i; i--){
		ans.push_back(0);
		for(int j = 0; j < num[i][pro]; j++) 
			ans.push_back(w.back()), w.pop_back();
		pro -= num[i][pro];
	}
	cout << ans.size() << endl, reverse(ans.begin(), ans.end());
	for(int i : ans) cout << i << ' ';
	return 0;
}

