#include <bits/stdc++.h>
using namespace std;
const long long inf = 1e9;
const long long maxn = 1e5 + 5;
long long n, q, yon[maxn], artan, azalan;
int main() {
  cin >> n;
  vector<long long> a(n);
  for (long long i = 0; i < n; i++) cin >> a[i];
  for (long long i = 1; i < n; i++) {
    yon[i] = a[i] - a[i - 1];
    if (yon[i] > 0)
      artan += yon[i];
    else
      azalan += yon[i];
  }
  cout << (artan + a[0]) / 2 + (artan + a[0] > 0 ? ((artan + a[0]) % 2) : 0)
       << '\n';
  cin >> q;
  while (q--) {
    long long l, r, x;
    cin >> l >> r >> x;
    l--;
    r--;
    if (l > 0) {
      if (yon[l] > 0) {
        artan -= yon[l];
      }
      yon[l] += x;
      if (yon[l] > 0) artan += yon[l];
    } else if (l == 0)
      a[0] += x;
    if (r < n - 1) {
      if (yon[r + 1] > 0) artan -= yon[r + 1];
      yon[r + 1] -= x;
      if (yon[r + 1] > 0) artan += yon[r + 1];
    }
    cout << (artan + a[0]) / 2 + (artan + a[0] > 0 ? ((artan + a[0]) % 2) : 0)
         << '\n';
  }
  return 0;
}
