#include <bits/stdc++.h>
using namespace std;
long long *a;
int main() {
  int n, m;
  cin >> n;
  a = new long long[n + 1];
  for (int i = 1; i <= n; ++i) cin >> a[i];
  long long sum = 0;
  for (int i = n; i >= 2; --i)
    if ((a[i] -= a[i - 1]) > 0) sum += a[i];
  long long t = a[1] + sum;
  if (t > 0)
    cout << (t + 1) / 2 << endl;
  else
    cout << t / 2 << endl;
  cin >> m;
  while (m--) {
    int l, r;
    long long v;
    cin >> l >> r >> v;
    if (l > 1) {
      if (a[l] > 0) {
        if (a[l] + v < 0)
          sum -= a[l];
        else
          sum += v;
      } else {
        if (a[l] + v > 0) sum += a[l] + v;
      }
    }
    a[l] += v;
    if (r < n) {
      if (a[r + 1] > 0) {
        if (a[r + 1] - v < 0)
          sum -= a[r + 1];
        else
          sum -= v;
      } else {
        if (a[r + 1] - v > 0) sum += a[r + 1] - v;
      }
      a[r + 1] -= v;
    }
    long long t = a[1] + sum;
    if (t > 0)
      cout << (t + 1) / 2 << endl;
    else
      cout << t / 2 << endl;
  }
  return 0;
}
