#include <bits/stdc++.h>
template <typename T>
void read(T &x) {
  x = 0;
  char ch = getchar();
  long long f = 1;
  while (!isdigit(ch)) {
    if (ch == '-') f *= -1;
    ch = getchar();
  }
  while (isdigit(ch)) {
    x = x * 10 + ch - 48;
    ch = getchar();
  }
  x *= f;
}
using namespace std;
long long a[100010], b[100010];
int main() {
  int n, m;
  int l, r, x;
  long long ans = 0, tmp;
  scanf("%d", &n);
  for (int i = 1; i <= n; ++i) {
    scanf("%lld", &a[i]);
    b[i] = a[i] - a[i - 1];
    if (i > 1 && b[i] > 0) ans += b[i];
  }
  tmp = ans + b[1];
  if (tmp & 1) ++tmp;
  printf("%lld\n", tmp / 2);
  scanf("%d", &m);
  while (m--) {
    scanf("%d%d%d", &l, &r, &x);
    long long f = b[l], g = b[r + 1];
    b[l] += x;
    b[r + 1] -= x;
    if (l > 1) {
      if (f <= 0 && b[l] > 0)
        ans += b[l];
      else if (f > 0 && b[l] <= 0)
        ans -= f;
      else if (f > 0 && b[l] > 0)
        ans += b[l] - f;
    }
    if (r < n) {
      if (g <= 0 && b[r + 1] > 0)
        ans += b[r + 1];
      else if (g > 0 && b[r + 1] <= 0)
        ans -= g;
      else if (g > 0 && b[r + 1] > 0)
        ans += b[r + 1] - g;
    }
    tmp = ans + b[1];
    if (tmp & 1) ++tmp;
    printf("%lld\n", tmp / 2);
  }
  return 0;
}
