#include <bits/stdc++.h>
long long fib[200111];
long long the[2][(1 << 20)], t[(1 << 20)];
int T;
int n, q, i, j, k;
long long query(int l, int r, int id, int b) {
  if (l == 1 && r == t[id]) return the[1][id];
  if (l || r != t[id]) {
    if (r <= t[(id << 1)]) return query(l, r, (id << 1), b);
    if (l >= t[(id << 1)])
      return query(l - t[(id << 1)], r - t[(id << 1)], (id << 1 ^ 1), b);
    return (query(l, t[(id << 1)], (id << 1), b) +
            query(0, r - t[(id << 1)], (id << 1 ^ 1), b + t[(id << 1)] - l)) %
           1000000000ll;
  }
  return (the[0][id] * fib[b] + the[1][id] * (b ? fib[b - 1] : 0)) %
         1000000000ll;
}
int main() {
  fib[0] = fib[1] = 1ll;
  for (i = 2; i < 200111; ++i)
    fib[i] = (fib[i - 1] + fib[i - 2]) % 1000000000ll;
  scanf("%d %d", &n, &q);
  for (T = 1; T < n; T <<= 1)
    ;
  for (i = 0; i < n; ++i) scanf("%I64d", the[0] + i + T);
  for (i = 0; i < T; ++i) t[i + T] = 1;
  for (i = T - 1; i >= 0; --i) {
    t[i] = t[i << 1] << 1;
    the[0][i] = (query(0, t[i << 1], i << 1, 0) +
                 query(0, t[i << 1], i << 1 ^ 1, t[i << 1])) %
                1000000000ll;
    the[1][i] = (query(1, t[i << 1], i << 1, 0) +
                 query(0, t[i << 1], i << 1 ^ 1, t[i << 1] - 1)) %
                1000000000ll;
  }
  while (q--) {
    scanf("%d", &i);
    if (i == 1) {
      scanf("%d %d", &i, &j);
      i += T - 1;
      the[0][i] = j;
      while (i >>= 1) {
        the[0][i] = (query(0, t[i << 1], i << 1, 0) +
                     query(0, t[i << 1], i << 1 ^ 1, t[i << 1])) %
                    1000000000ll;
        the[1][i] = (query(1, t[i << 1], i << 1, 0) +
                     query(0, t[i << 1], i << 1 ^ 1, t[i << 1] - 1)) %
                    1000000000ll;
      }
    } else {
      scanf("%d %d", &i, &j);
      printf("%I64d\n", query(--i, j, 1, 0));
    }
  }
  return 0;
}
