#include<stdio.h>
#include<math.h>
#include<limits.h>
#define MIN(a, b) ((a) < (b) ? (a) : (b))
#define MAX(a, b) ((a) > (b) ? (a) : (b))
#define LARGE 100001

int a[LARGE]={0};
int Add[LARGE]={0};
int b,n;

int main(){

	int q,i,j,com;
	int x,y,z;
	
	scanf("%d %d",&n,&q);
	
	b=sqrt(n);
	
	for(j=0;j<q;j++){
	
		scanf("%d",&com);
		
		if(com==1){/*get*/
			scanf("%d",&x);
			printf("%d\n",a[x]+Add[x/b]);
		}
		
		else {/*update*/
			scanf("%d %d %d",&x,&y,&z);
			if(y/b-x/b<2){
				for(i=x;i<=y;i++)a[i]+=z;
			}
			else {
				for(i=x;i<=MIN(y,(x/b+1)*b-1);i++)a[i]+=z;
			
				for(i=x/b+1;i<y/b;i++)Add[i]+=z;
			
				for(i=MAX(x,y/b*b);i<=y;i++)a[i]+=z;
				
			}
		}
		
	}
	
	return 0;
	
}
