#include <bits/stdc++.h>
using namespace std;
const int maxn = 111111;
const int mod = 1000 * 1000 * 1000;
long long a[maxn];
long long f[maxn + 100];
int main() {
  f[0] = f[1] = 1;
  for (int i = 2; i < maxn; i++) {
    f[i] = f[i - 1] + f[i - 2];
    f[i] %= mod;
  }
  long long n, m;
  cin >> n >> m;
  for (int i = 0; i < n; i++) cin >> a[i];
  for (int i = 0; i < m; i++) {
    long long t;
    cin >> t;
    if (t == 1) {
      long long x, v;
      cin >> x >> v;
      x--;
      a[x] = v;
    }
    if (t == 2) {
      long long r, l, sum = 0;
      cin >> l >> r;
      r--;
      l--;
      for (int j = 0; j <= r - l; j++) {
        sum += f[j] * a[l + j];
        sum %= mod;
      }
      cout << sum << endl;
    }
  }
  return 0;
}
