// clang-format off
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define main signed main()
#define loop(i, a, n) for (int i = (a); i < (n); i++)
#define rep(i, n) loop(i, 0, n)
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define prec(n) fixed << setprecision(n)
constexpr int INF = sizeof(int) == sizeof(long long) ? 1000000000000000000LL : 1000000000;
constexpr int MOD = 1000000007;
constexpr double PI = 3.14159265358979;
template<typename A, typename B> bool cmin(A &a, const B &b) { return a > b ? (a = b, true) : false; }
template<typename A, typename B> bool cmax(A &a, const B &b) { return a < b ? (a = b, true) : false; }
bool odd(const int &n) { return n & 1; }
bool even(const int &n) { return ~n & 1; }
template<typename T = int> T in() { T x; cin >> x; return x; }
template<typename T = int> T in(T &&x) { T z(forward<T>(x)); cin >> z; return z; }
template<typename T> istream &operator>>(istream &is, vector<T> &v) { for (T &x : v) is >> x; return is; }
template<typename A, typename B> istream &operator>>(istream &is, pair<A, B> &p) { return is >> p.first >> p.second; }
template<typename T> ostream &operator<<(ostream &os, const vector<vector<T>> &v) { int n = v.size(); rep(i, n) os << v[i] << (i == n - 1 ? "" : "\n"); return os; }
template<typename T> ostream &operator<<(ostream &os, const vector<T> &v) { int n = v.size(); rep(i, n) os << v[i] << (i == n - 1 ? "" : " "); return os; }
template<typename A, typename B> ostream &operator<<(ostream &os, const pair<A, B> &p) { return os << p.first << ' ' << p.second; }
template<typename Head, typename Value> auto vectors(const Head &head, const Value &v) { return vector<Value>(head, v); }
template<typename Head, typename... Tail> auto vectors(Head x, Tail... tail) { auto inner = vectors(tail...); return vector<decltype(inner)>(x, inner); }
// clang-format on

template<typename LSTTrait> class LazySegTree {
  using FoldMonoid = typename LSTTrait::FoldMonoid;
  using ActionMonoid = typename LSTTrait::ActionMonoid;
  using T = typename FoldMonoid::value_type;
  using Q = typename ActionMonoid::value_type;

  LSTTrait lstTrait; // apply :: (T, Q) -> T, pow :: (Q, int) -> Q
  FoldMonoid foldM;
  ActionMonoid actionM;
  int size = 1;
  vector<T> tree; // 1-indexed
  vector<Q> lazy; // 1-indexed

  void push(int i) {
    stack<pair<int, int>> s;
    for (int d = 1; i /= 2; d *= 2) s.emplace(i, d);
    for (int x, d; s.size(); s.pop()) {
      tie(x, d) = s.top();
      update(x * 2, lazy[x], d);
      update(x * 2 + 1, lazy[x], d);
      lazy[x] = actionM.id();
    }
  }

  void update(const int &i, const Q &x, const int &d) {
    tree[i] = lstTrait.apply(tree[i], lstTrait.pow(x, d));
    if (i < size) lazy[i] = actionM(lazy[i], x);
  }

  void build(int i) {
    for (int d = 2; i /= 2; d *= 2) tree[i] = lstTrait.apply(foldM(tree[i * 2], tree[i * 2 + 1]), lstTrait.pow(lazy[i], d));
  }

public:
  LazySegTree(const int &n = 0) {
    while (size < n) size *= 2;
    tree.assign(size * 2, foldM.id());
    lazy.assign(size, actionM.id());
  }

  LazySegTree(const int &n, const T &x) {
    while (size < n) size *= 2;
    tree.assign(size * 2, x);
    lazy.assign(size, actionM.id());
    for (int i = size - 1; i >= 1; i--) tree[i] = foldM(tree[i * 2], tree[i * 2 + 1]);
  }

  template<typename InputIterator> LazySegTree(InputIterator first, InputIterator last) {
    int n = distance(first, last);
    while (size < n) size *= 2;
    tree.resize(size * 2, foldM.id());
    lazy.assign(size, actionM.id());
    copy(first, last, tree.begin() + size);
    for (int i = size - 1; i >= 1; i--) tree[i] = foldM(tree[i * 2], tree[i * 2 + 1]);
  }

  void act(int l, int r, const Q &x) { // [l, r) += x
    int l0 = l += size, r0 = r += size;
    push(l0), push(r0 - 1);
    for (int d = 1; l < r; l /= 2, r /= 2, d *= 2) {
      if (l & 1) update(l++, x, d);
      if (r & 1) update(--r, x, d);
    }
    build(l0), build(r0 - 1);
  }

  void update(int i, const T &x) {
    push(i += size);
    tree[i] = x;
    while (i /= 2) tree[i] = foldM(tree[i * 2], tree[i * 2 + 1]);
  }

  T fold(int l, int r) { // [l, r)
    T accl = foldM.id(), accr = foldM.id();
    for (push(l += size), push((r += size) - 1); l < r; l /= 2, r /= 2) {
      if (l & 1) accl = foldM(accl, tree[l++]);
      if (r & 1) accr = foldM(tree[--r], accr);
    }
    return foldM(accl, accr);
  }

  T operator[](int i) { return push(i += size), tree[i]; }
};

