#include <bits/stdc++.h>
using namespace std;
long long a[200005];
long long b[200005], c;
int q;
int n;
int main() {
  scanf("%d", &n);
  for (int i = 1, x; i <= n; ++i) {
    scanf("%lld", a + i);
  }
  for (int i = n; i; --i) {
    a[i] -= a[i - 1];
  }
  for (int i = 2; i <= n; ++i) {
    b[i] = b[i - 1];
    if (a[i] > 0) {
      b[i] += a[i];
    }
  }
  c = a[1];
  scanf("%d", &q);
  printf("%lld\n", (b[n] + (b[n] + c > 0) + c) / 2);
  for (int l, r, x; q; --q) {
    scanf("%d%d%d", &l, &r, &x);
    if (l != 1) {
      if (a[l] > 0) {
        b[n] -= a[l];
      }
      if (a[l] + x > 0) b[n] += x + a[l];
      a[l] += x;
    } else {
      c += x;
    }
    if (r < n) {
      if (a[r + 1] > 0) {
        b[n] -= a[r + 1];
      }
      if (a[r + 1] - x > 0) {
        b[n] += a[r + 1] - x;
      }
      a[r + 1] -= x;
    }
    printf("%lld\n", (b[n] + (b[n] + c > 0) + c) / 2);
  }
  return 0;
}
