#include <bits/stdc++.h>
using namespace std;
long long int tree[400005], lazy[400005], n;
void update(long long int node, long long int st, long long int ed,
            long long int l, long long int r, long long int val) {
  if (l < 1 || r > n) return;
  if (lazy[node] != 0) {
    tree[node] += ((ed - st + 1) * lazy[node]);
    if (st != ed) {
      lazy[2 * node] += lazy[node];
      lazy[2 * node + 1] += lazy[node];
    }
    lazy[node] = 0;
  }
  if (r < st || ed < l) return;
  if (l <= st && ed <= r) {
    tree[node] += (ed - st + 1) * val;
    if (st != ed) {
      lazy[2 * node] += val;
      lazy[2 * node + 1] += val;
    }
  } else {
    int mid = (st + ed) / 2;
    update(2 * node, st, mid, l, r, val);
    update(2 * node + 1, mid + 1, ed, l, r, val);
    tree[node] = tree[2 * node] + tree[2 * node + 1];
  }
}
long long int query(long long int node, long long int st, long long int ed,
                    long long int l, long long int r) {
  if (l < 1 || r > n) return 0;
  if (lazy[node] != 0) {
    tree[node] += ((ed - st + 1) * lazy[node]);
    if (st != ed) {
      lazy[2 * node] += lazy[node];
      lazy[2 * node + 1] += lazy[node];
    }
    lazy[node] = 0;
  }
  if (r < st || ed < l) {
    return 0;
  } else if (l <= st && ed <= r) {
    return tree[node];
  } else {
    long long int mid = (st + ed) / 2;
    long long int val1 = query(2 * node, st, mid, l, r);
    long long int val2 = query(2 * node + 1, mid + 1, ed, l, r);
    return val1 + val2;
  }
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long int i;
  cin >> n;
  long long int a[n + 1], sum = 0;
  for (i = 1; i <= n; ++i) {
    cin >> a[i];
    update(1, 1, n, i, i, a[i]);
    if (i != 1) sum += max((long long int)(0), a[i] - a[i - 1]);
  }
  long long int ans = (a[1] + sum) / 2;
  cout << max(ans, a[1] + sum - ans) << "\n";
  long long int q;
  cin >> q;
  while (q--) {
    long long int l, r, e;
    cin >> l >> r >> e;
    if (l != 1)
      sum -= max((long long int)(0),
                 query(1, 1, n, l, l) - query(1, 1, n, l - 1, l - 1));
    if (r != n)
      sum -= max((long long int)(0),
                 query(1, 1, n, r + 1, r + 1) - query(1, 1, n, r, r));
    update(1, 1, n, l, r, e);
    if (l != 1)
      sum += max((long long int)(0),
                 query(1, 1, n, l, l) - query(1, 1, n, l - 1, l - 1));
    if (r != n)
      sum += max((long long int)(0),
                 query(1, 1, n, r + 1, r + 1) - query(1, 1, n, r, r));
    ans = query(1, 1, n, 1, 1) + sum;
    cout << max(ans / 2, ans - ans / 2) << "\n";
  }
  return 0;
}
