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

#include <fstream>
#include <iostream>
#include <string>
#include <vector>

using namespace std;

int main() {
    // uncomment the two following lines if you want to read/write from files
    // ifstream cin("input.txt");
    // ofstream cout("output.txt");

    int N, M, Q;
    cin >> N >> M >> Q;

    vector<int> A(N);
    for (int i = 0; i < N; ++i)
        cin >> A[i];

    vector<int> B(M);
    for (int i = 0; i < M; ++i)
        cin >> B[i];

    vector<int> l1(Q), r1(Q), l2(Q), r2(Q);
    for (int i = 0; i < Q; ++i)
        cin >> l1[i] >> r1[i] >> l2[i] >> r2[i];

    vector<long long> ans(Q);


    // INSERT YOUR CODE HERE


    for (int i = 0; i < Q; ++i)
        cout << ans[i] << endl;

    return 0;
}
