#include <bits/stdc++.h>
using namespace std;
class A {
 public:
  void solve() {
    int t;
    cin >> t;
    while (t--) {
      int n;
      cin >> n;
      unordered_map<int, int> a;
      for (int i = 0; i < n; i++) {
        int x;
        cin >> x;
        a[x]++;
      }
      int res = 0;
      bool first = true;
      for (int i = 0; i <= 101; i++) {
        if (a[i] <= 1) {
          if (first) {
            first = false;
            res += i;
            if (a[i] == 0) {
              res += i;
              break;
            }
          } else if (a[i] < 1) {
            res += i;
            break;
          }
        }
      }
      cout << res << endl;
    }
  }
};
class B {
 public:
  void solve() {
    int t;
    cin >> t;
    while (t--) {
      int n;
      cin >> n;
      vector<long long> a(n, 0);
      for (int i = 0; i < n; i++) cin >> a[i];
      long long res = LONG_LONG_MIN;
      vector<long long> pos, neg, zero;
      for (int i = 0; i < n; i++) {
        if (a[i] >= 0)
          pos.push_back(a[i]);
        else
          neg.push_back(a[i]);
      }
      sort(pos.begin(), pos.end());
      sort(neg.begin(), neg.end());
      for (int i = 0; i <= 5 && i <= pos.size(); i++) {
        long long p1 = 1, p2 = 1;
        for (int j = 0; j < i; j++) {
          p1 *= pos[j];
          p2 *= pos[pos.size() - j - 1];
        }
        int k = 5 - i;
        if (k > neg.size()) continue;
        long long n1 = 1, n2 = 1;
        for (int j = 0; j < k && j < neg.size(); j++) {
          n1 *= neg[j];
          n2 *= neg[neg.size() - j - 1];
        }
        res = max(res, max(p1 * n1, p1 * n2));
        res = max(res, max(p2 * n1, p2 * n2));
      }
      cout << res << endl;
    }
  }
};
class C {
 public:
  int res;
  int n;
  vector<vector<int>> e;
  vector<int> root;
  int dfs(int fa, int cur) {
    int cnt = 1;
    int mx = 0;
    for (auto child : e[cur]) {
      if (child == fa) continue;
      int temp = dfs(cur, child);
      mx = max(mx, temp);
      cnt += temp;
    }
    int temp = max(mx, n - cnt);
    if (temp <= res) {
      if (temp < res) {
        res = temp;
        root.clear();
        root.push_back(cur);
      } else
        root.push_back(cur);
    }
    return cnt;
  }
  void solve() {
    int t;
    cin >> t;
    while (t--) {
      res = 0x3f3f3f3f;
      cin >> n;
      e = vector<vector<int>>(n);
      vector<bool> vis(n);
      for (int i = 0; i < n - 1; i++) {
        int x, y;
        cin >> x >> y;
        x--;
        y--;
        e[x].push_back(y);
        e[y].push_back(x);
      }
      root.clear();
      dfs(-1, 0);
      if (root.size() == 1) {
        cout << root[0] + 1 << " " << e[root[0]].front() + 1 << endl;
        cout << root[0] + 1 << " " << e[root[0]].front() + 1 << endl;
      } else {
        int nt = 0;
        for (int i : e[root[0]]) {
          if (i != root[1]) {
            nt = i;
            break;
          }
        }
        cout << root[0] + 1 << " " << nt + 1 << endl;
        cout << root[1] + 1 << " " << nt + 1 << endl;
      }
    }
  }
};
class D {
 public:
  void solve() {
    int n;
    cin >> n;
    vector<long long> a(n, 0);
    for (int i = 0; i < n; i++) cin >> a[i];
    long long a1 = a[0];
    long long sumg = 0;
    for (int i = 1; i < n; i++) {
      if (a[i] > a[i - 1]) {
        sumg += a[i] - a[i - 1];
      }
    }
    for (int i = n - 1; i >= 1; i--) {
      a[i] = a[i] - a[i - 1];
    }
    int q = 0;
    cin >> q;
    cout << (long long)(ceil(1.0 * (a1 + sumg) / 2.0)) << endl;
    while (q--) {
      long long l, r, x;
      cin >> l >> r >> x;
      l--;
      r--;
      if (l == 0)
        a1 += x;
      else {
        if (a[l] > 0) sumg -= a[l];
        a[l] += x;
        if (a[l] > 0) sumg += a[l];
      }
      if (r + 1 < n) {
        if (a[r + 1] > 0) sumg -= a[r + 1];
        a[r + 1] -= x;
        if (a[r + 1] > 0) sumg += a[r + 1];
      }
      cout << (long long)(ceil(1.0 * (a1 + sumg) / 2.0)) << endl;
    }
  }
};
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  D ans;
  ans.solve();
  return 0;
}
