#include <bits/stdc++.h>
using namespace std;
const int N = 200500;
const int MOD = 1e9;
int n, m, a[N];
int fib[N];
int main() {
  fib[0] = fib[1] = 1;
  for (int i = 2; i < N; i++) fib[i] = (fib[i - 1] + fib[i - 2]) % MOD;
  scanf("%d%d", &n, &m);
  for (int i = 0; i < n; i++) scanf("%d", &a[i]);
  for (int i = 0; i < m; i++) {
    int type;
    scanf("%d", &type);
    if (type == 1) {
      int x, v;
      scanf("%d%d", &x, &v);
      x--;
      a[x] = v;
    } else {
      int l, r;
      scanf("%d%d", &l, &r);
      l--;
      r--;
      int sum = 0;
      for (int j = 0; j <= r - l; j++)
        sum = (sum + (int)(((long long)fib[j] * a[l + j]) % MOD)) % MOD;
      printf("%d\n", sum);
    }
  }
  return 0;
}
