package main

import (
	"bufio"
	"bytes"
	"fmt"
	"io"
	"math"
	"os"
	"strconv"
	"strings"
)

//  長い入力を読む
func ReadLongLines(times int) ([]string, error) {
	result := make([]string, times)
	reader := bufio.NewReader(os.Stdin)
	buffer := bytes.NewBuffer(make([]byte, 0))
	readBytes := int64(2)
	for i := 0; i < times; i++ {
		for {
			readBuf, isPrefix, err := reader.ReadLine()
			// fmt.Printf("Reader.Read: %d\n", len(readBuf))
			readBytes += int64(len(readBuf) + 1)
			if err != nil {
				if err == io.EOF {
					fmt.Println("EOF")
					break
				} else {
					return result, err
				}
			}
			_, err = buffer.Write(readBuf)
			if err != nil {
				return result, err
			}
			// end of line
			if !isPrefix {
				result[i] = buffer.String()
				buffer.Reset()
				// reader = bufio.NewReader(os.Stdin)
				break
			}
		}
	}
	// 先読みしてしまうようなので、戻しておく
	os.Stdin.Seek(-int64(reader.Buffered()), os.SEEK_CUR)
	return result, nil
}

// 出力 for 競プロ
type Console struct {
	writer *bufio.Writer
}

func NewConsole() Console {
	return Console{bufio.NewWriter(os.Stdout)}
}
func (this *Console) Printf(format string, a ...interface{}) {
	fmt.Fprintf(this.writer, format, a...)
}
func (this *Console) Println(s string) {
	fmt.Fprintln(this.writer, s)
}
func (this *Console) Close() {
	this.Flush()
}
func (this Console) Flush() {
	this.writer.Flush()
}

func PrintList(list []int) {
	con := NewConsole()
	defer con.Flush()
	for i := range list {
		if i == 0 {
			con.Printf("%d", list[i])
		} else {
			con.Printf(" %d", list[i])
		}
	}
	con.Println("")
}

func Max(lhs int, rhs int) int {
	if lhs < rhs {
		return rhs
	} else {
		return lhs
	}
}
func Min(lhs int, rhs int) int {
	if lhs < rhs {
		return lhs
	} else {
		return rhs
	}
}

// const DEF_VAL = 1<<31 - 1
const DEV_VAL = 0

type List struct {
	data      []int
	sumBucket []int
	numVal    int
}

func NewList(n int) List {
	numVal := int(math.Floor(math.Sqrt(float64(n))))
	bucketNum := int(math.Ceil(float64(n) / float64(numVal)))
	bucket := make([]int, bucketNum)
	data := make([]int, n)
	return List{data, bucket, numVal}
}

func (this *List) GetIndex(begin int, end int) []int {
	// 範囲をカバーする minListのインデックスを計算する
	result := make([]int, 0)
	for i := begin; i < end/this.numVal*this.numVal+this.numVal; i += this.numVal {
		x := i / this.numVal
		result = append(result, x)
	}
	return result
}

func (this *List) Add(begin int, end int, value int) {
	// outside bucket
	for i := begin; i < (begin/this.numVal+1)*this.numVal && i <= end; i++ {
		// fmt.Printf("under %d\n", (begin/this.numVal+1)*this.numVal)
		this.data[i] += value
	}
	for i := end / this.numVal * this.numVal; i <= end && begin < i; i++ {
		// fmt.Printf("over")
		this.data[i] += value
	}
	// bucket
	for i := begin/this.numVal + 1; i < end/this.numVal; i++ {
		// fmt.Printf("bucket")
		this.sumBucket[i] += value
	}
}

func (this *List) Find(index int) int {
	return this.data[index] + this.sumBucket[index/this.numVal]
}

func main() {
	con := NewConsole()
	defer con.Close()

	var n, q int
	fmt.Scanf("%d %d", &n, &q)
	lines, _ := ReadLongLines(q)

	list := NewList(n)
	// fmt.Println(list)
	for i := 0; i < q; i++ {
		args := strings.Split(lines[i], " ")
		command := args[0]
		switch command {
		case "0":
			s, _ := strconv.Atoi(args[1])
			t, _ := strconv.Atoi(args[2])
			x, _ := strconv.Atoi(args[3])
			list.Add(s-1, t-1, x)
			// fmt.Println(list)
		case "1":
			i, _ := strconv.Atoi(args[1])
			x := list.Find(i - 1)
			// con.Printf("Find(%d, %d) ", s, t)
			con.Printf("%d\n", x)
		}
	}
	// fmt.Println(list)
}



Measured memory_bytes: 10872