#include <bits/stdc++.h>
using namespace std;
inline long long read() {
  register long long x = 0, f = 1;
  char ch = getchar();
  while (!isdigit(ch)) {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  while (isdigit(ch)) {
    x = (x << 3) + (x << 1) + ch - '0';
    ch = getchar();
  }
  return (f == 1) ? x : -x;
}
long long n, Q, AAA, a[1010101], det[1010101];
inline bool check(long long mid) { return (a[1] - mid + AAA <= mid); }
inline long long getans() {
  long long lb = -1e15, rb = 1e15;
  long long ans = 0;
  while (lb <= rb) {
    long long mid = (lb + rb) / 2ll;
    if (check(mid))
      rb = mid - 1, ans = mid;
    else
      lb = mid + 1;
  }
  return ans;
}
signed main() {
  n = read();
  for (int i = 1; i <= n; i++) a[i] = read();
  for (int i = 2; i <= n; i++)
    det[i] = a[i] - a[i - 1], AAA += det[i] < 0 ? 0 : det[i];
  printf("%lld\n", getans());
  Q = read();
  while (Q--) {
    long long l = read(), r = read(), x = read();
    if (l == 1) a[1] += x;
    if (l != 1) AAA -= (det[l] > 0 ? det[l] : 0);
    if (r != n) AAA -= (det[r + 1] > 0 ? det[r + 1] : 0);
    det[l] += x, det[r + 1] -= x;
    if (l != 1) AAA += (det[l] > 0 ? det[l] : 0);
    if (r != n) AAA += (det[r + 1] > 0 ? det[r + 1] : 0);
    printf("%lld\n", getans());
  }
  return 0;
}
