#include <bits/stdc++.h>
using namespace std;
const int N = 1e6 + 10;
long long LINF = 1e18;
long long INF = 1e9;
long long MOD = 998244353;
long long a[N], d[N];
long long tree[N], lazy[N];
int n, q;
void push(int v, int l, int r) {
  tree[v] += lazy[v];
  if (l != r) {
    lazy[v * 2] += lazy[v];
    lazy[v * 2 + 1] += lazy[v];
  }
  lazy[v] = 0;
}
void update(int v, int tl, int tr, int l, int r, long long val) {
  push(v, tl, tr);
  if (tl > r || tr < l) return;
  if (tl >= l && tr <= r) {
    lazy[v] += val;
    push(v, tl, tr);
    return;
  }
  int mid = (tl + tr) / 2;
  update(v * 2, tl, mid, l, r, val);
  update(v * 2 + 1, mid + 1, tr, l, r, val);
}
long long query(int v, int l, int r, int pos) {
  push(v, l, r);
  if (l == r) return tree[v];
  int mid = (l + r) / 2;
  if (pos <= mid)
    return query(v * 2, l, mid, pos);
  else
    return query(v * 2 + 1, mid + 1, r, pos);
}
long long get_ans(long long val) {
  long long inc = query(1, 1, n, 1);
  if (val + inc + a[1] < 0)
    return (val + inc + a[1]) / 2;
  else
    return (val + inc + 1 + a[1]) / 2;
}
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) scanf("%lld\n", &a[i]);
  long long sum = 0;
  for (int i = 2; i <= n; i++)
    sum += max(0ll, a[i] - a[i - 1]), d[i] = a[i] - a[i - 1];
  printf("%lld\n", get_ans(sum));
  scanf("%d", &q);
  while (q--) {
    long long l, r, val;
    scanf("%lld%lld%lld", &l, &r, &val);
    update(1, 1, n, l, r, val);
    if (l > 1 && d[l] <= 0 && d[l] + val > 0) sum += d[l] + val;
    if (r < n && d[r + 1] <= 0 && d[r + 1] - val > 0) sum += d[r + 1] - val;
    if (l > 1 && d[l] > 0) sum += -d[l] + max(0ll, d[l] + val);
    if (r < n && d[r + 1] > 0) sum += -d[r + 1] + max(0ll, d[r + 1] - val);
    d[l] += val;
    d[r + 1] -= val;
    printf("%lld\n", get_ans(sum));
  }
}
