#include<bits/stdc++.h>
#define ls(x) x<<1
#define rs(x) x<<1|1
using namespace std;
typedef long long ll;
int n,m,k;
const int N= 1e5+5;
int le[N],ri[N];
ll a[N],tr[N<<2];
ll ad[N<<2];
ll va[N<<2];
void pushdown(int l,int r,int rt){
if(va[rt] != -1){
int m = l+r>>1,lson=ls(rt),rson=rs(rt);
va[lson] = va[rson] =rt;
ad[lson] = ad[rson] =0;
tr[lson] = va[rt]*(m-l+1);
tr[rson] = va[rt]*(r-m);
va[rt] =-1;
}
if(ad[rt]){
int m = l+r>>1,lson=ls(rt),rson=rs(rt);
ad[lson]+=ad[rt];
ad[rson]+=ad[rt];
tr[lson]+=ad[rt]*(m-l+1);
tr[rson]+=ad[rt]*(r-m);
ad[rt]=0;
}
}
void build(int l,int r,int rt){
ad[rt]=0;
va[rt] = -1;
if(l == r){
tr[rt] = a[l];
return;
}
int m = l+r>>1;
int lson = ls(rt),rson=rs(rt);
build(l,m,lson);
build(m+1,r,rson);
tr[rt] = tr[lson]+tr[rson];
}
void update(int L,int R,int c,int l,int r,int rt){
if(L<=l && r<=R){
tr[rt] += 1ll*c*(r-l+1);
ad[rt] += c;
return;
}
pushdown(l,r,rt);
int m = l+r>>1,lson= ls(rt),rson=rs(rt);
if(L<=m)update(L,R,c,l,m,lson);
if(R>m)update(L,R,c,m+1,r,rson);
tr[rt] = tr[lson]+tr[rson];
}
void update2(int L,int R,int c,int l,int r,int rt){
if(L<=l && r<=R){
tr[rt] = 1ll*c*(r-l+1);
va[rt] = c;
ad[rt] = 0;
return;
}
pushdown(l,r,rt);
int m = l+r>>1,lson= ls(rt),rson=rs(rt);
if(L<=m)update2(L,R,c,l,m,lson);
if(R>m)update2(L,R,c,m+1,r,rson);
tr[rt] = tr[lson]+tr[rson];
}
ll query(int L,int R,int l,int r,int rt){
if(L<=l && r<=R)return tr[rt];
int m=l+r>>1;
pushdown(l,r,rt);
ll ans = 0 ;
int lson = ls(rt),rson = rs(rt);
if(L<=m)ans+=query(L,R,l,m,lson);
if(R>m)ans+=query(L,R,m+1,r,rson);
return ans;
}
int main(){
// freopen("in.txt","r",stdin);
int kase=1;
while(~scanf("%d%d%d",&n,&m,&k)){
printf("Case #%d:\n",kase++);
for(int i=1;i<=n;i++)scanf("%lld",&a[i]);
for(int i=1;i<=m;i++)scanf("%d%d",&le[i],&ri[i]);
build(1,n,1);
int op,x,y;
for(int i=1;i<=k;i++){
scanf("%d%d%d",&op,&x,&y);
if(op == 1){
update(x,x,y,1,n,1);
}else if(op == 2){
update(x,x,-y,1,n,1);
}else if(op == 3){
update2(x,x,y,1,n,1);
}else{
int l1 = le[x],r1 = ri[x],l2 = le[y],r2 = ri[y];
ll ans;
if(min(r1,r2) < max(l1,l2))
ans = query(l1,r1,1,n,1) + query(l2,r2,1,n,1);
else ans = query(min(l1,l2),max(r1,r2),1,n,1);
printf("%lld\n",ans);
}
}
}
return 0;
}