#include <bits/stdc++.h>
using namespace std;
const int mod = 1e9;
int n, m;
long long a[200100], fibo[200100], sumfibo[200100];
struct Segment_Tree {
  int left, right, len;
  long long s0, s1;
} tree[200100 << 2];
struct Data {
  long long a[2][2];
} bb[200100], one, b;
Data operator*(const Data x, const Data y) {
  Data res;
  res.a[0][0] =
      (x.a[0][0] * y.a[0][0] % mod + x.a[0][1] * y.a[1][0] % mod) % mod;
  res.a[0][1] =
      (x.a[0][0] * y.a[0][1] % mod + x.a[0][1] * y.a[1][1] % mod) % mod;
  res.a[1][0] =
      (x.a[1][0] * y.a[0][0] % mod + x.a[1][1] * y.a[1][0] % mod) % mod;
  res.a[1][1] =
      (x.a[1][0] * y.a[0][1] % mod + x.a[1][1] * y.a[1][1] % mod) % mod;
  return res;
}
long long cal_fx(long long s0, long long s1, int l) {
  long long res;
  res = (bb[l - 1].a[0][0] * s1 % mod + bb[l - 1].a[0][1] * s0 % mod) % mod;
  return res;
}
void plant_tree(int id, int l, int r) {
  tree[id].left = l, tree[id].right = r;
  tree[id].len = r - l + 1;
  if (l == r) {
    tree[id].s0 = fibo[0] * a[l] % mod;
    tree[id].s1 = fibo[1] * a[l] % mod;
    return;
  }
  int mid = (l + r) >> 1;
  plant_tree(id << 1, l, mid);
  plant_tree(id << 1 | 1, mid + 1, r);
  tree[id].s0 =
      (tree[id << 1].s0 +
       cal_fx(tree[id << 1 | 1].s0, tree[id << 1 | 1].s1, tree[id << 1].len)) %
      mod;
  tree[id].s1 =
      (tree[id << 1].s1 + cal_fx(tree[id << 1 | 1].s0, tree[id << 1 | 1].s1,
                                 tree[id << 1].len + 1)) %
      mod;
}
void push_down() {}
void update_pos(int id, int pos, long long val) {
  if (tree[id].left == tree[id].right) {
    tree[id].s0 = fibo[0] * val % mod;
    tree[id].s1 = fibo[1] * val % mod;
    return;
  }
  int mid = (tree[id].left + tree[id].right) >> 1;
  if (pos <= mid)
    update_pos(id << 1, pos, val);
  else
    update_pos(id << 1 | 1, pos, val);
  tree[id].s0 =
      (tree[id << 1].s0 +
       cal_fx(tree[id << 1 | 1].s0, tree[id << 1 | 1].s1, tree[id << 1].len)) %
      mod;
  tree[id].s1 =
      (tree[id << 1].s1 + cal_fx(tree[id << 1 | 1].s0, tree[id << 1 | 1].s1,
                                 tree[id << 1].len + 1)) %
      mod;
}
Segment_Tree query(int id, int l, int r) {
  if (tree[id].left == l && tree[id].right == r) {
    return tree[id];
  }
  int mid = (tree[id].left + tree[id].right) >> 1;
  if (r <= mid)
    return query(id << 1, l, r);
  else if (mid < l)
    return query(id << 1 | 1, l, r);
  else {
    Segment_Tree leftson, rightson, now;
    leftson = query(id << 1, l, mid);
    rightson = query(id << 1 | 1, mid + 1, r);
    now.s0 = (leftson.s0 + cal_fx(rightson.s0, rightson.s1, leftson.len)) % mod;
    now.s1 =
        (leftson.s1 + cal_fx(rightson.s0, rightson.s1, leftson.len + 1)) % mod;
    now.len = leftson.len + rightson.len;
    return now;
  }
}
int main() {
  fibo[0] = fibo[1] = 1;
  for (int i = 2; i < 200100; i++) {
    fibo[i] = (fibo[i - 2] + fibo[i - 1]) % mod;
  }
  sumfibo[0] = fibo[0];
  for (int i = 1; i < 200100; i++) {
    sumfibo[i] = (sumfibo[i - 1] + fibo[i]) % mod;
  }
  one.a[0][0] = one.a[1][1] = 1;
  one.a[1][0] = one.a[0][1] = 0;
  b.a[0][0] = b.a[0][1] = b.a[1][0] = 1;
  b.a[1][1] = 0;
  bb[0] = one;
  for (int i = 1; i < 200100; i++) {
    bb[i] = bb[i - 1] * b;
  }
  scanf("%d %d", &n, &m);
  for (int i = 1; i <= n; i++) {
    scanf("%lld", a + i);
  }
  plant_tree(1, 1, n);
  while (m--) {
    int type;
    scanf("%d", &type);
    if (type == 1) {
      int x, v;
      scanf("%d %d", &x, &v);
      update_pos(1, x, v);
    } else if (type == 2) {
      int l, r;
      scanf("%d %d", &l, &r);
      Segment_Tree res = query(1, l, r);
      printf("%lld\n", res.s0);
    } else if (type == 3) {
      int l, r, d;
      scanf("%d %d %d", &l, &r, &d);
    }
  }
}
