module agc59
 implicit none
contains
 subroutine agc59a(a,x,y)
  integer(8),intent(in)::x,y
  integer(8),intent(inout)::a(:)
  a(x)=a(x)+y
 end subroutine agc59a
 subroutine agc59b(a,x,y)
  integer(8),intent(in)::x,y
  integer(8),intent(in)::a(:)
  print'(i0)',sum(a(x:y-1))
 end subroutine agc59b
end module agc59

program abc59
 use agc59
 implicit none
 integer(8)::N,Q,p,x,y,ia,ib
 integer(8),allocatable::a(:)
 read(*,*)N,Q
 allocate(a(N))
 read(*,*)(a(ia),ia=1,N)
 do ib=1,Q
  read(*,*)p,x,y
  if(p==0)then
   x=x+1
   call agc59a(a,x,y)
  else
   x=x+1
   y=y+1
   call agc59b(a,x,y)
  end if
 end do
 deallocate(a)
end program abc59