#include <bits/stdc++.h>
using namespace std;
const long long N = 1e5 + 5;
long long read() {
  long long s = 0;
  char c = getchar(), lc = '+';
  while (c < '0' || '9' < c) lc = c, c = getchar();
  while ('0' <= c && c <= '9') s = s * 10 + c - '0', c = getchar();
  return lc == '-' ? -s : s;
}
void write(long long x) {
  if (x < 0) {
    putchar('-');
    x = -x;
  }
  if (x < 10)
    putchar(x + '0');
  else {
    write(x / 10);
    putchar(x % 10 + '0');
  }
}
void print(long long x, char c = '\n') {
  write(x);
  putchar(c);
}
void Print(long long x) {
  if (x & 1) x++;
  print(x / 2);
}
long long n, Max1 = 0, Max2 = 0, a[N];
void add(long long l, long long x) {
  l--;
  if (l == 0) Max1 += x;
  if (l < 1 || n <= l) return;
  if (a[l] > 0) Max2 -= a[l];
  a[l] += x;
  if (a[l] > 0) Max2 += a[l];
}
signed main() {
  n = read();
  for (long long i = 1; i <= n; i++) a[i] = read();
  Max1 = a[1];
  for (long long i = 1; i <= n; i++) a[i] = a[i + 1] - a[i];
  for (long long i = 1; i < n; i++)
    if (a[i] > 0) Max2 += a[i];
  Print(Max1 + Max2);
  long long m = read();
  for (long long i = 1; i <= m; i++) {
    long long l = read(), r = read(), x = read();
    add(l, x);
    add(r + 1, -x);
    Print(Max1 + Max2);
  }
  return 0;
}
