#include <bits/stdc++.h>
inline int in() {
  int x;
  scanf("%d", &x);
  return x;
}
using namespace std;
constexpr long long inf = 1e9, base = 541;
constexpr long long mod = 1e9, N = 10000 + 7;
long long a[N], f[N];
int32_t main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  long long n, m;
  cin >> n >> m;
  f[0] = f[1] = 1;
  for (long long i = 2; i < N; i++) f[i] = (f[i - 1] + f[i - 2]) % mod;
  for (long long i = 1; i <= n; i++) cin >> a[i];
  while (m--) {
    long long t, x, y;
    cin >> t >> x >> y;
    if (t == 1)
      a[x] = y;
    else {
      long long ans = 0;
      for (long long i = 0; i <= y - x; i++) {
        ans = (ans + (f[i] * 1ll * a[x + i]) % mod) % mod;
      }
      cout << ans << endl;
    }
  }
}
