#include <bits/stdc++.h>
using namespace std;
const int INF = 1000000007;
const long long MOD = 1000000007;
long long bit[100005];
int n;
void add(int idx, long long val) {
  for (; idx <= n; idx += idx & -idx) bit[idx] += val;
}
void range_add(int l, int r, long long val) {
  add(l, val);
  add(r + 1, -val);
}
long long query(int idx) {
  long long ret = 0;
  for (; idx > 0; idx -= idx & -idx) ret += bit[idx];
  return ret;
}
long long solve(vector<long long> &v) {
  long long st = 0;
  for (int i = 2; i <= n; i++) {
    st += max(0LL, v[i] - v[i - 1]);
  }
  return st;
}
long long eval(long long x) {
  if (x % 2 == 0) {
    return x / 2;
  } else {
    return (x + 1) / 2;
  }
}
void solve_test() {
  cin >> n;
  vector<long long> arr(n + 1);
  for (int i = 1; i <= n; i++) {
    cin >> arr[i];
    range_add(i, i, arr[i]);
  }
  long long curr = solve(arr);
  long long first = arr[1];
  cout << eval(curr + first) << "\n";
  int q;
  cin >> q;
  for (int i = 0; i < q; i++) {
    int l, r;
    long long x;
    cin >> l >> r >> x;
    if (l == 1) {
      first += x;
    }
    if (l > 1) {
      long long lo2 = query(l), lo1 = query(l - 1);
      curr -= max(0LL, lo2 - lo1);
      curr += max(0LL, lo2 + x - lo1);
    }
    if (r < n) {
      long long hi2 = query(r + 1), hi1 = query(r);
      curr -= max(0LL, hi2 - hi1);
      curr += max(0LL, hi2 - (hi1 + x));
    }
    range_add(l, r, x);
    cout << eval(curr + first) << "\n";
  }
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  int tests;
  tests = 1;
  while (tests--) {
    solve_test();
  }
  return 0;
}
