local n, d = io.read("*n", "*n") local t = {0} local sum = 0 for i = 2, n do local a = io.read("*n") sum = sum + a t[i] = math.max(t[i - 1] + d, sum) end print(table.concat(t, " "))