Problem: Monocarp plays a computer game called "Goblins and Gnomes". In this game, he manages a large underground city of gnomes and defends it from hordes of goblins.

The city consists of n halls and m one-directional tunnels connecting them. The structure of tunnels has the following property: if a goblin leaves any hall, he cannot return to that hall. 

The city will be attacked by k waves of goblins; during the i-th wave, i goblins attack the city. Monocarp's goal is to pass all k waves.

The i-th wave goes as follows: firstly, i goblins appear in some halls of the city and pillage them; at most one goblin appears in each hall. Then, goblins start moving along the tunnels, pillaging all the halls in their path. 

Goblins are very greedy and cunning, so they choose their paths so that no two goblins pass through the same hall. Among all possible attack plans, they choose a plan which allows them to pillage the maximum number of halls. After goblins are done pillaging, they leave the city.

If all halls are pillaged during the wave — Monocarp loses the game. Otherwise, the city is restored. If some hall is pillaged during a wave, goblins are still interested in pillaging it during the next waves.

Before each wave, Monocarp can spend some time preparing to it. Monocarp doesn't have any strict time limits on his preparations (he decides when to call each wave by himself), but the longer he prepares for a wave, the fewer points he gets for passing it. If Monocarp prepares for the i-th wave for t_i minutes, then he gets max(0, x_i - t_i ⋅ y_i) points for passing it (obviously, if he doesn't lose in the process).

While preparing for a wave, Monocarp can block tunnels. He can spend one minute to either block all tunnels leading from some hall or block all tunnels leading to some hall. If Monocarp blocks a tunnel while preparing for a wave, it stays blocked during the next waves as well.

Help Monocarp to defend against all k waves of goblins and get the maximum possible amount of points!

Input

The first line contains three integers n, m and k (2 ≤ n ≤ 50; 0 ≤ m ≤ (n(n - 1))/(2); 1 ≤ k ≤ n - 1) — the number of halls in the city, the number of tunnels and the number of goblin waves, correspondely.

Next m lines describe tunnels. The i-th line contains two integers u_i and v_i (1 ≤ u_i, v_i ≤ n; u_i ≠ v_i). It means that the tunnel goes from hall u_i to hall v_i. The structure of tunnels has the following property: if a goblin leaves any hall, he cannot return to that hall. There is at most one tunnel between each pair of halls.

Next k lines describe the scoring system. The i-th line contains two integers x_i and y_i (1 ≤ x_i ≤ 10^9; 1 ≤ y_i ≤ 10^9). If Monocarp prepares for the i-th wave for t_i minutes, then he gets max(0, x_i - t_i ⋅ y_i) points for passing it.

Output

Print the optimal Monocarp's strategy in the following format:

At first, print one integer a (k ≤ a ≤ 2n + k) — the number of actions Monocarp will perform. Next, print actions themselves in the order Monocarp performs them. The i-th action is described by a single integer b_i (-n ≤ b_i ≤ n) using the following format:

  * if b_i > 0 then Monocarp blocks all tunnels going out from the hall b_i; 
  * if b_i < 0 then Monocarp blocks all tunnels going into the hall |b_i|; 
  * if b_i = 0 then Monocarp calls the next goblin wave. 



You can't repeat the same block action b_i several times. Monocarp must survive all waves he calls (goblins shouldn't be able to pillage all halls). Monocarp should call exactly k waves and earn the maximum possible number of points in total.

If there are several optimal strategies — print any of them.

Examples

Input


5 4 4
1 2
2 3
4 3
5 3
100 1
200 5
10 10
100 1


Output


6
-2 -3 0 0 0 0 


Input


5 4 4
1 2
2 3
4 3
5 3
100 100
200 5
10 10
100 1


Output


6
0 -3 0 0 1 0


Input


5 10 1
1 2
1 3
1 4
1 5
5 2
5 3
5 4
4 2
4 3
2 3
100 100


Output


6
1 2 3 4 5 0

Note

