#include <bits/stdc++.h>
using namespace std;
const int p = 1e9 + 7;
const int maxn = 1e5 + 1;
void solve() {
  int n;
  cin >> n;
  long long int a[n], diff[n];
  for (int i = 0; i < n; i++) cin >> a[i];
  long long int K = 0;
  long long int zero = 0;
  for (int i = 1; i < n; i++) {
    diff[i] = a[i] - a[i - 1];
    K += max(diff[i], zero);
  }
  long long int ans = ceil(double(a[0] + K) / 2);
  cout << ans << "\n";
  int q, l, r, x;
  cin >> q;
  for (int i = 0; i < q; i++) {
    cin >> l >> r >> x;
    if (l == 1) {
      a[0] += x;
    } else {
      long long int pre = diff[l - 1];
      long long int now = diff[l - 1] + x;
      if (pre <= 0 && now >= 0)
        K += now;
      else if (pre >= 0 && now <= 0)
        K -= pre;
      else if (pre >= 0 && now >= 0)
        K += now - pre;
      diff[l - 1] = now;
    }
    if (r != n) {
      long long int pre = diff[r];
      long long int now = diff[r] - x;
      if (pre <= 0 && now >= 0)
        K += now;
      else if (pre >= 0 && now <= 0)
        K -= pre;
      else if (pre >= 0 && now >= 0)
        K += now - pre;
      diff[r] = now;
    }
    ans = ceil(double(a[0] + K) / 2);
    cout << ans << "\n";
  }
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int t = 1;
  while (t--) solve();
  return 0;
}
