#include <bits/stdc++.h>
using namespace std;
int main() {
  long long f[1010];
  f[0] = f[1] = 1;
  for (int i = 2; i < 1010; i++) {
    f[i] = (f[i - 1] + f[i - 2]) % 1000000000;
  }
  int n, m;
  cin >> n >> m;
  int a[n];
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  for (int i = 0; i < m; i++) {
    int q;
    cin >> q;
    if (q == 1) {
      int x, v;
      cin >> x >> v;
      x--;
      a[x] = v;
    } else {
      int l, r;
      cin >> l >> r;
      l--;
      r--;
      long long sum = 0;
      for (int j = 0; j < r - l + 1; j++) {
        long long tmp = (f[j] * a[l + j]) % 1000000000;
        sum = (sum + tmp) % 1000000000;
      }
      cout << sum << endl;
    }
  }
  return 0;
}
