#include <bits/stdc++.h>
template <typename T>
inline void read(T &x) {
  char c;
  bool nega = 0;
  while ((!isdigit(c = getchar())) && (c != '-'))
    ;
  if (c == '-') {
    nega = 1;
    c = getchar();
  }
  x = c - 48;
  while (isdigit(c = getchar())) x = x * 10 + c - 48;
  if (nega) x = -x;
}
template <typename T>
inline void writep(T x) {
  if (x > 9) writep(x / 10);
  putchar(x % 10 + 48);
}
template <typename T>
inline void write(T x) {
  if (x < 0) {
    putchar('-');
    x = -x;
  }
  writep(x);
  putchar(' ');
}
template <typename T>
inline void writeln(T x) {
  write(x);
  putchar('\n');
}
using namespace std;
int n, q;
long long sum, ans, b[100005], a[100005];
int main() {
  srand(time(NULL));
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie();
  if (fopen(".inp", "r")) freopen(".inp", "r", stdin);
  cin >> n;
  for (int i = (1); i <= (n); ++i) cin >> a[i];
  for (int i = (2); i <= (n); ++i) {
    b[i] = a[i] - a[i - 1];
    if (b[i] > 0) sum += b[i];
  }
  ans = (sum + a[1]) / 2;
  if (ans * 2 < a[1] + sum) ++ans;
  cout << ans << '\n';
  cin >> q;
  while (q--) {
    int u, v, w;
    cin >> u >> v >> w;
    if (u != 1) {
      if (b[u] > 0) sum -= b[u];
      b[u] += w;
      if (b[u] > 0) sum += b[u];
    } else {
      a[1] += w;
    }
    if (v != n) {
      ++v;
      if (b[v] > 0) sum -= b[v];
      b[v] -= w;
      if (b[v] > 0) sum += b[v];
    }
    ans = (sum + a[1]) / 2;
    if (ans * 2 < a[1] + sum) ++ans;
    cout << ans << '\n';
  }
  return 0;
}
