def add(a, w)
  while a <= $n
    $d[a] += w
    a += a & -a
  end
end

def sum(i)
  ret = 0
  x = i
  while x > 0
    ret += $d[x]
    x -= x & -x
  end
  return ret
end

$n, q = gets.split.map(&:to_i)
$d = Array.new($n+1){0}

q.times{
  com, s, t, x = gets.split.map(&:to_i)
  case com
  when 0
    add(s, x)
    add(t+1, -x)
  when 1
    p sum(s)
  end
}