#include <bits/stdc++.h>
using namespace std;
const int mod = 1e9;
int main() {
  vector<long long> f;
  f.push_back(1);
  f.push_back(1);
  for (int i = 2; i < 100; i++) {
    f.push_back((f[i - 2] + f[i - 1]) % mod);
  }
  int n, m;
  cin >> n >> m;
  vector<long long> a(n);
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  for (int i = 0; i < m; i++) {
    int q, x, y;
    cin >> q >> x >> y;
    if (q == 1) {
      a[x - 1] = y;
    } else {
      long long res = 0;
      for (int j = 0; j <= y - x; j++) {
        res += (f[j] * a[x - 1 + j]);
        res %= mod;
      }
      cout << res << "\n";
    }
  }
  return 0;
}
