#include <bits/stdc++.h>
using namespace std;
const int maxn = 100010;
long long a[maxn], d[maxn], sum_pos, sum_neg, x;
int n, q, l, r;
long long cal() {
  long long tmp = (a[1] - sum_pos) / 2;
  return max(a[1] - tmp, tmp + sum_pos);
}
void change(int p, long long x) {
  if (d[p] >= 0)
    sum_pos -= d[p];
  else
    sum_neg -= abs(d[p]);
  d[p] += x;
  if (d[p] >= 0)
    sum_pos += d[p];
  else
    sum_neg += abs(d[p]);
}
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) scanf("%lld", a + i);
  for (int i = 2; i <= n; i++) {
    d[i] = a[i] - a[i - 1];
    if (d[i] > 0)
      sum_pos += d[i];
    else
      sum_neg += abs(d[i]);
  }
  printf("%lld\n", cal());
  scanf("%d", &q);
  while (q--) {
    scanf("%d%d%lld", &l, &r, &x);
    if (l == 1) a[1] += x;
    if (l > 1) {
      change(l, x);
    }
    if (r < n) {
      change(r + 1, -x);
    }
    printf("%lld\n", cal());
  }
  return 0;
}
