#include <bits/stdc++.h>
using namespace std;
void update(long long int seg[], int s, int e, int st, int et, int ind,
            int su) {
  if (s == st && e == et) {
    seg[ind] += su;
    return;
  }
  int m = s + (e - s) / 2;
  if (st <= m) update(seg, s, m, st, min(et, m), 2 * ind + 1, su);
  if (et > m) update(seg, m + 1, e, max(m + 1, st), et, 2 * ind + 2, su);
  return;
}
long long int seek(long long int seg[], int ind, int s, int e, int p) {
  if (s == e) {
    return seg[ind];
  }
  int m = s + (e - s) / 2;
  if (p <= m)
    return seg[ind] + seek(seg, 2 * ind + 1, s, m, p);
  else
    return seg[ind] + seek(seg, 2 * ind + 2, m + 1, e, p);
}
void answer(long long int ans) {
  if (ans < 0) {
    cout << "-";
    ans = -ans;
  }
  stack<char> c;
  do {
    c.push(ans % 10 + '0');
    ans /= 10;
  } while (ans);
  while (c.size()) {
    cout << (int)(c.top() - '0');
    c.pop();
  }
  cout << endl;
  return;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int t = 1;
  int n, m, i, j, k, q;
  cin >> n;
  int a[n];
  for (i = 0; i < n; i++) cin >> a[i];
  long long int c = a[0];
  long long int sum = 0;
  for (i = 1; i < n; i++) {
    sum += max(0, a[i] - a[i - 1]);
  }
  if ((c + sum) % 2 == 0)
    answer((c + sum) / 2);
  else
    answer((c + sum + 1) / 2);
  long long int seg[4 * n + 4];
  for (i = 0; i < 4 * n + 4; i++) seg[i] = 0;
  cin >> q;
  while (q--) {
    int l, r, x;
    cin >> l >> r >> x;
    long long int p, s, t, f;
    l--;
    r--;
    if (l > 0) p = a[l - 1] + seek(seg, 0, 0, n - 1, l - 1);
    s = a[l] + seek(seg, 0, 0, n - 1, l);
    f = a[r] + seek(seg, 0, 0, n - 1, r);
    if (r < n - 1) t = a[r + 1] + seek(seg, 0, 0, n - 1, r + 1);
    update(seg, 0, n - 1, l, r, 0, x);
    c = a[0] + seek(seg, 0, 0, n - 1, 0);
    if (l > 0) sum += max(0ll, s + x - p) - max(0ll, s - p);
    if (r < n - 1) sum += max(0ll, t - f - x) - max(0ll, t - f);
    if ((c + sum) % 2 == 0)
      answer((c + sum) / 2);
    else
      answer((c + sum + 1) / 2);
  }
}
