#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m;
  cin >> n >> m;
  long long p = 1000000000;
  vector<int> a;
  a.resize(n);
  long long fib[100];
  fib[0] = 1;
  fib[1] = 1;
  for (long long i = 2; i < 100; i++) fib[i] = (fib[i - 1] + fib[i - 2]) % p;
  for (int i = 0; i < n; i++) cin >> a[i];
  long long t, x, y;
  for (int i = 0; i < m; i++) {
    cin >> t >> x >> y;
    if (t == 1) {
      x--;
      a[x] = y;
    } else {
      x--;
      y--;
      long long res = 0;
      for (long long j = 0; j + x <= y; j++) {
        res += a[x + j] * fib[j];
        res = res % p;
      }
      cout << res << endl;
    }
  }
  return 0;
}
