#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m;
  vector<long long> fib(200);
  fib[0] = 1;
  fib[1] = 1;
  for (int i(2); i < (103); ++i)
    fib[i] = (fib[i - 1] + fib[i - 2]) % (int(1e9));
  cin >> n >> m;
  vector<int> d(n);
  for (int i = 0; i < (n); ++i) cin >> d[i];
  for (int q = 0; q < (m); ++q) {
    int type;
    cin >> type;
    if (type == 1) {
      int x, v;
      cin >> x >> v;
      d[x - 1] = v;
    } else {
      int l, r;
      cin >> l >> r;
      --l;
      --r;
      long long res = 0;
      for (int i = 0; i < (r - l + 1); ++i) {
        res += fib[i] * d[l + i];
        res %= (int(1e9));
      }
      cout << res << endl;
    }
  }
  return 0;
}