In the first example, Monocarp, firstly, block all tunnels going in hall 2, secondly — all tunnels going in hall 3, and after that calls all waves. He spent two minutes to prepare to wave 1, so he gets 98 points for it. He didn't prepare after that, that's why he gets maximum scores for each of next waves (200, 10 and 100). In total, Monocarp earns 408 points.

In the second example, Monocarp calls for the first wave immediately and gets 100 points. Before the second wave he blocks all tunnels going in hall 3. He spent one minute preparing to the wave, so he gets 195 points. Monocarp didn't prepare for the third wave, so he gets 10 points by surviving it. Before the fourth wave he blocks all tunnels going out from hall 1. He spent one minute, so he gets 99 points for the fourth wave. In total, Monocarp earns 404 points.

In the third example, it doesn't matter how many minutes Monocarp will spend before the wave, since he won't get any points for it. That's why he decides to block all tunnels in the city, spending 5 minutes. He survived the wave though without getting any points.

Solution (in CPP):

Solution:
/*{{{*/
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<string>
#include<iostream>
#include<sstream>
#include<set>
#include<map>
#include<queue>
#include<bitset>
#include<vector>
#include<limits.h>
#include<assert.h>
#define SZ(X) ((int)(X).size())
#define ALL(X) (X).begin(), (X).end()
#define REP(I, N) for (int I = 0; I < (N); ++I)
#define REPP(I, A, B) for (int I = (A); I < (B); ++I)
#define FOR(I, A, B) for (int I = (A); I <= (B); ++I)
#define FORS(I, S) for (int I = 0; S[I]; ++I)
#define RS(X) scanf("%s", (X))
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define GET_POS(c,x) (lower_bound(c.begin(),c.end(),x)-c.begin())
#define CASET int ___T; scanf("%d", &___T); for(int cs=1;cs<=___T;cs++)
#define MP make_pair
#define PB emplace_back
#define MS0(X) memset((X), 0, sizeof((X)))
#define MS1(X) memset((X), -1, sizeof((X)))
#define LEN(X) strlen(X)
#define F first
#define S second
using namespace std;
typedef long long LL;
typedef unsigned long long ULL;
typedef long double LD;
typedef pair<int,int> PII;
typedef vector<int> VI;
typedef vector<LL> VL;
typedef vector<PII> VPII;
typedef pair<LL,LL> PLL;
typedef vector<PLL> VPLL;
template<class T> void _R(T &x) { cin >> x; }
void _R(int &x) { scanf("%d", &x); }
void _R(int64_t &x) { scanf("%lld", &x); }
void _R(double &x) { scanf("%lf", &x); }
void _R(char &x) { scanf(" %c", &x); }
void _R(char *x) { scanf("%s", x); }
void R() {}
template<class T, class... U> void R(T &head, U &... tail) { _R(head); R(tail...); }
template<class T> void _W(const T &x) { cout << x; }
void _W(const int &x) { printf("%d", x); }
void _W(const int64_t &x) { printf("%lld", x); }
void _W(const double &x) { printf("%.16f", x); }
void _W(const char &x) { putchar(x); }
void _W(const char *x) { printf("%s", x); }
template<class T,class U> void _W(const pair<T,U> &x) {_W(x.F); putchar(' '); _W(x.S);}
template<class T> void _W(const vector<T> &x) { for (auto i = x.begin(); i != x.end(); _W(*i++)) if (i != x.cbegin()) putchar(' '); }
void W() {}
template<class T, class... U> void W(const T &head, const U &... tail) { _W(head); putchar(sizeof...(tail) ? ' ' : '\n'); W(tail...); }
#ifdef HOME
 #define DEBUG(...) {printf("[DEBUG] ");W(__VA_ARGS__);}
#else
 #define DEBUG(...)
