#include <bits/stdc++.h>
using namespace std;
long long powm(long long a, long long b, long long mod) {
  if (b == 0) return 1;
  if (b % 2 == 0) {
    long long tmp = powm(a, b / 2, mod);
    return (tmp * tmp) % mod;
  } else
    return (a % mod * powm(a, b - 1, mod)) % mod;
}
long long invm(long long a, long long mod) { return powm(a, mod - 2, mod); }
long long mod = 1000000007;
void solve() {
  long long n;
  cin >> n;
  long long a[n];
  for (long long &i : a) cin >> i;
  long long k = 0;
  for (long long i = 1; i < n; i++) k += max(0ll, a[i] - a[i - 1]);
  for (long long i = n - 1; i > 0; i--) a[i] = a[i] - a[i - 1];
  long long ret;
  if (a[0] + k > 0)
    ret = (a[0] + k + 1) / 2;
  else
    ret = (a[0] + k) / 2;
  cout << ret << endl;
  long long q;
  cin >> q;
  while (q--) {
    long long l, r, x;
    cin >> l >> r >> x;
    l--;
    r--;
    if (l > 0) {
      k -= max(0ll, a[l]);
      a[l] += x;
      k += max(0ll, a[l]);
    } else
      a[0] += x;
    if (r < n - 1) {
      k -= max(0ll, a[r + 1]);
      a[r + 1] -= x;
      k += max(0ll, a[r + 1]);
    }
    if (a[0] + k > 0)
      ret = (a[0] + k + 1) / 2;
    else
      ret = (a[0] + k) / 2;
    cout << ret << endl;
  }
}
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  cout << fixed << setprecision(12);
  long long t = 1, tc = 1;
  while (t--) {
    solve();
  }
  return 0;
}
