#include <bits/stdc++.h>
using namespace std;
void solve() {
  int n;
  cin >> n;
  vector<long long> a(n);
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  long long k = 0;
  for (int i = 1; i < n; i++) {
    k += max(a[i] - a[i - 1], 0ll);
  }
  for (int i = n - 1; i > 0; i--) {
    a[i] = a[i] - a[i - 1];
  }
  long long g = k + a[0];
  cout << (long long)ceil((double)g / 2.0) << '\n';
  int Q;
  cin >> Q;
  while (Q--) {
    int l, r, x;
    cin >> l >> r >> x;
    l--, r--;
    if (l > 0) {
      k -= max(a[l], 0ll);
      a[l] += x;
      k += max(a[l], 0ll);
    } else {
      a[l] += x;
    }
    if (r + 1 < n) {
      k -= max(a[r + 1], 0ll);
      a[r + 1] -= x;
      k += max(a[r + 1], 0ll);
    }
    long long g = k + a[0];
    cout << (long long)(ceil((double)g / 2.0)) << '\n';
  }
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int T = 1;
  while (T--) {
    solve();
  }
  return 0;
}
