#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e5 + 5;
long long a[maxn];
int main() {
  int n;
  scanf("%d", &n);
  long long sum = 0;
  for (int i = 1; i <= n; i++) {
    scanf("%lld", &a[i]);
    if (i > 1) {
      sum += max(0ll, a[i] - a[i - 1]);
    }
  }
  for (int i = n; i > 1; i--) {
    a[i] -= a[i - 1];
  }
  long long a1 = a[1];
  long long x = (a1 + sum) / 2;
  printf("%lld\n", max(x, a1 - x + sum));
  int q, l, r, t;
  scanf("%d", &q);
  while (q--) {
    scanf("%d%d%d", &l, &r, &t);
    if (l == 1) {
      a1 += t;
    } else {
      if (a[l] > 0) {
        sum -= a[l];
      }
      a[l] += t;
      if (a[l] > 0) {
        sum += a[l];
      }
    }
    if (r == n) {
    } else {
      if (a[r + 1] > 0) {
        sum -= a[r + 1];
      }
      a[r + 1] -= t;
      if (a[r + 1] > 0) {
        sum += a[r + 1];
      }
    }
    x = (a1 + sum) / 2;
    printf("%lld\n", max(x, a1 - x + sum));
  }
}
