#include <bits/stdc++.h>
using namespace std;
int main() {
  vector<long long> fib(150);
  fib[0] = fib[1] = 1;
  for (int i = 2; i < 140; i++) {
    fib[i] = (fib[i - 1] + fib[i - 2]) % 1000000000;
  }
  int n, m;
  cin >> n >> m;
  vector<long long> v(n);
  for (int i = 0; i < n; i++) cin >> v[i];
  while (m--) {
    int t;
    cin >> t;
    if (t == 1) {
      long long a, b;
      cin >> a >> b;
      a--;
      v[a] = b;
    } else {
      long long l, r;
      cin >> l >> r;
      l--;
      r--;
      long long ans = 0;
      for (int i = 0; i < r - l + 1; i++) {
        ans += fib[i] * v[l + i];
        ans %= 1000000000;
      }
      cout << ans << endl;
    }
  }
}
