#include <bits/stdc++.h>
using namespace std;
template <class T>
ostream& operator<<(ostream& os, vector<T> input) {
  os << "[ ";
  for (auto elem : input) {
    os << elem << " ";
  }
  return os << "]";
}
template <class T>
ostream& operator<<(ostream& os, set<T> input) {
  os << "{ ";
  for (auto elem : input) {
    os << elem << " ";
  }
  return os << "}";
}
template <class T>
ostream& operator<<(ostream& os, unordered_set<T> input) {
  os << "{ ";
  for (auto elem : input) {
    os << elem << " ";
  }
  return os << "}";
}
template <class T>
ostream& operator<<(ostream& os, multiset<T> input) {
  os << "{ ";
  for (auto elem : input) {
    os << elem << " ";
  }
  return os << "}";
}
template <class T>
ostream& operator<<(ostream& os, unordered_multiset<T> input) {
  os << "{ ";
  for (auto elem : input) {
    os << elem << " ";
  }
  return os << "}";
}
template <class L, class R>
ostream& operator<<(ostream& os, map<L, R> input) {
  os << "{ ";
  for (auto elem : input) {
    os << "(" << elem.first << "," << elem.second << ") ";
  }
  return os << "}";
}
template <class L, class R>
ostream& operator<<(ostream& os, unordered_map<L, R> input) {
  os << "{ ";
  for (auto elem : input) {
    os << "(" << elem.first << "," << elem.second << ") ";
  }
  return os << "}";
}
const int MAXN = 500005;
const int INF = 1e9;
const int MOD = 1e9 + 7;
class BIT {
 private:
  int n;
  vector<long long> t;

 public:
  BIT(int _n) {
    n = _n;
    t.assign(n, 0);
  }
  long long sum(int pos) {
    long long result = 0;
    for (int i = pos; i >= 0; i = (i & (i + 1)) - 1) {
      result += t[i];
    }
    return result;
  }
  long long sum(int le, int ri) { return sum(ri) - (le > 0 ? sum(le - 1) : 0); }
  void update(int pos, long long delta) {
    for (int i = pos; i < n; i = (i | (i + 1))) {
      t[i] += delta;
    }
  }
  void update(int le, int ri, long long delta) {
    update(le, +delta);
    if (ri + 1 < n) {
      update(ri + 1, -delta);
    }
  }
};
class TaskD {
 private:
  long long get(long long x, long long y) {
    if (x >= y) {
      return x - y;
    }
    return 0;
  }
  long long getAnswer(long long currSum, long long an) {
    long long cn = ceil(((double)an - (double)currSum) / 2.0);
    long long ans1 = cn + currSum;
    long long c1 = floor(((double)an + (double)currSum) / 2.0);
    cn = c1 - currSum;
    long long ans2 = an - cn;
    return max(ans1, ans2);
  }

 public:
  void solveOne(int it) {
    int n;
    cin >> n;
    vector<long long> nums(n);
    for (int i = 0; i < n; i++) {
      cin >> nums[i];
    }
    long long currSum = 0;
    for (int i = 0; i + 1 < n; i++) {
      if (nums[i] >= nums[i + 1]) {
        currSum += nums[i] - nums[i + 1];
      }
    }
    BIT bit(n);
    for (int i = 0; i < n; i++) {
      bit.update(i, i, nums[i]);
    }
    long long an = bit.sum(n - 1);
    cout << getAnswer(currSum, an) << endl;
    int q;
    cin >> q;
    while (q--) {
      int x, y;
      long long delta;
      cin >> x >> y >> delta;
      x--;
      y--;
      if (x - 1 >= 0) {
        long long p1 = bit.sum(x - 1);
        long long p2 = bit.sum(x);
        currSum -= get(p1, p2);
      }
      if (y + 1 < n) {
        long long p1 = bit.sum(y);
        long long p2 = bit.sum(y + 1);
        currSum -= get(p1, p2);
      }
      bit.update(x, y, delta);
      if (x - 1 >= 0) {
        long long p1 = bit.sum(x - 1);
        long long p2 = bit.sum(x);
        currSum += get(p1, p2);
      }
      if (y + 1 < n) {
        long long p1 = bit.sum(y);
        long long p2 = bit.sum(y + 1);
        currSum += get(p1, p2);
      }
      an = bit.sum(n - 1);
      cout << getAnswer(currSum, an) << endl;
    }
  }
  void solve() {
    int tc = 1;
    for (int it = 1; it <= tc; it++) {
      solveOne(it);
    }
  }
};
int main() {
  ios_base::sync_with_stdio(false);
  TaskD solver;
  solver.solve();
  return 0;
}
