#include <bits/stdc++.h>
const int N = 1e5 + 5;
const int INF = 0x3f3f3f3f;
const long long LLINF = (1LL << 60);
using namespace std;
long long n, q;
long long a[N];
long long differ[N];
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cin >> n;
  long long tot = 0;
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
    differ[i] = a[i] - a[i - 1];
    if (differ[i] > 0 && i != 1) tot += differ[i];
  }
  long long k = (differ[1] - tot) / 2;
  cout << max(differ[1] - k, tot + k) << endl;
  cin >> q;
  while (q--) {
    long long l, r, x;
    cin >> l >> r >> x;
    if (l == 1)
      differ[1] += x;
    else {
      if (x < 0) {
        if (differ[l] > 0) tot -= min(differ[l], -x);
      } else {
        if (differ[l] + x >= 0) tot += min(differ[l] + x, x);
      }
      differ[l] += x;
    }
    if (r + 1 <= n) {
      if (x > 0) {
        if (differ[r + 1] > 0) tot -= min(differ[r + 1], x);
      } else {
        if (differ[r + 1] - x >= 0) tot += min(differ[r + 1] - x, -x);
      }
      differ[r + 1] -= x;
    }
    k = (differ[1] - tot) / 2;
    cout << max(differ[1] - k, tot + k) << endl;
  }
  return 0;
}
