using System; using System.Linq; using System.Collections.Generic; class P { static void Main() { int N = int.Parse(Console.ReadLine()); long[] T = Console.ReadLine().Split().Select(long.Parse).ToArray(); int M = int.Parse(Console.ReadLine()); long[] res = new long[M]; for (int i = 0; i < M; i++) { int[] LRD = Console.ReadLine().Split().Select(int.Parse).ToArray(); for (int j = LRD[0] - 1; j < LRD[1]; j++) { T[j] += LRD[2]; } long time = 0; foreach (var e in T) { time = Math.Max(time + 3,e); } res[i] = time + 3; } Console.WriteLine(string.Join("\n",res)); } }