#include <bits/stdc++.h>
using namespace std;
template <typename T>
inline T abs(T n) {
  return (n < 0 ? -n : n);
}
template <typename T>
inline T sqr(T n) {
  return (n * n);
}
long long f[100000];
int main() {
  ios_base ::sync_with_stdio(false);
  int n, m;
  cin >> n >> m;
  vector<int> a(n);
  for (int i = 0; i < n; i++) cin >> a[i];
  f[0] = f[1] = 1;
  for (int i = 2; i < 100000; i++) {
    f[i] = (f[i - 1] + f[i - 2]) % (1000 * 1000 * 1000);
  }
  int t;
  for (int i = 0; i < m; i++) {
    cin >> t;
    switch (t) {
      case 1:
        int x, v;
        cin >> x >> v;
        a[x - 1] = v;
        break;
      case 2:
        long long ans = 0;
        int l, r;
        cin >> l >> r;
        r--, l--;
        for (int j = 0; j <= r - l; j++)
          ans = (ans + f[j] * a[l + j]) % (1000 * 1000 * 1000);
        cout << ans << endl;
        break;
    }
  }
  return 0;
}
