#include <bits/stdc++.h>
#include <atcoder/all>

using namespace std;
using namespace atcoder;

typedef long long ll;
#define REP(i,n) for(int i=0,_n=(int)(n);i<_n;++i)
#define ALL(v) (v).begin(),(v).end()
#define CLR(t,v) memset(t,(v),sizeof(t))
template<class T1,class T2>ostream& operator<<(ostream& os,const pair<T1,T2>&a){return os<<"("<<a.first<<","<<a.second<< ")";}
template<class T>void pv(T a,T b){for(T i=a;i!=b;++i)cout<<(*i)<<" ";cout<<endl;}
template<class T>void chmin(T&a,const T&b){if(a>b)a=b;}
template<class T>void chmax(T&a,const T&b){if(a<b)a=b;}

ll nextLong() { ll x; scanf("%lld", &x); return x;}


int main2() {
  int N = nextLong();
  int Q = nextLong();
  fenwick_tree<ll> fw(N+10);
  REP(i, N) {
    int x = nextLong();
    fw.add(i, x);
  }
  REP(qqq, Q) {
    int t = nextLong();
    if (t == 0) {
      int p = nextLong();
      int x = nextLong();
      fw.add(p, x);
    }
    else
    {
      int l = nextLong();
      int r = nextLong();
      ll ans = fw.sum(l, r);
      cout << ans << '\n';
    }
  }

  
  return 0;
}

int main() {

#ifdef LOCAL
  for (;!cin.eof();cin>>ws)
#endif
    main2();
  return 0;
}
#include <iostream>
#include <stdio.h>
using namespace std;

double sum(int b[],int);
void bubble(int b[],int);


int main(){
    int a;
    cin >> a;
    int b[a];
    for (int i=0;i<a;i++)
        cin >> b[i];
    bubble(b,a);
    cout << b[0] << " " << b[a-1] << " " ;
    printf("%.0f\n",sum(b,a));
}

void bubble(int b[],int a){
    int x;
    for (int i=0;i< a-1 ;i++){
        for (int j=0;j<a-1 ;j++)
            if(b[j]>b[j+1]){
                x=b[j];
                b[j]=b[j+1];
                b[j+1]=x;
        }
    }
}

double sum(int b[], int a){
    double sum=0;
    for (int i=0;i<a;i++)
        sum += b[i];
    return sum;
}