#include <bits/stdc++.h>
using namespace std;
int n;
long long num[100005], head;
long long delta[100005], sum = 0;
void Print() {
  long long xx = (head - sum) / 2;
  cout << max(head - xx, sum + xx) << endl;
}
long long Calculate(long long pre, long long now) {
  if (pre <= 0 && now <= 0) return 0;
  if (pre > 0 && now <= 0) return -pre;
  if (pre <= 0 && now > 0) return now;
  if (pre > 0 && now > 0) return (now - pre);
}
int main() {
  cin >> n;
  num[0] = 0;
  for (int i = 1; i <= n; ++i) {
    cin >> num[i];
    delta[i] = num[i] - num[i - 1];
  }
  head = num[1];
  for (int i = 2; i <= n; ++i)
    if (delta[i] > 0) sum += delta[i];
  Print();
  int q;
  cin >> q;
  while (q--) {
    int L, R;
    long long tmp;
    cin >> L >> R >> tmp;
    if (L == 1) head += tmp;
    if (L > 1) {
      sum += Calculate(delta[L], delta[L] + tmp);
      delta[L] += tmp;
    }
    if (R < n) {
      sum += Calculate(delta[R + 1], delta[R + 1] - tmp);
      delta[R + 1] -= tmp;
    }
    Print();
  }
  return 0;
}
