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