# 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+1).map{0}
$bit = Array.new(N+1).map{0}
$bit_siten = Array.new(N+1)
(N+1).times do |n|
	binary = n.to_s(2)
	i = 0
	binary.reverse.each_char do |b|
		if b=="1"
			binary[binary.length-1-i] = '0'
			break
		end
		i = i + 1
	end
	#p "binary is #{binary}"
	$bit_siten[n] = binary.to_i(2)+1
end
# tate_index?????????????´??????????S???????????????????????????????????????n???tate?????????
tate = Array.new(N+1).map{[]}
(N+1).times do |n|
	($bit_siten[n]..n).each do |tate_index|
		#p "#{tate_index}, with n is #{n}"
		tate[tate_index] << n
	end
end


def sum(n)
	if $bit_siten[n]==1
		$bit[n]
	else
		sum($bit_siten[n]-1)+$bit[n]
	end
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 $bit
		#p "sum y is #{sum(y)}, sum x is #{sum(x-1)}"
		p sum(y)-sum(x-1)
	end
end