#include <bits/stdc++.h>
using namespace std;
const long long mod = 1e9 + 7;
const double eps = 1e-8;
const long long LINF = 0x3f3f3f3f3f3f3f3f;
const int INF = 0x3f3f3f3f;
const long long maxn = 1e5 + 100;
long long a[maxn];
long long sum = 0;
long long n;
void check(long long l, long long x) {
  if (l > n) return;
  if (a[l] > 0) sum -= a[l];
  a[l] += x;
  if (a[l] > 0) sum += a[l];
}
signed main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cin >> n;
  for (long long i = 1; i <= n; i++) cin >> a[i];
  long long al = a[1];
  for (long long i = 2; i <= n; i++) {
    if (a[i] - a[i - 1] >= 0) sum += a[i] - a[i - 1];
  }
  for (long long i = n; i >= 1; i--) {
    a[i] = a[i] - a[i - 1];
  }
  cout << max((sum + al) / 2, sum + al - (sum + al) / 2) << '\n';
  long long q;
  cin >> q;
  while (q--) {
    long long l, r, x;
    cin >> l >> r >> x;
    if (l == 1)
      al += x;
    else
      check(l, x);
    check(r + 1, -x);
    cout << max((sum + al) / 2, sum + al - (sum + al) / 2) << '\n';
  }
  return 0;
}
