#include <bits/stdc++.h>
using namespace std;
struct Tree {
  long long sum = 0;
  long long mx = 0;
};
Tree tr_up[400005], tr_down[400005];
void add(Tree tr[], int n, int l, int r, int nl, int nr, long long diff) {
  if (nl <= l && r <= nr) {
    tr[n].sum += diff;
    tr[n].mx += diff;
    return;
  }
  if (nr < l || r < nl) {
    return;
  }
  {
    int m = (l + r) / 2;
    add(tr, n * 2, l, m, nl, nr, diff);
    add(tr, n * 2 + 1, m + 1, r, nl, nr, diff);
    tr[n].mx = max(tr[n * 2].mx, tr[n * 2 + 1].mx) + tr[n].sum;
  }
}
long long get_best_max(Tree tr_up[], Tree tr_down[]) {
  long long max_up = tr_up[1].mx, max_down = tr_down[1].mx;
  return max(max_up, max_down) - abs(max_down - max_up) / 2;
}
void get_tree(Tree tr[], int n, int l, int r, int diff) {
  if (l == r)
    cout << tr[n].sum + diff << " ";
  else {
    int m = (l + r) / 2;
    get_tree(tr, n * 2, l, m, diff + tr[n].sum);
    get_tree(tr, n * 2 + 1, m + 1, r, diff + tr[n].sum);
  }
}
int main() {
  int n;
  cin >> n;
  vector<int> a;
  for (int i = 0; i < n; i++) {
    int x;
    cin >> x;
    a.push_back(x);
  }
  long long prefix_sum[100001] = {};
  int last = 0;
  for (int i = 0; i < n; i++) {
    prefix_sum[i] = a[i] - last;
    if (prefix_sum[i] >= 0)
      add(tr_up, 1, 0, n - 1, i, n - 1, prefix_sum[i]);
    else
      add(tr_down, 1, 0, n - 1, i, n - 1, prefix_sum[i]);
    last = a[i];
  }
  cout << get_best_max(tr_up, tr_down) << "\n";
  int q;
  cin >> q;
  for (int i = 0; i < q; i++) {
    int l, r, diff;
    cin >> l >> r >> diff;
    l--, r--;
    if (prefix_sum[l] >= 0)
      add(tr_up, 1, 0, n - 1, l, n - 1, -prefix_sum[l]);
    else
      add(tr_down, 1, 0, n - 1, l, n - 1, -prefix_sum[l]);
    prefix_sum[l] += diff;
    if (prefix_sum[l] >= 0)
      add(tr_up, 1, 0, n - 1, l, n - 1, prefix_sum[l]);
    else
      add(tr_down, 1, 0, n - 1, l, n - 1, prefix_sum[l]);
    if (prefix_sum[r + 1] >= 0)
      add(tr_up, 1, 0, n - 1, r + 1, n - 1, -prefix_sum[r + 1]);
    else
      add(tr_down, 1, 0, n - 1, r + 1, n - 1, -prefix_sum[r + 1]);
    prefix_sum[r + 1] += -diff;
    if (prefix_sum[r + 1] >= 0)
      add(tr_up, 1, 0, n - 1, r + 1, n - 1, prefix_sum[r + 1]);
    else
      add(tr_down, 1, 0, n - 1, r + 1, n - 1, prefix_sum[r + 1]);
    cout << get_best_max(tr_up, tr_down) << "\n";
  }
  return 0;
}
