import qualified Data.ByteString.Char8 as B
import Data.List
import Data.Maybe
import Control.Applicative

main = do
 [n,_] <- map read . words <$> getLine
 cxys <- map (map (fst . fromJust . B.readInt) . B.words) . B.lines <$> B.getContents
 let seg = fromList n (replicate n 0)
 mapM_ print (rsq n seg cxys)

rsq n seg = reverse . fst . foldl' process ([],seg)
 where
  process (lg,seg) [c,x,y]
   | c==0 = (lg, update n seg x y)
   | c==1 = (query n seg x y : lg, seg)


data SegTree a = Leaf a | Node a (SegTree a) (SegTree a) deriving (Eq, Show)

val :: SegTree a -> a
val (Leaf v) = v
val (Node v _ _) = v

fromList :: (Num a) => Int -> [a] -> SegTree a
fromList 1 [x] = Leaf x
fromList n xs  = Node (val left + val right) left right
 where
  n' = div n 2
  (xs1,xs2) = splitAt n' xs
  left = fromList n' xs1
  right = fromList (n-n') xs2

update :: (Num a) => Int -> SegTree a -> Int -> a -> SegTree a
update 1 (Leaf v) 1 x = Leaf (v+x)
update n (Node v l r) i x
 | i <= n' = Node (val left + val r) left r
 | otherwise = Node (val l + val right) l right
 where
  n' = div n 2
  left = update n' l i x
  right = update (n-n') r (i-n') x

query :: (Num a) => Int -> SegTree a -> Int -> Int -> a
query 1 (Leaf v) 1 1 = v
query n (Node v l r) i j
 | (i,j) == (1,n) = v
 | j <= n' = query n' l i j
 | i > n' = query (n-n') r (i-n') (j-n')
 | otherwise = query n' l i n' + query (n-n') r 1 (j-n')
 where n' = div n 2