{ NOTE: it is recommended to use this even if you don't understand the following code }

const
    MAXM = 100000;
    MAXN = 100000;

var
    M, N, ans, i : LongInt;
    A, B         : Array[0..MAXN - 1-1] of LongInt;
    T, X         : Array[0..MAXM-1] of LongInt;

begin
{
    uncomment the two following lines if you want to read/write from files
    assign(input,  'input.txt');  reset(input);
    assign(output, 'output.txt'); rewrite(output);
}

    ReadLn(N, M);

    for i:=0 to N - 1-1 do
        ReadLn(A[i], B[i]);

    for i:=0 to M-1 do
        ReadLn(X[i], T[i]);

    ans := 0;

    { INSERT YOUR CODE HERE }


    WriteLn(ans);

end.
