# http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=DSL_2_B&lang=jp

N,q = gets.chomp.split(' ').map(&:to_i)
a = Array.new(N).map{0}
$bit = Array.new(N).map{0}
$bit_siten = Array.new(N)
N.times do |n|
	binary = n.to_s(2)
	binary = binary[0..binary.length-1]
	$bit_siten[n] = binary.to_i(10)
end
# tate_index?????????????´??????????S???????????????????????????????????????n???tate?????????
tate = Array.new(N).map{[]}
N.times do |n|
	($bit_siten[n]..n).each do |tate_index|
		tate[tate_index] << n
	end
end

def sum(n)
	sum($bit_siten[n]-1)+$bit[n]
end

q.times do | index |
	com,x,y = gets.chomp.split(' ').map(&:to_i)
	if com==0
		tate[x].each do |tate_value|
			$bit[tate_value] = $bit[tate_value] + y
		end
	elsif com== 1
		p sum(y)-sum(x)
	end
end