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

const
    MAXQ = 500000;
    MAXN = 500000;
    MAXM = 500000;

var
    M, N, Q, i     : LongInt;
    A              : Array[0..MAXN-1] of LongInt;
    B              : Array[0..MAXM-1] of LongInt;
    l1, l2, r1, r2 : Array[0..MAXQ-1] of LongInt;
    ans            : Array[0..MAXQ-1] of Int64;

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, Q);

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

    for i:=0 to M-1 do
        Read(B[i]);
    ReadLn();

    for i:=0 to Q-1 do
        ReadLn(l1[i], r1[i], l2[i], r2[i]);

    for i := 0 to MAXQ-1 do ans[i] := 0;

    { INSERT YOUR CODE HERE }


    for i:=0 to Q-1 do
        WriteLn(ans[i]);

end.
