#include <bits/stdc++.h>
using namespace std;
inline long long read() {
  long long x = 0, f = 1;
  char ch = getchar();
  while (!isdigit(ch)) {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  while (isdigit(ch)) x = x * 10 + ch - '0', ch = getchar();
  return x * f;
}
long long a[100100];
long long b[100100];
long long calc(long long a, long long b) {
  long long mid = (b - a) / 2;
  return min(max(a + mid, b - mid), max(a + mid + 1, b - mid - 1));
}
int main() {
  long long n = read();
  long long sum = 0;
  for (long long i = 1; i <= n; ++i) a[i] = read(), b[i] = a[i] - a[i - 1];
  for (long long i = 2; i <= n; ++i) sum += max(b[i], 0ll);
  printf("%lld\n", calc(sum, a[1]));
  long long q = read();
  while (q--) {
    long long l = read(), r = read(), x = read();
    if (l != 1) {
      sum -= max(b[l], 0ll);
      b[l] += x;
      sum += max(b[l], 0ll);
    } else {
      a[1] += x;
      b[1] += x;
    }
    if (r != n) {
      sum -= max(b[r + 1], 0ll);
      b[r + 1] -= x;
      sum += max(b[r + 1], 0ll);
    }
    printf("%lld\n", calc(sum, a[1]));
  }
  return 0;
}
