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