#include <bits/stdc++.h>
using namespace std;
const int N_MAX = 200002;
const int MOD = 1e9;
int n, m;
int a[N_MAX];
int fibo[N_MAX];
struct SGTNode {
  int s0, s1;
  int lg;
};
SGTNode SGT[N_MAX * 4];
int fs(int x, int s0, int s1) {
  if (x == 0) return s0;
  if (x == 1) return s1;
  return (1LL * fibo[x - 2] * s0 % MOD + 1LL * fibo[x - 1] * s1 % MOD) % MOD;
}
SGTNode join(const SGTNode &a, const SGTNode &b) {
  SGTNode ans;
  ans.lg = a.lg + b.lg;
  ans.s0 = (a.s0 + fs(a.lg, b.s0, b.s1)) % MOD;
  ans.s1 = (a.s1 + fs(a.lg + 1, b.s0, b.s1)) % MOD;
  return ans;
}
void build(int node, int l, int r) {
  if (l == r) {
    SGT[node].s0 = a[l];
    SGT[node].s1 = a[l];
    SGT[node].lg = 1;
    return;
  }
  int mid = ((l + r) >> 1), lSon = (node << 1), rSon = (lSon | 1);
  build(lSon, l, mid);
  build(rSon, mid + 1, r);
  SGT[node] = join(SGT[lSon], SGT[rSon]);
}
void update(int node, int l, int r, int upos, int uval) {
  if (l == r) {
    SGT[node].s0 = uval;
    SGT[node].s1 = uval;
    return;
  }
  int mid = ((l + r) >> 1), lSon = (node << 1), rSon = (lSon | 1);
  if (upos <= mid)
    update(lSon, l, mid, upos, uval);
  else
    update(rSon, mid + 1, r, upos, uval);
  SGT[node] = join(SGT[lSon], SGT[rSon]);
}
SGTNode query(int node, int l, int r, int ql, int qr) {
  if (ql <= l && r <= qr) return SGT[node];
  int mid = ((l + r) >> 1), lSon = (node << 1), rSon = (lSon | 1);
  if (ql <= mid && mid + 1 <= qr)
    return join(query(lSon, l, mid, ql, qr), query(rSon, mid + 1, r, ql, qr));
  if (ql <= mid)
    return query(lSon, l, mid, ql, qr);
  else
    return query(rSon, mid + 1, r, ql, qr);
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cin >> n >> m;
  for (int i = 1; i <= n; i++) cin >> a[i];
  fibo[0] = 1;
  fibo[1] = 1;
  for (int i = 2; i <= n; i++) fibo[i] = (fibo[i - 1] + fibo[i - 2]) % MOD;
  build(1, 1, n);
  while (m--) {
    int type;
    cin >> type;
    if (type == 1) {
      int upos, uval;
      cin >> upos >> uval;
      update(1, 1, n, upos, uval);
    }
    if (type == 2) {
      int ql, qr;
      cin >> ql >> qr;
      cout << query(1, 1, n, ql, qr).s0 << "\n";
    }
  }
  return 0;
}
