#include <bits/stdc++.h>
using namespace std;
const long long mod = 1000000000;
int n, m;
long long a[200100];
long long fibo[200100];
int main() {
  fibo[0] = fibo[1] = 1;
  for (int i = 2; i < 200100; i++) {
    fibo[i] = (fibo[i - 2] + fibo[i - 1]) % mod;
  }
  scanf("%d %d", &n, &m);
  for (int i = 1; i <= n; i++) {
    scanf("%lld", a + i);
  }
  for (int ttt = 1; ttt <= m; ttt++) {
    int type;
    scanf("%d", &type);
    if (type == 1) {
      int x, v;
      scanf("%d %d", &x, &v);
      a[x] = v;
    } else if (type == 2) {
      int l, r;
      scanf("%d %d", &l, &r);
      long long ans = 0;
      for (int i = l; i <= r; i++) {
        ans = (ans + fibo[i - l] * a[i] % mod) % mod;
      }
      printf("%lld\n", ans);
    }
  }
}
