#include #include using namespace atcoder; using namespace std; using ll = long long; using T = ll; using F = ll; T op(T l, T r) { return min(l, r); } T e() { return 1e18; } T fx(F f, T x) { return f + x; } F fg(F f, F g) { return f + g; } F id() { return 0; } int main() { ios::sync_with_stdio(false); cin.tie(nullptr); ll N; cin >> N; vector A(N); for(auto &i : A) { cin >> i; } lazy_segtree S(A); ll Q; cin >> Q; while(Q--) { ll type, l, r, c; cin >> type >> l >> r >> c; if(type == 1) { S.apply(--l, r, c); } else { cout << S.prod(--l, r) << "\n"; } } }