template<typename T, T upperInf = numeric_limits<T>::max()> struct minMonoid {
  using value_type = T;
  value_type id() { return upperInf; }
  value_type operator()(const value_type &a, const value_type &b) { return a < b ? a : b; }
};

template<typename T, T lowerInf = numeric_limits<T>::min()> struct maxMonoid {
  using value_type = T;
  value_type id() { return lowerInf; }
  value_type operator()(const value_type &a, const value_type &b) { return a < b ? b : a; }
};

template<typename Monoid> struct countMonoid {
  using value_type = pair<typename Monoid::value_type, int>;
  value_type id() { return {Monoid().id(), 0}; }
  value_type operator()(const value_type &a, const value_type &b) {
    auto m = Monoid()(a.first, b.first);
    return {m, a.second * (a.first == m) + b.second * (b.first == m)};
  }
};

template<typename Monoid1, typename Monoid2> struct pairMonoid {
  using value_type = pair<typename Monoid1::value_type, typename Monoid2::value_type>;
  value_type id() { return {Monoid1().id(), Monoid2().id()}; }
  value_type operator()(const value_type &a, const value_type &b) { //
    return {Monoid1()(a.first, b.first), Monoid2()(a.second, b.second)};
  }
};

template<typename T> struct sumMonoid {
  using value_type = T;
  value_type id() { return 0; }
  value_type operator()(const value_type &a, const value_type &b) { return a + b; }
};

#define maxValue first.first
#define maxCount first.second
#define minValue second.first
#define minCount second.second

struct matrixTrait {
  using FoldMonoid = pairMonoid<countMonoid<minMonoid<int>>, countMonoid<maxMonoid<int>>>;
  using ActionMonoid = sumMonoid<int>;
  typename FoldMonoid::value_type apply(typename FoldMonoid::value_type t, typename ActionMonoid::value_type q) {
    t.maxValue += q, t.minValue += q;
    return t;
  }
  typename ActionMonoid::value_type pow(typename ActionMonoid::value_type q, const int &d) { return q; }
};

using M = typename matrixTrait::FoldMonoid::value_type;

main {
  int h, w, q;
  cin >> h >> w >> q;
  vector<M> v1(h), v2(w);
  rep(i, h) v1[i].maxValue = v1[i].minValue = in(), v1[i].maxCount = v1[i].minCount = 1;
  rep(i, w) v2[i].maxValue = v2[i].minValue = in(), v2[i].maxCount = v2[i].minCount = 1;
  LazySegTree<matrixTrait> lst1(all(v1)), lst2(all(v2));

  auto f = [&](const function<int(int, int)> &op) -> pair<int, int> {
    int a, b, c, d;
    cin >> a >> b >> c >> d;
    M m1 = lst1.fold(--a, b), m2 = lst2.fold(--c, d);
    int ans = op(op(m1.maxValue * m2.maxValue, m1.maxValue * m2.minValue), //
                 op(m1.minValue * m2.maxValue, m1.minValue * m2.minValue));
    int R = b - a, C = d - c;
    if (ans == 0) {
      int r = m1.maxCount * (m1.maxValue == 0) | m1.minCount * (m1.minValue == 0);
      int c = m2.maxCount * (m2.maxValue == 0) | m2.minCount * (m2.minValue == 0);
      return {ans, R * C - (R - r) * (C - c)};
    }
    if (m1.maxValue == m1.minValue && m2.maxValue == m2.minValue) return {ans, R * C};
    if (m1.maxValue == m1.minValue || m2.maxValue == m2.minValue) {
      int cnt = m1.maxCount * m2.maxCount * (m1.maxValue * m2.maxValue == ans) + //
                m1.minCount * m2.minCount * (m1.minValue * m2.minValue == ans);
      return {ans, cnt};
    }
    int cnt = m1.maxCount * m2.maxCount * (m1.maxValue * m2.maxValue == ans) + //
              m1.maxCount * m2.minCount * (m1.maxValue * m2.minValue == ans) + //
              m1.minCount * m2.maxCount * (m1.minValue * m2.maxValue == ans) + //
              m1.minCount * m2.minCount * (m1.minValue * m2.minValue == ans);
    return {ans, cnt};
  };

  while (q--) {
    int t = in();
    if (t <= 2) {
      int a, b, v;
      cin >> a >> b >> v;
      (t == 1 ? lst1 : lst2).act(--a, b, v);
    } else {
      function<int(int, int)> p = [&](int a, int b) { return min(a, b); };
      function<int(int, int)> q = [&](int a, int b) { return max(a, b); };
      cout << f(t == 3 ? p : q) << endl;
    }
  }
}



Measured memory_bytes: 26800