#include<stdio.h>
#include<vector>
#include<stdlib.h>
#include<algorithm>
#include<string.h>
using namespace std;
int tree[40000010], lazy[40000010];
char in[100], out[100];

void lazy_update(int node, int ns, int ne) {
    if (lazy[node]) {
        tree[node] += lazy[node];
        if (ns != ne) {
            lazy[node * 2] += lazy[node];
            lazy[node * 2 + 1] += lazy[node];
        }
        lazy[node] = 0;
    }
}

int update_range(int node, int ns, int ne, int l, int r, int val) {
    lazy_update(node, ns, ne);
    if (r < ns || ne < l) return tree[node];
    if (l <= ns && ne <= r) {
        if (ns != ne) {
            lazy[node * 2] += val;
            lazy[node * 2 + 1] += val;
        }
        return tree[node] += val;
    }
    int m = (ns + ne) / 2;
    return tree[node] = update_range(node * 2, ns, m, l, r, val) + update_range(node * 2 + 1, m + 1, ne, l, r, val);
}

int sum(int node, int ns, int ne, int idx) {
    lazy_update(node, ns, ne);
    if (idx < ns || ne < idx) return 0;
    if (ns == ne) return tree[node];
    int m = (ns + ne) / 2;
    return sum(node * 2, ns, m, idx) + sum(node * 2 + 1, m + 1, ne, idx);
}

int main(){
	int n, m, a, s, ver, b, c;
	for(int I = 1; I<=20; I++){
		memset(tree,0,sizeof(tree));
		memset(lazy,0,sizeof(lazy));
		vector<int> ans;
		sprintf(in,".%d.in",I);
        freopen(in,"w",stdout);
		//scanf("%d %d", &n, &m);
		//n = (I-20) * 10000;
		//m = (I-20) * 10000;
		n = (I) * 10000;
		m = (I) * 10000;
		printf("%d %d\n", n, m);
		while(m--){
			//ver = rand()%3+1;
			ver = m%3+1;
			//printf("%d ", ver);
			//scanf("%d", &ver);
			if(ver == 1){
				a = (rand()*1000 + rand())%n+1;
				b = (rand()*1000 + rand())%n+1;
				if(a>b) swap(a,b);
				c = rand()%100+1;
				printf("1 %d %d %d\n",a,b,c);
				//scanf("%d %d %d", &a, &b, &c);
				update_range(1,1,n,a,b,c);
			}else if(ver == 2){
				a = (rand()*10000 + rand())%n+1;
				b = (rand()*10000 + rand())%n+1;
				if(a>b) swap(a,b);
				c = rand()%100+1;
				printf("2 %d %d %d\n",a,b,c);
				//scanf("%d %d %d", &a, &b, &c);
				update_range(1,1,n,a,b,-c);
			}else{
				c = (rand()*10000 + rand())%n+1;
				//scanf("%d", &c);
				printf("3 %d\n",c);
				ans.push_back(1000000000+sum(1,1,n,c));
				//printf("%d\n", 1000000000+sum(1,1,n,c));
			}
		}
		sprintf(in,".%d.out",I);
        freopen(in,"w",stdout);
		for(auto a : ans ) printf("%d\n", a);
	}

}
