N = int(input()) T = list(map(int, input().split())) M = int(input()) for i in range(M): l, r, d = map(int, input().split()) t = 0 for j in range(N - 1): if l - 1 <= j < r: T[j] += d if t >= T[j]: t += 3 else: t = T[j] t += 3 print(t)