#endif
int MOD = 1e9+7;
void ADD(LL& x,LL v){x=(x+v)%MOD;if(x<0)x+=MOD;}
/*}}}*/
const int SIZE = 1<<20;
#define FN 500010
#define FM 2000010
#define INF 1000000000000000
struct E {
    int k;
    long long c;
    E() {}
    E( int _k, long long _c ) : k(_k), c(_c) {}
} es[FM];
 
struct Flow {
    int n, m, dis[FN];
    int qq[FN], qr, ql;
    int ptr[FN];
    vector<int> e[FN];
    void init( int _n ) {
        n = _n; m=0;
        for (int i = 0; i < n; i++) {
            vector<int> tmp;
            e[i].swap(tmp);
        }
    }
    void add_edge(int a, int b, long long c) {
        e[a].push_back(m); es[m]=E(b, c); m++;
        e[b].push_back(m); es[m]=E(a, 0); m++;
    }
    bool BFS() {
        memset(dis, -1, n * sizeof(int));
        ql = qr = 0;
        qq[qr++] = 0;
        dis[0] = 0;
        while ( ql != qr && dis[n-1] == -1 ) {
            int p = qq[ql++];
            for(auto& it : e[p]) {
                E ee = es[it];
                if ( ee.c == 0 || dis[ee.k] != -1 ) continue;
                dis[ee.k] = dis[p] + 1;
                qq[qr++] = ee.k;
            }
        }
        return dis[n-1] != -1;
    }
    long long go(int p, long long c) {
        if (p == n - 1) { return c; }
        long long ret = 0, tmp;
        for(int &i = ptr[p];i < SZ(e[p]); i++) {
            auto it = e[p][i];
            E &ee = es[it];
            if (ee.c == 0 || dis[p] + 1 != dis[ee.k]) { continue; }
            tmp = go(ee.k, min(c - ret, (long long)ee.c));
            ret += tmp; ee.c -= tmp; es[it ^ 1].c += tmp;
            if (ret == c) { break; }
        }
        if (ret == 0) { dis[p] = -1; }
        return ret;
    }
    long long maxflow() {
        long long ret = 0;
        while (BFS()) {
            memset(ptr,0,n * sizeof(int));
            ret += go(0, 1LL << 60);
        }
        return ret;
    }
} flow;
int n,m,K;
LL x[50],y[50];
LL dp[50][50];
int from[50][50];
void solve() {
    R(n,m,K);
    flow.init(2*n+2);
    FOR(i,1,n){
        flow.add_edge(0,i,1);
        flow.add_edge(i+n,n*2+1,1);
    }
    REP(i,m){
        int u,v;
        R(u,v);
        flow.add_edge(u,v+n,1);
    }
    int fv=flow.maxflow();
    int min_flow=n-fv;
    if(min_flow>K){
        W(K);
        W(VI(K,0));
        return;
    }
    VI AA;
    FOR(i,1,2*n){
        if(1<=i&&i<=n&&flow.dis[i]==-1){
            AA.PB(i);
        }
        if(i>n&&i<=2*n&&flow.dis[i]!=-1){
            AA.PB(-(i-n));
        }
    }
    int need=K-min_flow+1;
    FOR(i,1,K){
        R(x[i],y[i]);
    }
    REP(i,50)REP(j,50)dp[i][j]=1e18;
    dp[0][0]=0;
    FOR(i,1,K){
        FOR(j,max(0,need-(K-i)),need){
            FOR(k,0,j){
                if(dp[i][j]>dp[i-1][j-k]+min(x[i],y[i]*k)){
                    dp[i][j]=dp[i-1][j-k]+min(x[i],y[i]*k);
                    from[i][j]=j-k;
                }
            }
        }
    }
    VI res;
    PII now(K,need);
    while(now.F){
        res.PB(0);
        int nxt_S=from[now.F][now.S];
        REP(i,now.S-nxt_S){
            res.PB(AA.back());
            AA.pop_back();
        }
        now=MP(now.F-1,nxt_S);
    }
    reverse(ALL(res));
    W(SZ(res));
    W(res);
 
}
int main(){
    solve();
    return 0;
}