#include <bits/stdc++.h>
using namespace std;
#if __cplusplus < 202002L
template <class T> int ssize(const T& a){ return a.size(); }
#endif
template <class T1, class T2> istream& operator>> (istream& in, pair <T1, T2>& a){ in >> a.first >> a.second; return in; }
template <class T> istream& operator>> (istream& in, vector <T>& a){ for (auto &x: a){ in >> x; } return in; }
using ll = long long;
using ld = long double;
template<class T, class F>
struct sparse_table{
#ifdef LOCAL
#define ASSERT(x) assert(x)
#else
#define ASSERT(x) 42
#endif
int n;
vector<vector<T>> data;
F TT;
T T_id;
sparse_table(F TT, T T_id): TT(TT), T_id(T_id){ }
sparse_table &operator=(const sparse_table &st){
n = st.n;
data = st.data;
return *this;
}
friend void swap(sparse_table &stl, sparse_table &str){
swap(stl.n, str.n);
swap(stl.data, str.data);
}
// O(n * log(n))
void build(const vector<T> &a){
n = (int)a.size();
data.assign({a});
for(auto p = 1, i = 1; p << 1 <= n; p <<= 1, ++ i){
data.emplace_back(n - (p << 1) + 1);
for(auto j = 0; j < (int)data[i].size(); ++ j) data[i][j] = TT(data[i - 1][j], data[i - 1][j + p]);
}
}
// O(1)
T query(int l, int r) const{
ASSERT(0 <= l && l <= r && r <= n);
if(l == r) return T_id;
int d = __lg(r - l);
return TT(data[d][l], data[d][r - (1 << d)]);
}
#undef ASSERT
};
template<class T, class F>
auto make_sparse_table(F TT, T T_id){
return sparse_table(TT, T_id);
}
template<class T>
auto make_rminq(T inf = numeric_limits<T>::max()){
return sparse_table([&](const T &x, const T &y){ return min(x, y); }, inf);
}
template<class T>
auto make_rmaxq(T minf = numeric_limits<T>::min()){
return sparse_table([&](const T &x, const T &y){ return max(x, y); }, minf);
}
vector <ll> build_teams(vector <int> A1, vector <int> B1, vector <int> A2, vector <int> B2, vector <int> L1, vector <int> R1, vector <int> L2, vector <int> R2){
auto n = ssize(A1), m = ssize(A2), q = ssize(L1);
vector <ll> ans(q);
if ((n <= 500 and m <= 500 and q <= 500) or q <= 20){
for (auto iq = 0; iq < q; iq++){
vector <pair <ll, int>> opt(n);
auto dnc = [&](auto&& self, int l1, int r1, int l2, int r2)->void{
auto m1 = (l1 + r1) >> 1;
opt[m1] = {numeric_limits <ll>::min(), -1};
for (auto j = l2; j <= r2; j++){
opt[m1] = max(opt[m1], pair <ll, int>{ll(A1[m1] + A2[j]) * (B1[m1] + B2[j]), j});
}
auto m2 = opt[m1].second;
if (l1 <= m1 - 1){
self(self, l1, m1 - 1, m2, r2);
}
if (m1 + 1 <= r1){
self(self, m1 + 1, r1, l2, m2);
}
};
dnc(dnc, L1[iq], R1[iq], L2[iq], R2[iq]);
ll tans = max_element(begin(opt), end(opt))->first;
ans[iq] = tans;
}
}
if (*max_element(begin(L2), end(L2)) == 0 and *min_element(begin(R2), end(R2)) == m - 1){
vector <pair <ll, int>> opt(n);
auto dnc = [&](auto&& self, int l1, int r1, int l2, int r2)->void{
auto m1 = (l1 + r1) >> 1;
opt[m1] = {numeric_limits <ll>::min(), -1};
for (auto j = l2; j <= r2; j++){
opt[m1] = max(opt[m1], pair <ll, int>{ll(A1[m1] + A2[j]) * (B1[m1] + B2[j]), j});
}
auto m2 = opt[m1].second;
if (l1 <= m1 - 1){
self(self, l1, m1 - 1, m2, r2);
}
if (m1 + 1 <= r1){
self(self, m1 + 1, r1, l2, m2);
}
};
dnc(dnc, 0, n - 1, 0, m - 1);
auto rmq = make_rminq(numeric_limits <pair <ll, int>>::max());
rmq.build(opt);
for (auto iq = 0; iq < q; iq++){
auto tans = rmq.query(L1[iq], R1[iq] + 1).first;
ans[iq] = tans;
}
}
return ans;
}
#ifndef ONLINE_JUDGE
signed main(){
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
if (fopen("KEK.inp", "r")){
freopen("KEK.inp", "r", stdin);
freopen("KEK.out", "w", stdout);
}
int n, m, q;
cin >> n >> m >> q;
vector <int> A1(n), B1(n), A2(m), B2(m), L1(q), R1(q), L2(q), R2(q);
cin >> A1 >> B1 >> A2 >> B2;
for (auto iq = 0; iq < q; iq++){
cin >> L1[iq] >> R1[iq] >> L2[iq] >> R2[iq];
}
vector <ll> ans = build_teams(A1, B1, A2, B2, L1, R1, L2, R2);
for (auto iq = 0; iq < q; iq++){
cout << ans[iq] << "\n";
}
}
#endif