#include <bits/stdc++.h>
using namespace std;
long long tr1[1000000], a[1000000], la1[1000000];
long long tr2[1000000], la2[1000000];
long long n, q;
void push_down2(long long p, long long l, long long r) {
  la2[p * 2] += la2[p];
  la2[p * 2 + 1] += la2[p];
  long long mid = (r + l) / 2;
  tr2[p * 2] += la2[p] * (mid - l + 1);
  tr2[p * 2 + 1] += la2[p] * (r - mid);
  la2[p] = 0;
}
long long add2(long long p, long long pl, long long pr, long long l,
               long long r, long long v) {
  if (pr < l || pl > r) return tr2[p];
  if (pl >= l && pr <= r) {
    tr2[p] += (pr - pl + 1) * v;
    la2[p] += v;
    return tr2[p];
  } else {
    if (la2[p] != 0) {
      push_down2(p, pl, pr);
    }
    tr2[p] = add2(p * 2, pl, (pl + pr) / 2, l, r, v) +
             add2(p * 2 + 1, (pl + pr) / 2 + 1, pr, l, r, v);
    return tr2[p];
  }
}
long long qu2(long long p, long long pl, long long pr, long long l,
              long long r) {
  if (pr < l || pl > r) return 0;
  if (pl >= l && pr <= r) {
    return tr2[p];
  } else {
    if (la2[p] != 0) {
      push_down2(p, pl, pr);
    }
    return qu2(p * 2, pl, (pl + pr) / 2, l, r) +
           qu2(p * 2 + 1, (pl + pr) / 2 + 1, pr, l, r);
  }
}
long long build1(long long p, long long l, long long r) {
  if (l > r) return 0;
  if (l == r) return tr1[p] = a[l];
  return tr1[p] = build1(p * 2, l, (l + r) / 2) +
                  build1(p * 2 + 1, (l + r) / 2 + 1, r);
}
void push_down1(long long p, long long l, long long r) {
  la1[p * 2] += la1[p];
  la1[p * 2 + 1] += la1[p];
  long long mid = (r + l) / 2;
  tr1[p * 2] += la1[p] * (mid - l + 1);
  tr1[p * 2 + 1] += la1[p] * (r - mid);
  la1[p] = 0;
}
long long add1(long long p, long long pl, long long pr, long long l,
               long long r, long long v) {
  if (pr < l || pl > r) return tr1[p];
  if (pl >= l && pr <= r) {
    tr1[p] += (pr - pl + 1) * v;
    la1[p] += v;
    return tr1[p];
  } else {
    if (la1[p] != 0) {
      push_down1(p, pl, pr);
    }
    tr1[p] = add1(p * 2, pl, (pl + pr) / 2, l, r, v) +
             add1(p * 2 + 1, (pl + pr) / 2 + 1, pr, l, r, v);
    return tr1[p];
  }
}
long long qu1(long long p, long long pl, long long pr, long long l,
              long long r) {
  if (pr < l || pl > r) return 0;
  if (pl >= l && pr <= r) {
    return tr1[p];
  } else {
    if (la1[p] != 0) {
      push_down1(p, pl, pr);
    }
    return qu1(p * 2, pl, (pl + pr) / 2, l, r) +
           qu1(p * 2 + 1, (pl + pr) / 2 + 1, pr, l, r);
  }
}
int main() {
  cin >> n;
  for (long long i = 1; i <= n; i++) {
    cin >> a[i];
    if (i >= 2 && a[i] > a[i - 1]) add2(1, 1, n, i, n, a[i] - a[i - 1]);
  }
  build1(1, 1, n);
  long long xx = a[1] + qu2(1, 1, n, n, n);
  if (xx % 2) {
    if (xx < 0)
      cout << xx / 2 << endl;
    else
      cout << xx / 2 + 1 << endl;
  } else
    cout << xx / 2 << endl;
  cin >> q;
  for (long long o = 1; o <= q; o++) {
    long long l, r, x;
    cin >> l >> r >> x;
    add1(1, 1, n, l, r, x);
    if (l >= 2) {
      long long x1 = qu1(1, 1, n, l, l);
      long long x2 = qu1(1, 1, n, l - 1, l - 1);
      if (x1 - x < x2) {
        if (x1 - x2 > 0) add2(1, 1, n, l, n, x1 - x2);
      } else {
        if (x1 - x2 > 0)
          add2(1, 1, n, l, n, x);
        else
          add2(1, 1, n, l, n, -(x1 - x - x2));
      }
    }
    if (r < n) {
      long long x1 = qu1(1, 1, n, r, r), x2 = qu1(1, 1, n, r + 1, r + 1);
      if (x1 - x > x2) {
        if (x2 - x1 > 0) add2(1, 1, n, r + 1, n, x2 - x1);
      } else {
        if (x2 - x1 > 0)
          add2(1, 1, n, r + 1, n, -x);
        else
          add2(1, 1, n, r + 1, n, -(x2 - (x1 - x)));
      }
    }
    xx = qu1(1, 1, n, 1, 1) + qu2(1, 1, n, n, n);
    if (xx % 2) {
      if (xx < 0)
        cout << xx / 2 << endl;
      else
        cout << xx / 2 + 1 << endl;
    } else
      cout << xx / 2 << endl;
  }
}
