You are planning to buy an apartment in a $n$-floor building. The floors are numbered from $1$ to $n$ from the bottom to the top. At first for each floor you want to know the minimum total time to reach it from the first (the bottom) floor.

Let:  $a_i$ for all $i$ from $1$ to $n-1$ be the time required to go from the $i$-th floor to the $(i+1)$-th one (and from the $(i+1)$-th to the $i$-th as well) using the stairs;  $b_i$ for all $i$ from $1$ to $n-1$ be the time required to go from the $i$-th floor to the $(i+1)$-th one (and from the $(i+1)$-th to the $i$-th as well) using the elevator, also there is a value $c$ — time overhead for elevator usage (you need to wait for it, the elevator doors are too slow!). 

In one move, you can go from the floor you are staying at $x$ to any floor $y$ ($x \ne y$) in two different ways:  If you are using the stairs, just sum up the corresponding values of $a_i$. Formally, it will take $\sum\limits_{i=min(x, y)}^{max(x, y) - 1} a_i$ time units.  If you are using the elevator, just sum up $c$ and the corresponding values of $b_i$. Formally, it will take $c + \sum\limits_{i=min(x, y)}^{max(x, y) - 1} b_i$ time units. 

You can perform as many moves as you want (possibly zero).

So your task is for each $i$ to determine the minimum total time it takes to reach the $i$-th floor from the $1$-st (bottom) floor.


-----Input-----

The first line of the input contains two integers $n$ and $c$ ($2 \le n \le 2 \cdot 10^5, 1 \le c \le 1000$) — the number of floors in the building and the time overhead for the elevator rides.

The second line of the input contains $n - 1$ integers $a_1, a_2, \dots, a_{n-1}$ ($1 \le a_i \le 1000$), where $a_i$ is the time required to go from the $i$-th floor to the $(i+1)$-th one (and from the $(i+1)$-th to the $i$-th as well) using the stairs.

The third line of the input contains $n - 1$ integers $b_1, b_2, \dots, b_{n-1}$ ($1 \le b_i \le 1000$), where $b_i$ is the time required to go from the $i$-th floor to the $(i+1)$-th one (and from the $(i+1)$-th to the $i$-th as well) using the elevator.


-----Output-----

Print $n$ integers $t_1, t_2, \dots, t_n$, where $t_i$ is the minimum total time to reach the $i$-th floor from the first floor if you can perform as many moves as you want.


-----Examples-----
Input
10 2
7 6 18 6 16 18 1 17 17
6 9 3 10 9 1 10 1 5

Output
0 7 13 18 24 35 36 37 40 45 

Input
10 1
3 2 3 1 3 3 1 4 1
1 2 3 4 4 1 2 1 3

Output
0 2 4 7 8 11 13 14 16 17

Difficulty: MEDIUM_HARD
Tags: Dynamic programming

Shortest paths
Skill types: Dynamic programming

Starter code:

Solutions:
(a, b) = map(int, input().split())
c = list(map(int, input().split()))
d = list(map(int, input().split()))
f = [0 for _ in range(a)]
g = [0 for _ in range(a)]
g[0] = b
for i in range(1, a):
	f[i] = min(f[i - 1], g[i - 1]) + c[i - 1]
	g[i] = min(f[i - 1] + b, g[i - 1]) + d[i - 1]
for i in range(a):
	print(min(f[i], g[i]), end=' ')


(n, c) = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
dp = [[0] * 2 for _ in range(n)]
dp[0][1] = c
print('0', end=' ')
for i in range(1, n):
	dp[i][0] = min(dp[i - 1][0] + a[i - 1], dp[i - 1][1] + a[i - 1])
	dp[i][1] = min(dp[i - 1][0] + b[i - 1] + c, dp[i - 1][1] + b[i - 1])
	print(min(dp[i][0], dp[i][1]), end=' ')


from math import inf
(n, c) = map(int, input().split())
a = [int(i) for i in input().split()]
b = [int(i) for i in input().split()]
dp = [[]]
dp.append([])
for i in range(n):
	dp[0].append(inf)
	dp[1].append(inf)
dp[0][0] = 0
dp[1][0] = c
for i in range(n - 1):
	dp[0][i + 1] = min(dp[0][i + 1], dp[1][i] + a[i])
	dp[0][i + 1] = min(dp[0][i + 1], dp[0][i] + a[i])
	dp[1][i + 1] = min(dp[1][i + 1], dp[1][i] + b[i])
	dp[1][i + 1] = min(dp[1][i + 1], dp[0][i] + b[i] + c)
for i in range(n):
	print(min(dp[0][i], dp[1][i]), end=' ')


import os
import sys
from io import BytesIO, IOBase

def main():
	(n, c) = map(int, input().split())
	a = list(map(int, input().split()))
	b = list(map(int, input().split()))
	dp = [[0, 0] for _ in range(n)]
	dp[0][1] = c
	for i in range(1, n):
		dp[i][0] = min(dp[i - 1][0] + a[i - 1], dp[i - 1][1] + a[i - 1])
		dp[i][1] = min(dp[i - 1][1] + b[i - 1], dp[i - 1][0] + c + b[i - 1])
	for i in dp:
		print(min(i), end=' ')
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
main()


(n, c) = map(int, input().split())
a = [int(o) for o in input().split()]
b = [int(o) for o in input().split()]
dp = [[0, 0] for i in range(n)]
dp[0][1] = c
print('0', end=' ')
for i in range(1, n):
	dp[i][0] = min(dp[i - 1][0] + a[i - 1], dp[i - 1][1] + a[i - 1])
	dp[i][1] = min(dp[i - 1][1] + b[i - 1], dp[i - 1][0] + b[i - 1] + c)
	print(min(dp[i]), end=' ')
print()


(n, c) = map(int, input().split())
S = list(map(int, input().split()))
E = list(map(int, input().split()))
lastS = S[0]
lastE = E[0] + c
print('0 ', end='')
print(min(lastS, lastE), end=' ')
for i in range(1, n - 1):
	curS = min(lastS + S[i], lastE + S[i])
	curE = min(lastS + c + E[i], lastE + E[i])
	print(min(curS, curE), end=' ')
	lastS = curS
	lastE = curE


(n, c) = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
dp0 = [0]
dp1 = [c]
res = [0]
for i in range(1, n):
	dp0.append(min(dp0[i - 1], dp1[i - 1]) + a[i - 1])
	dp1.append(min(dp0[i - 1] + c, dp1[i - 1]) + b[i - 1])
	res.append(min(dp0[i], dp1[i]))
ans = ''
for i in res:
	ans += str(i) + ' '
print(ans[0:len(ans) - 1])


(n, c) = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
t = [(0, c)]
ans = []
for i in range(0, n - 1):
	t.append((min(t[i][1] + a[i], t[i][0] + a[i]), min(t[i][1] + b[i], t[i][0] + b[i] + c)))
	ans.append(min(t[i][0], t[i][1]))
ans.append(min(t[n - 1][0], t[n - 1][1]))
print(*ans)


from heapq import *
(n, c) = map(int, input().split())
costs = list(zip(*[map(int, input().split()) for _ in range(2)]))
extra_costs = (0, c)
dp = [[None, None] for _ in range(n)]
h = [(0, 0, 0)]

def neighbor(cost, next_floor, mode, cost_index):
	if dp[next_floor][mode] is None:
		heappush(h, (cost + costs[cost_index][mode], next_floor, mode))
	mode ^= 1
	if dp[next_floor][mode] is None:
		heappush(h, (cost + costs[cost_index][mode] + extra_costs[mode], next_floor, mode))
while h:
	(cost, floor, mode) = heappop(h)
	if dp[floor][mode] is not None:
		continue
	dp[floor][mode] = cost
	if floor < n - 1:
		neighbor(cost, floor + 1, mode, floor)
dp[0][1] = 0
print(*map(min, dp))


import sys

def input():
	return sys.stdin.readline().strip()

def list2d(a, b, c):
	return [[c] * b for i in range(a)]

def list3d(a, b, c, d):
	return [[[d] * c for j in range(b)] for i in range(a)]

def list4d(a, b, c, d, e):
	return [[[[e] * d for j in range(c)] for j in range(b)] for i in range(a)]

def ceil(x, y=1):
	return int(-(-x // y))

def INT():
	return int(input())

def MAP():
	return map(int, input().split())

def LIST(N=None):
	return list(MAP()) if N is None else [INT() for i in range(N)]

def Yes():
	print('Yes')

def No():
	print('No')

def YES():
	print('YES')

def NO():
	print('NO')
sys.setrecursionlimit(10 ** 7)
INF = 10 ** 18
MOD = 10 ** 9 + 7
(N, C) = MAP()
A = LIST()
B = LIST()
dp = list2d(2, N, INF)
dp[0][0] = 0
for i in range(N - 1):
	dp[0][i + 1] = min(dp[0][i] + A[i], dp[1][i] + A[i])
	dp[1][i + 1] = min(dp[0][i] + B[i] + C, dp[1][i] + B[i])
ans = [0] * N
for i in range(N):
	ans[i] = min(dp[0][i], dp[1][i])
print(*ans)


import sys
from heapq import heapify, heappop, heappush
from itertools import *
from collections import *
from math import *
sys.setrecursionlimit(10 ** 6)
input = lambda : sys.stdin.readline()
inp = lambda : int(input())
nm = lambda : map(int, input().split())
arr = lambda : list(nm())
INF = int(1e+18)
mod = int(1000000000.0) + 7

def find(dp, n):
	while dp[n] > 0:
		n = dp[n]
	return n

def solve():
	(n, m) = nm()
	lst1 = arr()
	lst2 = arr()
	dp1 = [0] * n
	dp2 = [0] * n
	for i in range(n - 1):
		if i == 0:
			dp1[i + 1] = lst1[i]
			dp2[i + 1] = lst2[i] + m
		else:
			dp1[i + 1] = lst1[i] + min(dp1[i], dp2[i])
			dp2[i + 1] = lst2[i] + min(dp1[i] + m, dp2[i])
	for i in range(n):
		print(min(dp1[i], dp2[i]), end=' ')
t = 1
for i in range(t):
	solve()


(n, c) = map(int, input().split())
aa = list(map(int, input().split()))
bb = list(map(int, input().split()))
dp = [[0, c] for i in range(n)]
for i in range(1, n):
	dp[i][0] = min(dp[i - 1][0] + aa[i - 1], dp[i - 1][1] + aa[i - 1])
	dp[i][1] = min(dp[i - 1][0] + c + bb[i - 1], dp[i - 1][1] + bb[i - 1])
print(*[min(i) for i in dp])


(n, c) = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
dp = [[0, 0] for i in range(n)]
dp[0] = [0, c]
for i in range(1, n):
	ans1 = dp[i - 1][0] + a[i - 1]
	ans2 = dp[i - 1][1] + b[i - 1]
	dp[i][1] = min(ans2, dp[i - 1][0] + c + b[i - 1])
	dp[i][0] = min(ans1, dp[i][1])
for elem in dp:
	print(min(elem[0], elem[1]), end=' ')


import sys
from collections import deque
readline = sys.stdin.readline
(n, c) = map(int, readline().split())
dp = [[int(pow(10, 9)), int(pow(10, 9))] for _ in range(n)]
dp[0][0] = 0
dp[0][1] = c
tmp = []
tmp.append([int(x) for x in readline().split()])
tmp.append([int(x) for x in readline().split()])
for i in range(n - 1):
	dp[i + 1][0] = min(dp[i][0], dp[i][1]) + tmp[0][i]
	dp[i + 1][1] = min(dp[i][0] + c, dp[i][1]) + tmp[1][i]
for x in dp:
	print(min(x[0], x[1]), end=' ')


(n, k) = map(int, input().split())
a = [0] + list(map(int, input().split()))
b = [0] + list(map(int, input().split()))
prea = [0]
preb = [0]
for i in range(1, n):
	prea.append(prea[-1] + a[i])
	preb.append(preb[-1] + b[i])
inf = 10 ** 12
dp = [[inf, inf] for i in range(n + 1)]
(dp[0][0], dp[0][1]) = (0, 0)
(dp[1][0], dp[1][1]) = (0, k)
for i in range(2, n + 1):
	dp[i][0] = min(inf, prea[i - 1])
	dp[i][1] = min(inf, preb[i - 1] + k)
	for j in range(i - 1, i):
		dp[i][0] = min(dp[i][0], dp[j][0] + min(prea[i - 1] - prea[j - 1], inf), dp[j][1] + min(prea[i - 1] - prea[j - 1], inf))
		dp[i][1] = min(dp[i][1], dp[j][0] + min(inf, preb[i - 1] - preb[j - 1] + k), dp[j][1] + min(inf, preb[i - 1] - preb[j - 1]))
for i in range(1, n + 1):
	print(min(dp[i]), end=' ')


import sys
(n, c) = map(int, input().split())
a = [int(x) for x in input().split()]
b = [int(x) for x in input().split()]
ar = [0]
br = [c]
for i in range(n - 1):
	a1 = ar[-1] + a[i]
	a2 = br[-1] + a[i]
	b1 = br[-1] + b[i]
	b2 = ar[-1] + c + b[i]
	b3 = ar[-1] + a[i] + c
	ar.append(min(a1, a2, b1))
	br.append(min(b1, b2, b3))
print(' '.join(map(lambda x: str(min(ar[x], br[x])), range(n))))


(n, c) = list(map(int, input().split()))
lis = []
a = list(map(int, input().split()))
b = list(map(int, input().split()))
asum = 0
bsum = c
for i in range(n):
	lis.append(min(asum, bsum))
	if i == n - 1:
		break
	oasum = asum
	asum = min(asum + a[i], bsum + a[i])
	bsum = min(oasum + b[i] + c, bsum + b[i])
print(' '.join(map(str, lis)))


import sys
input = sys.stdin.readline
(n, c) = map(int, input().split())
stairs = [int(i) for i in input().split()]
elevators = [int(i) for i in input().split()]
print(0, end=' ')
stair = 0
elevator = c
for i in range(n - 1):
	stairo = min(stair + stairs[i], elevator + stairs[i])
	elevatoro = min(stair + c + elevators[i], elevator + elevators[i])
	stair = stairo
	elevator = elevatoro
	print(min(stair, elevator), end=' ')


kk = lambda : map(int, input().split())
((n, c), a, b) = (kk(), kk(), kk())
(l, s) = (c, 0)
print(0, end=' ')
for i in range(n - 1):
	(s, l) = (min(s, l) + next(a), min(s + c, l) + next(b))
	print(min(s, l), end=' ')


(n, c) = [int(x) for x in input().split()]
a = list(map(int, input().split()))
b = list(map(int, input().split()))
dpst = [0] * (n + 1)
dplift = [0] * (n + 1)
dpst[2] = a[0]
dplift[2] = c + b[0]
for i in range(3, n + 1):
	dpst[i] = a[i - 2] + min(dpst[i - 1], dplift[i - 1])
	dplift[i] = b[i - 2] + min(c + dpst[i - 1], dplift[i - 1])
for i in range(1, n + 1):
	print(min(dpst[i], dplift[i]), end=' ')


c = list(map(int, input().split()))
b = list(map(int, input().split()))
a = list(map(int, input().split()))
i = 1
lift = c[1]
stairs = 0
print(0, end=' ')
for i in range(c[0] - 1):
	temp = lift
	lift = min(lift + a[i], stairs + a[i] + c[1])
	stairs = min(stairs + b[i], temp + b[i])
	print(min(lift, stairs), end=' ')


(floors, c) = [int(x) for x in input().split()]
stairs = [int(x) for x in input().split()]
lifts = [int(x) for x in input().split()]
ts = 0
te = c
ans = [0]
for i in range(1, floors):
	(ts, te) = (min(ts, te) + stairs[i - 1], min(ts + c, te) + lifts[i - 1])
	ans.append(min(ts, te))
print(*ans)


(n, c) = list(map(int, input().split()))
a = [int(x) for x in input().split()]
b = [int(x) for x in input().split()]
r = [0]
p = [0]
for i in range(n - 1):
	x1 = r[-1] + a[i]
	y1 = p[-1] + b[i]
	if i == 0:
		y1 += c
	p.append(y1)
	if r[-1] < p[-1]:
		z1 = r[-1] + b[i] + c
		if z1 < y1:
			y1 = z1
			p[-1] = z1
	if x1 < y1:
		r.append(x1)
	else:
		r.append(y1)
print(*r)


(n, delta) = [int(x) for x in input().split()]
stairs = [int(x) for x in input().split()]
elevator = [int(x) for x in input().split()]
dp = [[0] * n for i in range(2)]
dp[0][0] = 0
dp[1][0] = 0
ans = [0] * n
for j in range(1, n):
	dp[0][j] = min(dp[0][j - 1], dp[1][j - 1]) + stairs[j - 1]
	if j == 1:
		dp[1][j] = delta + elevator[j - 1]
	else:
		dp[1][j] = min(dp[0][j - 1] + delta, dp[1][j - 1]) + elevator[j - 1]
	ans[j] = min(dp[0][j], dp[1][j])
for i in range(n):
	print(ans[i], end=' ')


import sys
(n, c) = map(int, sys.stdin.readline().split())
a = list(map(int, sys.stdin.readline().split()))
b = list(map(int, sys.stdin.readline().split()))
(s, l) = ([0], [0])
s.append(a[0])
l.append(b[0] + c)
for i in range(2, n):
	st = min(s[-1] + a[i - 1], l[-1] + a[i - 1])
	lt = min(s[-1] + b[i - 1] + c, l[-1] + b[i - 1])
	s.append(st)
	l.append(lt)
ans = []
for i in range(n):
	ans.append(min(s[i], l[i]))
print(' '.join(map(str, ans)))


(n, c) = map(int, input().split())
a = [int(ai) for ai in input().split()]
b = [int(bi) for bi in input().split()]
(dpa, dpb) = ([0] * n, [0] * n)
(dpa[1], dpb[1]) = (a[0], c + b[0])
for i in range(1, n - 1):
	(dpa[i + 1], dpb[i + 1]) = (min(dpa[i], dpb[i]) + a[i], min(dpa[i] + c, dpb[i]) + b[i])
print(*(min(dpa[i], dpb[i]) for i in range(n)))


(n, c) = map(int, input().split())
st = list(map(int, input().split()))
li = list(map(int, input().split()))
fl_li = 0
out = 0
dp = [[float('inf') for i in range(2)] for i in range(n)]
dp[0][0] = 0
dp[0][1] = c
print(min(dp[0][0], dp[0][1]), end=' ')
for i in range(n - 1):
	dp[i + 1][0] = min(dp[i + 1][0], dp[i][0] + st[i])
	dp[i + 1][0] = min(dp[i + 1][0], dp[i][1] + st[i])
	dp[i + 1][1] = min(dp[i + 1][1], dp[i][1] + li[i])
	dp[i + 1][1] = min(dp[i + 1][1], dp[i][0] + li[i] + c)
	print(min(dp[i + 1][0], dp[i + 1][1]), end=' ')
print()


(n, c) = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
(s, l) = ([0], [0])
s.append(a[0])
l.append(b[0] + c)
for i in range(2, n):
	st = min(s[-1] + a[i - 1], l[-1] + a[i - 1])
	lt = min(s[-1] + b[i - 1] + c, l[-1] + b[i - 1])
	s.append(st)
	l.append(lt)
ans = []
for i in range(n):
	ans.append(min(s[i], l[i]))
print(' '.join(map(str, ans)))


inp = lambda : map(int, input().split())
(n, c) = inp()
a = list(inp())
b = list(inp())
ans = list()
ans.append(0)
arr = [[1000000000, 10000000000] for i in range(n)]
arr[0][0] = 0
arr[0][1] = c
for i in range(n - 1):
	arr[i + 1][0] = min(arr[i + 1][0], arr[i][0] + a[i])
	arr[i + 1][0] = min(arr[i + 1][0], arr[i][1] + a[i])
	arr[i + 1][1] = min(arr[i + 1][1], arr[i][1] + b[i])
	arr[i + 1][1] = min(arr[i + 1][1], arr[i][0] + b[i] + c)
ans = []
for i in range(n):
	ans.append(min(arr[i][0], arr[i][1]))
print(*ans)


from bisect import bisect_left as bl, bisect_right as br, insort
import sys
import heapq
from math import *
from collections import defaultdict as dd, deque

def data():
	return sys.stdin.readline().strip()

def mdata():
	return map(int, data().split())
mod = int(1000000000.0 + 7)
(n, c) = mdata()
A = list(mdata())
B = list(mdata())
dp = [0] * n
dp1 = [0] * n
dp[0] = 0
dp1[0] = c
for i in range(1, n):
	dp[i] = min(dp[i - 1] + A[i - 1], dp1[i - 1] + A[i - 1])
	dp1[i] = min(dp1[i - 1] + B[i - 1], dp[i - 1] + c + B[i - 1])
for i in range(n):
	print(min(dp[i], dp1[i]), end=' ')


(n, c) = list(map(int, input().split()))
stairs = list(map(int, input().split()))
lift = list(map(int, input().split()))
dp = [[0 for _ in range(n)] for _ in range(2)]
dp[0][0] = 0
dp[1][0] = c
for i in range(1, n):
	dp[0][i] = min(stairs[i - 1] + dp[0][i - 1], stairs[i - 1] + dp[1][i - 1])
	dp[1][i] = min(dp[0][i - 1] + lift[i - 1] + c, dp[1][i - 1] + lift[i - 1])
ans = []
for i in range(n):
	ans.append(min(dp[0][i], dp[1][i]))
print(*ans)


import sys
line_count = 0
for line in sys.stdin.readlines():
	inputs = line.split()
	if line_count == 0:
		n = int(inputs[0])
		c = int(inputs[1])
	elif line_count == 1:
		a = []
		for i in range(n - 1):
			a.append(int(inputs[i]))
	elif line_count == 2:
		b = []
		for i in range(n - 1):
			b.append(int(inputs[i]))
	if line_count == 2:
		break
	line_count += 1
by_stair = [0]
by_elev = [c]
print(0, end=' ')
for i in range(1, n):
	pos_stair = min(by_stair[i - 1] + a[i - 1], by_elev[i - 1] + a[i - 1])
	by_stair.append(pos_stair)
	pos_elev = min(by_stair[i - 1] + c + b[i - 1], by_elev[i - 1] + b[i - 1])
	by_elev.append(pos_elev)
	print(min(pos_stair, pos_elev), end=' ')


(n, c) = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
ans = 0
w = [[0 for i in range(2)] for i in range(n)]
w[0][1] = c
for i in range(1, n):
	w[i][0] = min(w[i - 1][0] + a[i - 1], w[i - 1][1] + b[i - 1])
	w[i][1] = min(w[i - 1][1] + b[i - 1], w[i][0] + c)
for i in range(n):
	print(min(w[i]), end=' ', flush=False)
print()


I = lambda : list(map(int, input().split()))
(n, c) = I()
a = I()
b = I()
dp = [[0, 0] for i in range(300000)]
dp[1][0] = a[0]
dp[1][1] = c + b[0]
for i in range(2, n):
	dp[i][0] = min(dp[i - 1][0] + a[i - 1], dp[i - 1][1] + a[i - 1])
	dp[i][1] = min(dp[i - 1][0] + c + b[i - 1], dp[i - 1][1] + b[i - 1])
for i in range(n):
	print(min(dp[i][0], dp[i][1]), end=' ')


import sys
input = sys.stdin.readline
(n, c) = list(map(int, input().split()))
A = list(map(int, input().split()))
B = list(map(int, input().split()))
TIME0 = [0] * n
TIME1 = [0] * n
TIME1[0] = c
for i in range(1, n):
	TIME0[i] = min(TIME0[i - 1], TIME1[i - 1]) + A[i - 1]
	TIME1[i] = min(TIME0[i - 1] + c + B[i - 1], TIME1[i - 1] + B[i - 1])
ANS = [min(TIME0[i], TIME1[i]) for i in range(n)]
print(*ANS)


import sys
input = sys.stdin.readline
(n, c) = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
dp = [[0] * 2 for _ in range(n)]
dp[0][1] = 10 ** 18
for i in range(n - 1):
	dp[i + 1][0] = min(dp[i][0] + a[i], dp[i][1] + a[i])
	dp[i + 1][1] = min(dp[i][0] + b[i] + c, dp[i][1] + b[i])
ans_l = []
for i in range(n):
	ans_l.append(min(dp[i]))
print(*ans_l)


import sys
input = sys.stdin.readline
(n, c) = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
inf = float('inf')
dp = [[inf] * 2 for _ in range(n)]
(dp[0][0], dp[0][1]) = (0, 0)
dp[1][0] = a[0]
dp[1][1] = c + b[0]
for i in range(2, n):
	dp[i][0] = min(dp[i - 1][0] + a[i - 1], dp[i - 1][1] + a[i - 1])
	dp[i][1] = min(dp[i - 1][0] + c + b[i - 1], dp[i - 1][1] + b[i - 1])
ans = []
for i in range(n):
	ans.append(min(dp[i][0], dp[i][1]))
print(*ans)


(n, c) = [int(x) for x in input().split()]
a = [int(x) for x in input().split()]
b = [int(x) for x in input().split()]
time = [0] * n
level = 1
lastS = 0
lastE = c
while level < n:
	currS = min(lastS + a[level - 1], lastE + a[level - 1])
	currE = min(lastS + b[level - 1] + c, lastE + b[level - 1])
	time[level] = min(currS, currE)
	level += 1
	lastS = currS
	lastE = currE
print(' '.join([str(x) for x in time]))


(n, c) = map(int, input().split())
a = [int(i) for i in input().split()]
b = [int(i) for i in input().split()]
dp = [[0 for i in range(2)] for j in range(n)]
dp[1][0] = a[0]
dp[1][1] = b[0] + c
for i in range(2, n):
	dp[i][0] = min(dp[i - 1][0] + a[i - 1], dp[i - 1][1] + a[i - 1])
	dp[i][1] = min(dp[i - 1][1] + b[i - 1], dp[i - 1][0] + b[i - 1] + c)
ans = [0] * n
for i in range(n):
	ans[i] = min(dp[i][0], dp[i][1])
print(*ans)


(n, c) = map(int, input().strip().split())
stairs = list(map(int, input().strip().split()))
elevator = list(map(int, input().strip().split()))
onStair = [0]
onElevator = [c]
for floor in range(n - 1):
	onElevator.append(min(onElevator[-1], onStair[-1] + c) + elevator[floor])
	onStair.append(min(onElevator[-1], onStair[-1] + stairs[floor]))
for i in range(0, n):
	print(min(onStair[i], onElevator[i]), end=' ')


from sys import stdin, stdout
input = stdin.readline
t = 1
for _ in range(t):
	(n, c) = map(int, input().split())
	a = [int(x) for x in input().split()]
	b = [int(x) for x in input().split()]
	dp = [[0 for x in range(2)] for y in range(n)]
	for i in range(1, n):
		if i == 1:
			dp[i][0] = a[i - 1]
			dp[i][1] = b[i - 1] + c
			continue
		dp[i][0] = a[i - 1] + min(dp[i - 1][0], dp[i - 1][1])
		dp[i][1] = min(dp[i - 1][1] + b[i - 1], dp[i - 1][0] + b[i - 1] + c)
	for i in range(n):
		print(min(dp[i]), end=' ')


(n, c) = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
output = [0] * n
accs = a[0]
acce = c + b[0]
for i in range(1, n - 1):
	output[i] = min(accs, acce)
	accs = output[i] + a[i]
	acce = min(acce, output[i] + c) + b[i]
output[-1] = min(accs, acce)
print(' '.join([str(i) for i in output]))


(n, c) = [int(i) for i in input().split()]
ladder = [int(i) for i in input().split()]
lift = [int(i) for i in input().split()]
times = [(float('inf'), float('inf'))] * n
times[0] = (0, float('inf'))
for i in range(1, n):
	times[i] = (min(times[i - 1]) + ladder[i - 1], min(times[i - 1][0] + c, times[i - 1][1]) + lift[i - 1])
print(' '.join([str(min(i)) for i in times]))


def choice(n, c, A, B):
	tmp_f = 0
	tmp_g = c
	flag = 1
	yield 0
	for i in range(1, n):
		if A[i - 1] >= B[i - 1] + c * flag:
			tmp_f = tmp_f + B[i - 1] + c * flag
			flag = 0
		else:
			tmp_f = tmp_f + A[i - 1]
			flag = 1
		tmp_g = tmp_g + B[i - 1]
		if tmp_g - c > tmp_f:
			tmp_g = tmp_f + c
		elif tmp_g <= tmp_f:
			tmp_f = tmp_g
		yield tmp_f
(n, c) = map(int, input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
for i in choice(n, c, A, B):
	print(i, end=' ')


(n, c) = map(int, input().split())
stairs = list(map(int, input().split()))
lift = list(map(int, input().split()))
sp_stairs = [10000000000] * n
sp_lift = [10000000000] * n
sp_stairs[0] = 0
sp_lift[0] = c
for i in range(1, n):
	sp_stairs[i] = min(sp_stairs[i - 1] + stairs[i - 1], sp_lift[i - 1] + stairs[i - 1])
	sp_lift[i] = min(sp_lift[i - 1] + lift[i - 1], sp_stairs[i - 1] + c + lift[i - 1])
print(*[min(sp_stairs[i], sp_lift[i]) for i in range(n)])


N = 2 * 10 ** 5 + 5
a = [0 for i in range(N)]
b = [0 for i in range(N)]
dp = [[0 for i in range(2)] for i in range(N)]

def main():
	(n, c) = map(int, input().split())
	a = list(map(int, input().split()))
	b = list(map(int, input().split()))
	dp[0][0] = 0
	dp[0][1] = c
	for i in range(1, n):
		dp[i][0] = min(dp[i - 1][0] + a[i - 1], dp[i - 1][1] + a[i - 1])
		dp[i][1] = min(dp[i - 1][0] + c + b[i - 1], dp[i - 1][1] + b[i - 1])
	for i in range(n):
		print(min(dp[i][0], dp[i][1]), end=' ')
main()


(n, c) = map(int, input().split())
dp = [[0] * n, [0] * n]
f = [[], []]
f[0] = list(map(int, input().split()))
f[1] = list(map(int, input().split()))
t = 0
f[1][0] += c
for i in range(1, n):
	dp[0][i] = min(f[0][i - 1], f[1][i - 1] + c) + min(dp[0][i - 1], dp[1][i - 1])
	dp[1][i] = min(dp[0][i - 1] + c, dp[1][i - 1]) + min(f[1][i - 1], f[0][i - 1] + c)
for i in range(n):
	print(min(dp[0][i], dp[1][i]), end=' ')


(n, c) = list(map(int, input().strip().split()))
a = list(map(int, input().strip().split()))
b = list(map(int, input().strip().split()))
arr = [[0, c] for i in range(n + 2)]
op = [0] * n
for i in range(1, n):
	arr[i][0] = min(arr[i - 1][0] + a[i - 1], arr[i - 1][1] + a[i - 1])
	arr[i][1] = min(arr[i - 1][1] + b[i - 1], arr[i - 1][0] + b[i - 1] + c)
	op[i] = min(arr[i])
print(' '.join(list(map(str, op))))


(n, c) = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
stairs = [0] * (n + 1)
elevator = [0] * (n + 1)
elevator[-1] = 10 ** 9
for i in range(n - 1):
	stairs[i] = min(stairs[i - 1] + a[i], elevator[i - 1] + a[i])
	elevator[i] = min(stairs[i - 1] + b[i] + c, elevator[i - 1] + b[i])
for i in range(n):
	print(min(stairs[i - 1], elevator[i - 1]), end=' ')


(n, c) = map(int, input().split())
l1 = list(map(int, input().split()))
l2 = list(map(int, input().split()))
dp = [[0] * 2 for _ in range(n + 1)]
dp[1][1] = c
for i in range(2, n + 1):
	dp[i][0] = min(dp[i - 1][0], dp[i - 1][1]) + l1[i - 2]
	dp[i][1] = min(dp[i - 1][0] + l2[i - 2] + c, dp[i - 1][1] + l2[i - 2])
for i in range(1, n + 1):
	print(min(dp[i]), end=' ')


(n, c) = map(int, input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
sb = [0]
for i in B:
	sb.append(sb[-1] + i)
ans = [0]
hemin = 0
for i in range(1, n):
	tw = min(ans[i - 1] + A[i - 1], hemin + c + sb[i])
	ans.append(tw)
	hemin = min(hemin, ans[i] - sb[i])
print(*ans)


MAX_A = 10 ** 2
MAX_N = 2 * 10 ** 5
(n, c) = map(int, input().split())
A = [int(x) for x in input().split()]
B = [int(x) for x in input().split()]
MAX_TIME = MAX_A * MAX_N + 1
C = [(MAX_TIME, MAX_TIME)] * n
C[0] = (0, c)
for i in range(1, n):
	C[i] = (min([C[i - 1][0], C[i - 1][1]]) + A[i - 1], min([C[i - 1][0] + c, C[i - 1][1]]) + B[i - 1])
print(' '.join(map(lambda x: str(min(x)), C)))


def least_time(n, c, with_legs, with_elevator):
	ans = [[-1, -1] for i in range(n)]
	ans[0][0] = 0
	ans[0][1] = c
	for i in range(n - 1):
		ans[i + 1][0] = min(ans[i][1] + with_legs[i], ans[i][0] + with_legs[i])
		ans[i + 1][1] = min(ans[i][1] + with_elevator[i], ans[i][0] + with_elevator[i] + c)
	ans = [str(min(i[0], i[1])) for i in ans]
	return ' '.join(ans)
(n, c) = map(int, input().split())
with_legs = list(map(int, input().split()))
with_elevator = list(map(int, input().split()))
print(least_time(n, c, with_legs, with_elevator))


(n, c) = map(int, input().strip().split())
st = [0] + [int(i) for i in input().strip().split()]
el = [0] + [int(i) for i in input().strip().split()]
st_sum = list(st)
el_sum = list(el)
for i in range(1, n):
	st_sum[i] += st_sum[i - 1]
	el_sum[i] += el_sum[i - 1]
dp = [[100001000 for i in range(n + 1)], [100001000 for i in range(n + 1)]]
dp[0][1] = 0
dp[1][1] = c
for i in range(1, n):
	dp[0][i + 1] = min(dp[0][i + 1], dp[0][i] + st[i])
	dp[0][i + 1] = min(dp[1][i] + st[i], dp[0][i + 1])
	dp[1][i + 1] = min(dp[1][i + 1], dp[0][i] + el[i] + c)
	dp[1][i + 1] = min(dp[1][i + 1], dp[1][i] + el[i])
print(' '.join((str(min(dp[0][i], dp[1][i])) for i in range(1, n + 1))))


(n, c) = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
dp = []
for i in range(n):
	temp = []
	if i == 0:
		temp.append(0)
		temp.append(c)
		dp.append(temp)
	else:
		t1 = dp[i - 1][0] + a[i - 1]
		t2 = dp[i - 1][0] + b[i - 1] + c
		t3 = dp[i - 1][1] + a[i - 1]
		t4 = dp[i - 1][1] + b[i - 1]
		temp.append(min(t1, t3))
		temp.append(min(t2, t4))
		dp.append(temp)
	print(min(temp), end=' ')


[n, c] = list(map(int, input().split(' ')))
a = list(map(int, input().split(' ')))
b = list(map(int, input().split(' ')))
ret = [0]
elev = [c]
for i in range(1, n):
	t_stairs = ret[i - 1] + a[i - 1]
	t_elevator = min(ret[i - 1] + b[i - 1] + c, elev[i - 1] + b[i - 1])
	elev.append(t_elevator)
	fastest = min(t_stairs, t_elevator)
	ret.append(fastest)
print(*ret)


import sys
input = sys.stdin.readline
(N, c) = map(int, input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
dp = [[0, c] for _ in range(N + 1)]
ans = [0]
for (i, (a, b)) in enumerate(zip(A, B)):
	dp[i + 1][0] = min(dp[i][0] + a, dp[i][1] + a)
	dp[i + 1][1] = min(dp[i][0] + b + c, dp[i][1] + b)
	ans.append(min(dp[i + 1]))
print(*ans)


(n, c) = map(int, input().split())
dp = [[float('inf')] * n, [float('inf')] * n]
a = list(map(int, input().split()))
b = list(map(int, input().split()))
dp[0][0] = 0
dp[1][0] = c
for i in range(n - 1):
	dp[0][i + 1] = min(dp[1][i] + a[i], dp[0][i] + a[i])
	dp[1][i + 1] = min(dp[1][i] + b[i], dp[0][i] + b[i] + c)
for i in range(n):
	print(min(dp[0][i], dp[1][i]), end=' ')


from os import path
import sys
from heapq import heappush, heappop
from functools import cmp_to_key as ctk
from collections import deque, defaultdict as dd
from bisect import bisect, bisect_left, bisect_right, insort, insort_left, insort_right
from itertools import permutations
from datetime import datetime
from math import ceil, sqrt, log, gcd

def ii():
	return int(input())

def si():
	return input().rstrip()

def mi():
	return map(int, input().split())

def li():
	return list(mi())
abc = 'abcdefghijklmnopqrstuvwxyz'
mod = 1000000007
inf = float('inf')
vow = ['a', 'e', 'i', 'o', 'u']
(dx, dy) = ([-1, 1, 0, 0], [0, 0, 1, -1])

def bo(i):
	return ord(i) - ord('a')
file = 1

def solve():
	(n, c) = mi()
	stairs = li()
	elevator = li()
	ans = [[c, 0] for i in range(n)]
	res = [0] * n
	for i in range(1, n):
		ans[i][0] = min(ans[i - 1][0] + elevator[i - 1], ans[i - 1][1] + elevator[i - 1] + c)
		ans[i][1] = min(ans[i - 1]) + stairs[i - 1]
		res[i] = min(ans[i])
	print(*res)
if file:
	if path.exists('input.txt'):
		sys.stdin = open('input.txt', 'r')
		sys.stdout = open('output.txt', 'w')
	else:
		input = sys.stdin.readline
solve()


def main():
	(n, c) = map(int, input().split())
	a = [int(i) for i in input().split()]
	b = [int(i) for i in input().split()]
	dp = [[0, 0] for i in range(n)]
	dp[0][1] = c
	for i in range(1, n):
		dp[i][0] = min(dp[i - 1][0], dp[i - 1][1]) + a[i - 1]
		dp[i][1] = min(dp[i - 1][1], dp[i - 1][0] + c) + b[i - 1]
	for i in range(n):
		print(min(dp[i]), end=' ')
	print()
	return
main()


(n, m) = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
dp = [[0, 0] for i in range(n + 1)]
dp[0][1] = m
for i in range(n - 1):
	dp[i + 1][0] = min(dp[i][0] + a[i], dp[i][1] + a[i])
	dp[i + 1][1] = min(dp[i][0] + b[i] + m, dp[i][1] + b[i])
for i in range(n):
	print(min(dp[i][0], dp[i][1]), end=' ')


(n, c) = list(map(int, input().split()))
arr = list(map(int, input().split()))
brr = list(map(int, input().split()))
prefix_arr = [arr[i] for i in range(n - 1)]
prefix_brr = [brr[i] for i in range(n - 1)]
for i in range(1, n - 1):
	prefix_arr[i] = prefix_arr[i] + prefix_arr[i - 1]
	prefix_brr[i] = prefix_brr[i] + prefix_brr[i - 1]
dp = [[10 ** 10 for j in range(2)] for i in range(n)]
dp[0][0] = c
dp[0][1] = 0
for i in range(1, n):
	j = i - 1
	suma = prefix_brr[i - 1]
	if j > 0:
		suma -= prefix_brr[j - 1]
	dp[i][0] = min(dp[i][0], dp[j][0] + suma)
	dp[i][0] = min(dp[i][0], dp[j][1] + suma + c)
	sumb = prefix_arr[i - 1]
	if j > 0:
		sumb -= prefix_arr[j - 1]
	dp[i][1] = min(dp[i][1], dp[j][1] + sumb)
	dp[i][1] = min(dp[i][1], dp[j][0] + sumb)
for i in range(n):
	print(min(dp[i][0], dp[i][1]), end=' ')
print('\n')


from math import *
(n, k) = map(int, input().split())
dp = [[float('inf'), float('inf')] for i in range(2 * 10 ** 5 + 5)]
dp[0] = [0, k]
esc = list(map(int, input().split()))
asc = list(map(int, input().split()))
print(0, end=' ')
for i in range(1, n):
	dp[i][0] = min(dp[i - 1]) + esc[i - 1]
	dp[i][1] = min(dp[i - 1][1], dp[i - 1][0] + k) + asc[i - 1]
	print(min(dp[i]), end=' ')


import sys

def I():
	return sys.stdin.readline().rstrip()
(n, c) = map(int, I().split())
a = list(map(int, I().split()))
b = list(map(int, I().split()))
e = [0] + [1003 * n] * (n - 1)
s = [0] + [1003 * n] * (n - 1)
for i in range(0, n - 1):
	e[i + 1] = min(c + s[i] + b[i], e[i] + b[i])
	s[i + 1] = min(s[i], e[i]) + a[i]
	if i == 0:
		e[i + 1] += c
ans = [min(i, j) for (i, j) in zip(e, s)]
print(*ans)


import math
from collections import deque, defaultdict
from sys import stdin, stdout
input = stdin.readline
listin = lambda : list(map(int, input().split()))
mapin = lambda : map(int, input().split())
(n, c) = mapin()
a = listin()
b = listin()
dp = [[0 for i in range(n)] for j in range(2)]
dp[1][0] = c
for i in range(n - 1):
	dp[0][i + 1] = min(dp[0][i], dp[1][i]) + a[i]
	dp[1][i + 1] = min(dp[0][i] + c, dp[1][i]) + b[i]
for i in range(n):
	print(min(dp[0][i], dp[1][i]), end=' ')


(n, c) = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
stair = 0
lift = c
print(0)
for i in range(n - 1):
	stair = min(stair + a[i], lift + b[i])
	lift = min(stair + c, lift + b[i])
	print(stair)


(n, c) = map(int, input().split())
a = [*map(int, input().split())]
b = [*map(int, input().split())]
(ans, res) = (0, 1000000000.0)
for (i, j) in zip(a, b):
	print(min(res, ans), end=' ')
	(ans, res) = (min(ans, res) + i, min(ans + c, res) + j)
print(min(ans, res))


(n, c) = list(map(int, input().split()))
(a, b) = ([0] * n, [0] * n)
a[1:] = list(map(int, input().split()))
b[1:] = list(map(int, input().split()))
tme = [[a[0], b[0] + c]] * (n + 1)
for x in range(n):
	tme[x + 1] = [min(tme[x][0] + a[x], tme[x][1] + a[x]), min(tme[x][0] + b[x] + c, tme[x][1] + b[x])]
	print(min(tme[x + 1][0], tme[x + 1][1]), end=' ')


import sys

def minp():
	return sys.stdin.readline().strip()

def mint():
	return int(minp())

def mints():
	return map(int, minp().split())

def solve():
	(n, c) = mints()
	a = list(mints())
	b = list(mints())
	dp = [[int(1000000000.0)] * (n + 1) for i in (1, 2)]
	dp[0][0] = 0
	dp[1][0] = c
	for i in range(n - 1):
		dp[0][i + 1] = min(dp[0][i] + a[i], dp[1][i] + b[i])
		dp[1][i + 1] = min(dp[1][i] + b[i], dp[0][i + 1] + c)
	print(' '.join([str(min(dp[0][i], dp[1][i])) for i in range(n)]))
solve()


def solve(n, c, a, b):
	dp = [[int(1000000000.0)] * 2 for _ in range(n - 1)]
	dp[0][0] = a[0]
	dp[0][1] = b[0] + c
	for i in range(1, n - 1):
		dp[i][0] = min(dp[i][0], dp[i - 1][0] + a[i], dp[i - 1][1] + a[i])
		dp[i][1] = min(dp[i][1], dp[i - 1][1] + b[i], dp[i - 1][0] + b[i] + c)
	ans = []
	for i in range(n - 1):
		ans.append(min(dp[i][0], dp[i][1]))
	ans.insert(0, 0)
	print(' '.join(map(str, ans)))
(n, c) = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
solve(n, c, a, b)


import sys
(n, c) = map(int, sys.stdin.readline().split())
a = list(map(int, sys.stdin.readline().split()))
b = list(map(int, sys.stdin.readline().split()))
dp = [[0, 0] for _ in range(n)]
dp[0] = [0, c]
for i in range(1, n):
	dp[i][0] = min(dp[i - 1][0] + a[i - 1], dp[i - 1][1] + a[i - 1])
	dp[i][1] = min(dp[i - 1][0] + b[i - 1] + c, dp[i - 1][1] + b[i - 1])
for i in range(n):
	print(min(dp[i]), end=' ')


import heapq
import sys
input = sys.stdin.readline

def dijkstra(s):
	inf = 1145141919810
	dist = [inf] * n
	dist[s] = 0
	visit = [0] * n
	p = []
	heapq.heappush(p, (dist[s], s))
	while p:
		(d, u) = heapq.heappop(p)
		if dist[u] < d:
			continue
		visit[u] = 1
		for (v, c) in G[u]:
			nd = dist[u] + c
			if not visit[v] and nd < dist[v]:
				dist[v] = nd
				heapq.heappush(p, (dist[v], v))
	return dist
(n, c) = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
G = [[] for _ in range(2 * n)]
for i in range(n - 1):
	G[i].append((i + 1, a[i]))
	G[i + n].append((i + n + 1, b[i]))
for i in range(n):
	G[i].append((i + n, c))
	G[i + n].append((i, 0))
n *= 2
ans = dijkstra(0)[:n // 2]
print(*ans)


from sys import stdin, stdout, setrecursionlimit
setrecursionlimit(10 ** 4)

def fn(pos, stairs):
	if pos == 0:
		return 0
	if pos == 1:
		if stairs:
			return min(a[0], c + b[0])
		else:
			return min(b[0], a[0])
	if (pos, stairs) in dp:
		return dp[pos, stairs]
	op1 = op2 = float('inf')
	if stairs:
		op1 = a[pos - 1] + fn(pos - 1, 1)
		op2 = c + b[pos - 1] + fn(pos - 1, 0)
	else:
		op1 = a[pos - 1] + fn(pos - 1, 1)
		op2 = b[pos - 1] + fn(pos - 1, 0)
	dp[pos, stairs] = min(op1, op2)
	return dp[pos, stairs]
for _ in range(1):
	(n, c) = list(map(int, stdin.readline().split()))
	a = list(map(int, stdin.readline().split()))
	b = list(map(int, stdin.readline().split()))
	dp = {}
	for i in range(n):
		print(min(fn(i, 1), c + fn(i, 0)), end=' ')


np = input()
(n, p) = np.split()
n = int(n)
p = int(p)
arr1 = list(map(int, input().split()))
arr2 = list(map(int, input().split()))
dp = list()
dp.append([0, p])
for i in range(1, n):
	dp.append([10 ** 10, 10 ** 10])
for i in range(1, n):
	dp[i][0] = min(dp[i][0], dp[i - 1][0] + arr1[i - 1])
	dp[i][0] = min(dp[i][0], dp[i - 1][1] + arr1[i - 1])
	dp[i][1] = min(dp[i][1], dp[i - 1][0] + arr2[i - 1] + p)
	dp[i][1] = min(dp[i][1], dp[i - 1][1] + arr2[i - 1])
for i in range(n):
	print(min(dp[i][0], dp[i][1]), end=' ')


R = lambda : list(map(int, input().split()))
(n, c) = R()
a = R()
b = R()
lift = c
hod = 0
print(0, end=' ')
for i in range(n - 1):
	hod = min(hod + a[i], lift + b[i])
	lift = min(hod + c, lift + b[i])
	print(min(hod, lift), end=' ')


(n, c) = map(int, input().split())
x = list(map(int, input().split()))
y = list(map(int, input().split()))
dp = [[0] * 2 for i in range(n + 1)]
print(0, end=' ')
for i in range(n - 1):
	if i > 0:
		dp[i][0] = min(dp[i - 1][0] + y[i], dp[i - 1][1] + y[i] + c)
		dp[i][1] = min(dp[i - 1][0], dp[i - 1][1]) + x[i]
	else:
		dp[0][0] = y[0] + c
		dp[0][1] = x[0]
	print(min(dp[i][0], dp[i][1]), end=' ')


import sys
input = sys.stdin.readline
(n, c) = list(map(int, input().strip().split()))
a = list(map(int, input().strip().split()))
b = list(map(int, input().strip().split()))
stairs = [0 for _ in range(n)]
elevator = [0 for _ in range(n)]
elevator[0] = c
for i in range(1, n):
	stairs[i] = min(elevator[i - 1], stairs[i - 1]) + a[i - 1]
	elevator[i] = min(elevator[i - 1], stairs[i - 1] + c) + b[i - 1]
print(' '.join((str(min(elevator[i], stairs[i])) for i in range(n))))


def main():
	(n, c) = map(int, input().split())
	stairs = list(map(int, input().split()))
	elevator = list(map(int, input().split()))
	dp = []
	found = False
	for i in range(n - 1):
		if not dp:
			dp.append([stairs[i], c + elevator[i]])
		else:
			x1 = dp[-1][0] + stairs[i]
			x2 = dp[-1][1] + stairs[i]
			x3 = dp[-1][0] + c + elevator[i]
			x4 = dp[-1][1] + elevator[i]
			dp.append([min(x1, x2), min(x3, x4)])
	for i in range(n):
		if i == 0:
			print(0, end=' ')
		else:
			print(min(dp[i - 1]), end=' ')
main()


(n, c) = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
b2 = []
ans = []
ans.append([0, 0])
ans.append([a[0], b[0] + c])
for i in range(2, n):
	aa = min(ans[i - 1][0] + a[i - 1], ans[i - 1][1] + a[i - 1])
	bb = min(ans[i - 1][0] + b[i - 1] + c, ans[i - 1][1] + b[i - 1])
	ans.append([aa, bb])
for i in range(n):
	print(min(ans[i][0], ans[i][1]), end=' ')


import os

def f(a, b, c):
	a = [0] + list(a)
	b = [0] + list(b)
	n = len(a)
	dp_out = [0] * n
	dp_in = [0] * n
	dp_in[0] = c
	dp = [0] * n
	for i in range(1, n):
		dp_out[i] = min(dp_in[i - 1] + min(a[i], b[i]), dp_out[i - 1] + min(a[i], b[i] + c))
		dp_in[i] = min(dp_in[i - 1] + min(a[i] + c, b[i]), dp_out[i - 1] + c + min(a[i], b[i]))
		dp[i] = min(dp_out[i], dp_in[i])
	return dp

def pp(input):
	(n, c) = map(int, input().split())
	a = map(int, input().split())
	b = map(int, input().split())
	print(' '.join(map(str, f(a, b, c))))
if 'paalto' in os.getcwd():
	from string_source import string_source
	s0 = string_source('10 2\n7 6 18 6 16 18 1 17 17\n6 9 3 10 9 1 10 1 5')
	pp(s0)
	s1 = string_source('10 1\n3 2 3 1 3 3 1 4 1\n1 2 3 4 4 1 2 1 3')
	pp(s1)
else:
	pp(input)


link = 'https://codeforces.com/problemset/problem/1249/E'
(n, c) = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
cost = [[0] * 2 for i in range(n + 1)]
cost[2][0] = a[0]
cost[2][1] = c + b[0]
for i in range(3, n + 1):
	cost[i][0] = min(a[i - 2] + cost[i - 1][0], a[i - 2] + cost[i - 1][1])
	cost[i][1] = min(c + cost[i - 1][0] + b[i - 2], cost[i - 1][1] + b[i - 2])
for i in range(1, n + 1):
	print(min(cost[i][0], cost[i][1]), end=' ')
print()


import os
import sys
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
from math import factorial
from collections import Counter, defaultdict
from heapq import heapify, heappop, heappush

def RL():
	return map(int, sys.stdin.readline().rstrip().split())

def RLL():
	return list(map(int, sys.stdin.readline().rstrip().split()))

def N():
	return int(input())

def comb(n, m):
	return factorial(n) / (factorial(m) * factorial(n - m)) if n >= m else 0

def perm(n, m):
	return factorial(n) // factorial(n - m) if n >= m else 0

def mdis(x1, y1, x2, y2):
	return abs(x1 - x2) + abs(y1 - y2)
mod = 998244353
INF = float('inf')

def main():
	(n, c) = RL()
	arra = RLL()
	arrb = RLL()
	dp = [[0, 0] for _ in range(n)]
	dp[0] = [0, 0]
	dp[1] = [arra[0], arrb[0] + c]
	for i in range(2, n):
		dp[i][0] = min(dp[i - 1]) + arra[i - 1]
		dp[i][1] = min(dp[i - 1][1] + arrb[i - 1], dp[i - 1][0] + arrb[i - 1] + c)
	print(*[min(i) for i in dp])
main()


(n, c) = map(int, input().split())
a = [int(x) for x in input().split()]
b = [int(x) for x in input().split()]
dp0 = [0]
dp1 = [c]
for i in range(0, n - 1):
	dp0.append(min(dp0[i], dp1[i]) + a[i])
	dp1.append(min(dp0[i] + c, dp1[i]) + b[i])
for i in range(0, n):
	print(min(dp0[i], dp1[i]), end=' ')
print(' ')


import sys, math, itertools
from collections import Counter, deque, defaultdict
from bisect import bisect_left, bisect_right
from heapq import heappop, heappush, heapify, nlargest
from copy import deepcopy
mod = 10 ** 9 + 7
INF = float('inf')

def inp():
	return int(sys.stdin.readline())

def inpl():
	return list(map(int, sys.stdin.readline().split()))

def inpl_1():
	return list(map(lambda x: int(x) - 1, sys.stdin.readline().split()))

def inps():
	return sys.stdin.readline()

def inpsl(x):
	tmp = sys.stdin.readline()
	return list(tmp[:x])

def err(x):
	print(x)
	exit()
(n, c) = inpl()
a = inpl()
b = inpl()
el = b[0] + c
res = [0]
for i in range(n - 1):
	res.append(min(el, a[i] + res[-1]))
	if i != n - 2:
		el = min(el + b[i + 1], res[-1] + b[i + 1] + c)
print(*res)


import bisect
import functools
import math
import sys
from collections import defaultdict
from itertools import groupby
rt = lambda : map(int, input().split())
ri = lambda : int(input())
rl = lambda : list(map(int, input().split()))

def main():
	(n, c) = rt()
	a = rl()
	b = rl()
	dpS = [math.inf] * n
	dpE = [math.inf] * n
	dpS[0] = 0
	dpE[0] = 0
	res = [0] * n
	for i in range(1, n):
		dpS[i] = min(dpS[i], dpS[i - 1] + a[i - 1], dpE[i - 1] + c + a[i - 1])
		dpE[i] = min(dpE[i], dpE[i - 1] + b[i - 1], dpS[i - 1] + b[i - 1])
		res[i] = min(dpS[i], dpE[i] + c)
	print(*res)
main()


(n, c) = map(int, input().split())
a = [0] + [int(i) for i in input().split()]
b = [0] + [int(i) for i in input().split()]
p = [0] * n
l = [0] * n
t = [0] * n
for i in range(1, n):
	p[i] = a[i] + t[i - 1]
	l[i] = b[i] + t[i - 1] - (c if t[i - 1] == l[i - 1] + c else 0)
	l[i] = min(l[i], l[i - 1] + b[i])
	t[i] = min(l[i] + c, p[i])
for i in t:
	print(i, end=' ')


import sys
(n, c) = map(int, sys.stdin.readline().split())
a = list(map(int, sys.stdin.readline().split()))
b = list(map(int, sys.stdin.readline().split()))
(stairs, lift) = ([0], [0])
stairs.append(a[0])
lift.append(b[0] + c)
for i in range(2, n):
	st = min(stairs[-1] + a[i - 1], lift[-1] + a[i - 1])
	lt = min(stairs[-1] + b[i - 1] + c, lift[-1] + b[i - 1])
	stairs.append(st)
	lift.append(lt)
ans = []
for i in range(n):
	ans.append(min(stairs[i], lift[i]))
print(*ans)


import sys
input = sys.stdin.readline
out = sys.stdout
inf = 10 ** 18

def main():
	(n, c) = map(int, input().split())
	a = list(map(int, input().split()))
	b = list(map(int, input().split()))
	dp_el = [c] + [inf] * n
	dp_lad = [0] + [inf] * n
	for i in range(1, n):
		dp_el[i] = min(dp_el[i], dp_lad[i - 1] + b[i - 1] + c, dp_el[i - 1] + b[i - 1])
		dp_lad[i] = min(dp_lad[i], dp_lad[i - 1] + a[i - 1], dp_el[i - 1] + a[i - 1])
	for i in range(n):
		print(min(dp_el[i], dp_lad[i]), end=' ')
main()


(floors, delay) = [int(x) for x in input().split(' ')]
stairs = [int(x) for x in input().split(' ')]
elevator = [int(x) for x in input().split(' ')]
floorcalc = [[0, 1001] for x in range(floors)]
floorcalc[0][1] = delay
for i in range(1, floors):
	floorcalc[i][0] = min(floorcalc[i - 1][0] + stairs[i - 1], floorcalc[i - 1][1] + stairs[i - 1])
	floorcalc[i][1] = min(floorcalc[i - 1][0] + elevator[i - 1] + delay, floorcalc[i - 1][1] + elevator[i - 1])
print(' '.join(map(str, [min(x) for x in floorcalc])))


from sys import stdin, stdout
import gc
gc.disable()
import sys, time, threading

def waste():
	ini = time.time()
	for i in range(10 ** 4):
		pass
(n, c) = list(map(int, stdin.readline().split()))
arr = list(map(int, stdin.readline().split()))
brr = list(map(int, stdin.readline().split()))
dp = [[0 for x in range(2)] for y in range(n)]
dp[0][1] = c
for i in range(1, n):
	dp[i][0] = min(dp[i - 1][0] + arr[i - 1], dp[i - 1][1] + arr[i - 1])
	dp[i][1] = min(dp[i - 1][0] + c + brr[i - 1], dp[i - 1][1] + brr[i - 1])
for i in range(n):
	stdout.write(str(min(dp[i])) + ' ')
arr = []
for i in range(2):
	arr.append(threading.Thread(target=waste))
for i in arr:
	i.start()


import sys
input = sys.stdin.readline
(n, m) = map(int, input().split())
s = list(map(int, input().split()))
e = list(map(int, input().split()))
dp = [[0, 0] for _ in range(n)]
dp[0] = [0, m]
ans = [0] * n
for i in range(1, n):
	dp[i][0] = min(dp[i - 1][0], dp[i - 1][1]) + s[i - 1]
	dp[i][1] = min(dp[i - 1][0] + e[i - 1] + m, dp[i - 1][1] + e[i - 1])
	ans[i] = min(dp[i])
print(*ans)


R = lambda : list(map(int, input().split()))
(n, c) = R()
stair = R()
elevator = R()
(ans, dp_of_stair, dp_of_elevator) = ([], [0], [c])
for i in range(n - 1):
	dp_of_stair.append(min(dp_of_stair[-1] + stair[i], dp_of_elevator[-1] + stair[i]))
	dp_of_elevator.append(min(dp_of_stair[-2] + elevator[i] + c, dp_of_elevator[-1] + elevator[i]))
for i in range(n):
	ans.append(min(dp_of_stair[i], dp_of_elevator[i]))
print(' '.join([str(x) for x in ans]))


import sys
input = sys.stdin.readline
(n, c) = [int(x) for x in input().split()]
a = [int(x) for x in input().split()]
b = [int(x) for x in input().split()]
dp = [[0, 1000000000.0] for _ in range(n)]
ans = [0] * n
for i in range(1, n):
	dp[i][0] = min(dp[i - 1][0], dp[i - 1][1]) + a[i - 1]
	dp[i][1] = min(dp[i - 1][0] + c, dp[i - 1][1]) + b[i - 1]
	ans[i] = min(dp[i][0], dp[i][1])
print(*ans)


from sys import stdin, stdout
for _ in range(1):
	(n, c) = list(map(int, stdin.readline().split()))
	a = list(map(int, stdin.readline().split()))
	b = list(map(int, stdin.readline().split()))
	(stairs, lift) = (0, c)
	for i in range(n - 1):
		print(min(stairs, lift), end=' ')
		(stairs, lift) = (min(stairs + a[i], lift + b[i]), min(lift + b[i], stairs + c + a[i]))
	print(min(stairs, lift), end=' ')


(n, c) = list(map(int, input().split()))
a = list(map(int, input().split()))
b = list(map(int, input().split()))
ans = [0]
INF = 1e+18
dp = [[INF, INF] for _ in range(n)]
dp[1][0] = a[0]
dp[1][1] = b[0] + c
ans.append(min(dp[1]))
for i in range(1, n - 1):
	temp = 0
	dp[i + 1][0] = min(dp[i + 1][0], dp[i][0] + a[i])
	dp[i + 1][0] = min(dp[i + 1][0], dp[i][1] + a[i])
	dp[i + 1][1] = min(dp[i + 1][1], dp[i][0] + b[i] + c)
	dp[i + 1][1] = min(dp[i + 1][1], dp[i][1] + b[i])
	ans.append(min(dp[i + 1]))
print(*ans)


from sys import stdin
input = lambda : stdin.readline().strip()
(n, c) = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
flag = False
dp = [[0] * n for i in range(2)]
dp[0][0] = 0
dp[1][0] = c
for i in range(n - 1):
	dp[0][i + 1] = min(dp[1][i] + a[i], dp[0][i] + a[i])
	dp[1][i + 1] = min(dp[0][i] + c + b[i], dp[1][i] + b[i])
for i in range(n):
	print(min(dp[0][i], dp[1][i]))


from sys import setrecursionlimit as SRL, stdin
SRL(10 ** 7)
rd = stdin.readline
rrd = lambda : map(int, rd().strip().split())
(n, c) = rrd()
a = list(rrd())
b = list(rrd())
a = [0] + a
b = [0] + b
for i in range(1, n):
	b[i] += b[i - 1]
ans = [10 ** 10] * 200005
ans[0] = 0
mab = 0
for i in range(1, n + 1):
	ans[i] = min(ans[i], ans[i - 1] + a[i - 1], b[i - 1] + mab + c)
	if ans[i] - b[i - 1] < mab:
		mab = ans[i] - b[i - 1]
for i in range(1, n + 1):
	print(ans[i], end=' ')


import math
(n, c) = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
dp = [[math.inf] * 2 for x in range(n)]
dp[0] = [0, c]
for i in range(1, n):
	dp[i][0] = min(dp[i - 1]) + a[i - 1]
	dp[i][1] = min(dp[i - 1][0] + c + b[i - 1], dp[i - 1][1] + b[i - 1])
print(' '.join([str(min(x)) for x in dp]))


(floors, c) = list(map(int, input().split()))
stairs = list(map(int, input().split()))
ele = list(map(int, input().split()))
ts = 0
te = c
print(0, end=' ')
for i in range(1, floors):
	(ts, te) = (min(ts, te) + stairs[i - 1], min(ts + c, te) + ele[i - 1])
	print(min(ts, te), end=' ')
print()


import math
import time
from collections import defaultdict, deque
from sys import stdin, stdout
from bisect import bisect_left, bisect_right
t = 1
for _ in range(t):
	(n, c) = map(int, stdin.readline().split())
	stairs = list(map(int, stdin.readline().split()))
	lifts = list(map(int, stdin.readline().split()))
	dp = defaultdict(lambda : [])
	dp[1] = [0, c]
	print(0, end=' ')
	for i in range(2, n + 1):
		st = min(dp[i - 1][0] + stairs[i - 2], dp[i - 1][1] + stairs[i - 2])
		lift = min(dp[i - 1][0] + lifts[i - 2] + c, dp[i - 1][1] + lifts[i - 2])
		dp[i] = [st, lift]
		print(min(st, lift), end=' ')


def run() -> None:
	(n, c) = [int(x) for x in input().split()]
	stair_times = [int(x) for x in input().split()]
	elev_times = [int(x) for x in input().split()]
	current = [0, c]
	print(0, end=' ')
	for i in range(0, n - 1):
		new = []
		new.append(min(current[0] + stair_times[i], current[1] + stair_times[i]))
		new.append(min(current[0] + c + elev_times[i], current[1] + elev_times[i]))
		print(min(new), end=' ')
		current = new
run()


from sys import stdin, stdout
import gc
gc.disable()
import multiprocessing
(n, c) = list(map(int, stdin.readline().split()))
arr = list(map(int, stdin.readline().split()))
brr = list(map(int, stdin.readline().split()))
dp = [[0 for x in range(2)] for y in range(n)]
dp[0][1] = c
for i in range(1, n):
	dp[i][0] = min(dp[i - 1][0] + arr[i - 1], dp[i - 1][1] + arr[i - 1])
	dp[i][1] = min(dp[i - 1][0] + c + brr[i - 1], dp[i - 1][1] + brr[i - 1])
for i in range(n):
	stdout.write(str(min(dp[i])) + ' ')


import sys
reader = (s.rstrip() for s in sys.stdin)
input = reader.__next__
(n, c) = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
DP = [[float('inf')] * 2 for i in range(n)]
DP[0][0] = 0
for i in range(n - 1):
	DP[i + 1][0] = min(DP[i][0], DP[i][1]) + a[i]
	DP[i + 1][1] = min(DP[i][0] + c, DP[i][1]) + b[i]
ans = [min(DP[i]) for i in range(n)]
print(*ans)


from collections import defaultdict
from collections import Counter
import math
import sys
import os
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')

def listt():
	return [int(i) for i in input().split()]

def gcd(a, b):
	return math.gcd(a, b)

def lcm(a, b):
	return a * b // gcd(a, b)

def factors(n):
	step = 2 if n % 2 else 1
	return set(reduce(list.__add__, ([i, n // i] for i in range(1, int(math.sqrt(n)) + 1, step) if n % i == 0)))

def comb(n, k):
	factn = math.factorial(n)
	factk = math.factorial(k)
	fact = math.factorial(n - k)
	ans = factn // (factk * fact)
	return ans

def is_prime(n):
	if n <= 1:
		return False
	if n == 2:
		return True
	if n > 2 and n % 2 == 0:
		return False
	max_div = math.floor(math.sqrt(n))
	for i in range(3, 1 + max_div, 2):
		if n % i == 0:
			return False
	return True

def maxpower(n, x):
	B_max = int(math.log(n, x))
	return B_max

def binaryToDecimal(n):
	return int(n, 2)
t = 1
for _ in range(t):
	(n, c) = map(int, input().split())
	a = listt()
	b = listt()
	dp = [[float('inf') for i in range(2)] for j in range(n)]
	dp[0][1] = dp[0][0] = 0
	dp[1][0] = a[0]
	dp[1][1] = b[0] + c
	for i in range(2, n):
		dp[i][0] = min(dp[i - 1][0], dp[i - 1][1]) + a[i - 1]
		dp[i][1] = min(dp[i - 1][0] + c, dp[i - 1][1]) + b[i - 1]
	for i in range(0, n):
		print(min(dp[i][0], dp[i][1]), end=' ')


(n, c) = map(int, input().split())
walk = list(map(int, input().split()))
lift = list(map(int, input().split()))
dpl = [0] * n
dpw = [0] * n
dpl[0] = c
print(0, end=' ')
for i in range(1, n):
	dpl[i] = min(dpw[i - 1] + c, dpl[i - 1]) + lift[i - 1]
	dpw[i] = min(dpw[i - 1], dpl[i - 1]) + walk[i - 1]
	print(min(dpl[i], dpw[i]), end=' ')


import sys
from math import inf

def rint():
	return list(map(int, sys.stdin.readline().split()))

def input():
	return sys.stdin.readline().rstrip('\n')

def oint():
	return int(input())
(n, c) = rint()
a = list(rint())
b = list(rint())
e = 0
ans = [0]
e = [0] * (n + 2)
mina = [inf] * (n + 2)
mine = [inf] * (n + 2)
mina[0] = a[0]
mine[0] = b[0] + c
for i in range(1, n - 1):
	mine[i] = b[i] + min(mine[i - 1], mina[i - 1] + c, mine[i - 2] + mine[i - 1])
	mina[i] = a[i] + min(mina[i - 1], mine[i - 1])
for i in range(n - 1):
	ans.append(min(mine[i], mina[i]))
print(*ans)


r = lambda : list(map(int, input().split()))
(n, c) = r()
s = r()
e = r()
print(0, end=' ')
ele = c + e[0]
st = s[0]
print(min(ele, st), end=' ')
for i in range(1, n - 1):
	ele0 = min(st + c + e[i], ele + e[i])
	st0 = min(ele + s[i], st + s[i])
	ele = ele0
	st = st0
	print(min(ele, st), end=' ')


N = 2 * 10 ** 5 + 57
INF = 10 ** 10
dp = [[INF] * N, [INF] * N]
(n, c) = (int(z) for z in input().split())
dp[0][0] = 0
dp[1][0] = c
a = [int(z) for z in input().split()]
b = [int(z) for z in input().split()]
for i in range(1, n):
	dp[0][i] = min(dp[0][i - 1] + a[i - 1], dp[1][i - 1] + b[i - 1])
	dp[1][i] = min(dp[0][i] + c, dp[1][i - 1] + b[i - 1])
for i in range(n):
	print(dp[0][i], end=' ')


import sys

def input():
	return sys.stdin.readline().strip()
MAX = pow(10, 9)
(n, c) = map(int, input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
dp = [[MAX] * 2 for _ in range(n)]
dp[0] = [0, c]
for i in range(n - 1):
	dp[i + 1][0] = min(dp[i + 1][0], dp[i][0] + A[i])
	dp[i + 1][0] = min(dp[i + 1][0], dp[i][1] + A[i])
	dp[i + 1][1] = min(dp[i + 1][1], dp[i][0] + B[i] + c)
	dp[i + 1][1] = min(dp[i + 1][1], dp[i][1] + B[i])
for i in range(n):
	print(min(*dp[i]), end=' ')


for _ in range(1):
	(n, k) = map(int, input().split())
	a = list(map(int, input().split()))
	b = list(map(int, input().split()))
	dp = [[0, k] for _ in range(n)]
	ans = [0]
	for i in range(n - 1):
		dp[i + 1][0] = ans[i] + a[i]
		dp[i + 1][1] = min(dp[i][0] + b[i] + k, dp[i][1] + b[i])
		ans.append(min(dp[i + 1][0], dp[i + 1][1]))
	print(*ans)


(n, c) = map(int, input().split())
ladder = list(map(int, input().split()))
lift = list(map(int, input().split()))
dp = [[float('inf'), float('inf')] for i in range(n)]
dp[0][0] = 0
dp[0][1] = c
for i in range(1, n):
	dp[i][0] = min(dp[i - 1][0] + ladder[i - 1], dp[i][0])
	dp[i][0] = min(dp[i - 1][1] + ladder[i - 1], dp[i][0])
	dp[i][1] = min(dp[i - 1][0] + lift[i - 1] + c, dp[i][1])
	dp[i][1] = min(dp[i - 1][1] + lift[i - 1], dp[i][1])
for i in range(n):
	print(min(dp[i]), end=' ')


from sys import stdin
input = stdin.readline
from heapq import heapify, heappush, heappop, heappushpop
from collections import defaultdict as dd, deque as dq, Counter as C
from math import factorial as f, ceil, gcd, sqrt, log
from bisect import bisect_left as bl, bisect_right as br
from itertools import combinations as c, permutations as p
from math import factorial as f, ceil, gcd, sqrt, log
mp = lambda : map(int, input().split())
it = lambda : int(input())
ls = lambda : list(input().strip())
mt = lambda r: [list(mp()) for _ in range(r)]
lcm = lambda a, b: a * b // gcd(a, b)

def fibo_n(n):
	return ((1 + sqrt(5)) / 2) ** n / sqrt(5)
mod = 1000000007
(a, b) = mp()
dp = [[float('inf'), float('inf')] for __ in range(a + 1)]
dp[0][0] = 0
dp[0][1] = b
stairs = list(mp())
elevators = list(mp())
for i in range(1, a):
	dp[i][0] = min(dp[i][0], dp[i - 1][0] + stairs[i - 1])
	dp[i][0] = min(dp[i][0], dp[i - 1][1] + stairs[i - 1])
	dp[i][1] = min(dp[i][1], dp[i - 1][0] + elevators[i - 1] + b)
	dp[i][1] = min(dp[i][1], dp[i - 1][1] + elevators[i - 1])
print(*[min(dp[j][0], dp[j][1]) for j in range(a)])


(n, c) = map(int, input().split())
a = []
a.append(0)
for x in input().split():
	a.append(int(x))
b = []
b.append(0)
for x in input().split():
	b.append(int(x))
dp = []
for i in range(n + 1):
	dp.append([])
	for j in range(2):
		dp[i].append(0)
dp[1][0] = 0
dp[1][1] = c
for i in range(2, n + 1):
	dp[i][0] = min(dp[i - 1][0], dp[i - 1][1]) + a[i - 1]
	dp[i][1] = min(dp[i - 1][0] + c, dp[i - 1][1]) + b[i - 1]
for i in range(1, n + 1):
	print(min(dp[i][0], dp[i][1]), end=' ')


a = input('').split(' ')
n = int(a[0])
c = int(a[1])
t = []
for i in range(n):
	t.append([0, 10 ** 5])
a = list(map(int, input('').split(' ')))
b = list(map(int, input('').split(' ')))
print(0, end=' ')
for i in range(1, n, 1):
	t[i][0] = min(t[i - 1][1], t[i - 1][0]) + a[i - 1]
	t[i][1] = min(t[i - 1][0] + c, t[i - 1][1]) + b[i - 1]
	print(min(t[i][0], t[i][1]), end=' ')


(n, c) = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
overall = 0
lift = c
answer = [0]
for i in range(n - 1):
	noice = min(overall + a[i], overall + b[i] + c, lift + b[i])
	lift = min(overall + b[i] + c, lift + b[i])
	overall = noice
	answer.append(overall)
print(*answer)


(n, c) = map(int, input().split())
arr1 = list(map(int, input().split()))
arr2 = list(map(int, input().split()))
dp = [[c, 0]]
for i in range(1, n):
	a = min(dp[i - 1][0] + arr2[i - 1], dp[i - 1][1] + c + arr2[i - 1])
	b = min(dp[i - 1][0] + arr1[i - 1], dp[i - 1][1] + arr1[i - 1])
	dp.append([a, b])
for i in range(n):
	print(min(dp[i][0], dp[i][1]), end=' ')


(n, c) = [int(x) for x in input().split()]
a = [int(x) for x in input().split()]
b = [int(x) for x in input().split()]
on = [0] * n
on[0] = c
off = [0] * n
for i in range(1, n):
	on[i] = min(on[i - 1] + b[i - 1], off[i - 1] + c + b[i - 1])
	off[i] = min(on[i - 1] + a[i - 1], off[i - 1] + a[i - 1])
ans = []
for i in range(n):
	ans.append(str(min(on[i], off[i])))
print(' '.join(ans))


def r():
	return map(int, input().split())
(n, c) = r()
s = list(r())
e = list(r())
dp_s = [0] * n
dp_e = [c] + [0] * (n - 1)
dp = [0] * n
for i in range(1, n):
	dp_s[i] = min(dp_s[i - 1] + s[i - 1], dp_e[i - 1] + s[i - 1])
	dp_e[i] = min(dp_e[i - 1] + e[i - 1], dp_s[i - 1] + c + e[i - 1])
	dp[i] = min(dp_s[i], dp_e[i])
print(*dp)


(n, c) = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
dp = [[0, 0] for i in range(n)]
dp[0][1] = c
ans = [0]
for i in range(1, n):
	dp[i][0] = min(dp[i - 1][0], dp[i - 1][1]) + a[i - 1]
	dp[i][1] = min(dp[i - 1][0] + c, dp[i - 1][1]) + b[i - 1]
	ans.append(min(dp[i][0], dp[i][1]))
print(' '.join(map(str, ans)))


(n, c) = map(int, input().split())
stair = list(map(int, input().split()))
elev = list(map(int, input().split()))
dp = [[0 for i in range(len(stair) + 1)] for i in range(2)]
dp[0][1] = stair[0]
dp[1][1] = c + elev[0]
flag = 0
for i in range(1, len(stair)):
	dp[0][i + 1] = min(dp[0][i], dp[1][i]) + stair[i]
	dp[1][i + 1] = min(dp[0][i] + elev[i] + c, dp[1][i] + elev[i])
ans = [min(dp[0][i], dp[1][i]) for i in range(len(dp[0]))]
print(' '.join(map(str, ans)))


s = input()
s1 = s.split()
k = int(s1[1])
s = input()
s1 = s.split()
a = [int(i) for i in s1]
s = input()
s1 = s.split()
b = [int(i) for i in s1]
dpa = [0 for i in range(len(a) + 1)]
dpa[0] = 0
for i in range(1, len(a) + 1):
	dpa[i] = dpa[i - 1] + a[i - 1]
dpb = [0 for i in range(len(a) + 1)]
dpb[0] = 0
for i in range(1, len(a) + 1):
	dpb[i] = dpb[i - 1] + b[i - 1]
dp = [100000000.0 for i in range(len(a) + 1)]
dp[0] = 0
maxval1 = 0
maxval2 = 0
for i in range(1, len(a) + 1):
	dp[i] = min(dp[i], dpa[i] + maxval1, dpb[i] + maxval2 + k)
	maxval1 = min(maxval1, dp[i] - dpa[i])
	maxval2 = min(maxval2, dp[i] - dpb[i])
print(*dp)


(n, c) = map(int, input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
T = [[0, 0] for i in range(n)]
T[0][1] = c / 2
for i in range(1, n):
	T[i][0] = min(T[i - 1][0] + A[i - 1], T[i - 1][1] + B[i - 1] + c / 2)
	T[i][1] = min(T[i - 1][0] + A[i - 1] + c / 2, T[i - 1][1] + B[i - 1])
print(' '.join([str(round(i[0])) for i in T]))


import array
import math
import os
import sys

def main():
	(N, C) = read_ints()
	A = read_ints()
	B = read_ints()
	print(*solve(N, C, A, B))
INF = 2 ** 32 - 1

def solve(N, C, A, B):
	s = [INF] * N
	e = [INF] * N
	s[0] = 0
	for i in range(N - 1):
		s[i + 1] = min(s[i] + A[i], e[i] + A[i])
		e[i + 1] = min(s[i] + C + B[i], e[i] + B[i])
	return [min(s[i], e[i]) for i in range(N)]
DEBUG = 'DEBUG' in os.environ

def inp():
	return sys.stdin.readline().rstrip()

def read_int():
	return int(inp())

def read_ints():
	return [int(e) for e in inp().split()]

def dprint(*value, sep=' ', end='\n'):
	if DEBUG:
		print(*value, sep=sep, end=end)
main()


input = __import__('sys').stdin.readline
(floors, c) = list(map(int, input().split()))
stairs = list(map(int, input().split()))
ele = list(map(int, input().split()))
ts = 0
te = c
print(0, end=' ')
for i in range(1, floors):
	(ts, te) = (min(ts, te) + stairs[i - 1], min(ts + c, te) + ele[i - 1])
	print(min(ts, te), end=' ')
print()


(n, c) = map(int, input().split())
l1 = list(map(int, input().split()))
l2 = list(map(int, input().split()))
dp = []
for i in range(n):
	dp.append([0, 0])
ans = [0]
dp[0][1] = c
for i in range(1, n):
	dp[i][0] = min(dp[i - 1][0], dp[i - 1][1]) + l1[i - 1]
	dp[i][1] = min(dp[i - 1][1], dp[i - 1][0] + c) + l2[i - 1]
	ans.append(min(dp[i][0], dp[i][1]))
print(*ans)


import sys
(n, k) = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
dp = [[sys.maxsize, sys.maxsize] for i in range(n)]
(dp[0][0], dp[0][1]) = (0, k)
for i in range(1, n):
	dp[i][0] = min(dp[i][0], min(dp[i - 1][1], dp[i - 1][0]) + a[i - 1])
	dp[i][1] = min(dp[i][1], min(dp[i - 1][1], k + dp[i - 1][0]) + b[i - 1])
for i in range(n):
	print(min(dp[i]), end=' ')


from sys import stdin, setrecursionlimit
setrecursionlimit(10 ** 7)

def iin():
	return int(stdin.readline())

def lin():
	return list(map(int, stdin.readline().split()))

def main():
	(n, c) = lin()
	s = lin()
	e = lin()
	sol = [[0, 0] for i in range(n)]
	sol[0] = [c + e[0], s[0]]
	for i in range(1, n - 1):
		sol[i] = [e[i] + min(sol[i - 1][0], c + sol[i - 1][1]), min(sol[i - 1][0], sol[i - 1][1]) + s[i]]
	ans = [0] + [min(sol[i]) for i in range(n - 1)]
	print(*ans)
main()


import os
import sys
import math
from io import BytesIO, IOBase
from fractions import Fraction
import collections
from itertools import permutations
from collections import defaultdict
from collections import deque
import threading
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')

class Factorial:

	def __init__(self, MOD):
		self.MOD = MOD
		self.factorials = [1, 1]
		self.invModulos = [0, 1]
		self.invFactorial_ = [1, 1]

	def calc(self, n):
		if n <= -1:
			print('Invalid argument to calculate n!')
			print('n must be non-negative value. But the argument was ' + str(n))
			exit()
		if n < len(self.factorials):
			return self.factorials[n]
		nextArr = [0] * (n + 1 - len(self.factorials))
		initialI = len(self.factorials)
		prev = self.factorials[-1]
		m = self.MOD
		for i in range(initialI, n + 1):
			prev = nextArr[i - initialI] = prev * i % m
		self.factorials += nextArr
		return self.factorials[n]

	def inv(self, n):
		if n <= -1:
			print('Invalid argument to calculate n^(-1)')
			print('n must be non-negative value. But the argument was ' + str(n))
			exit()
		p = self.MOD
		pi = n % p
		if pi < len(self.invModulos):
			return self.invModulos[pi]
		nextArr = [0] * (n + 1 - len(self.invModulos))
		initialI = len(self.invModulos)
		for i in range(initialI, min(p, n + 1)):
			next = -self.invModulos[p % i] * (p // i) % p
			self.invModulos.append(next)
		return self.invModulos[pi]

	def invFactorial(self, n):
		if n <= -1:
			print('Invalid argument to calculate (n^(-1))!')
			print('n must be non-negative value. But the argument was ' + str(n))
			exit()
		if n < len(self.invFactorial_):
			return self.invFactorial_[n]
		self.inv(n)
		nextArr = [0] * (n + 1 - len(self.invFactorial_))
		initialI = len(self.invFactorial_)
		prev = self.invFactorial_[-1]
		p = self.MOD
		for i in range(initialI, n + 1):
			prev = nextArr[i - initialI] = prev * self.invModulos[i % p] % p
		self.invFactorial_ += nextArr
		return self.invFactorial_[n]

class Combination:

	def __init__(self, MOD):
		self.MOD = MOD
		self.factorial = Factorial(MOD)

	def ncr(self, n, k):
		if k < 0 or n < k:
			return 0
		k = min(k, n - k)
		f = self.factorial
		return f.calc(n) * f.invFactorial(max(n - k, k)) * f.invFactorial(min(k, n - k)) % self.MOD
mod = 10 ** 9
(n, c) = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
dp = [[0, 0] for i in range(n)]
dp[0][1] = c
for i in range(n - 1):
	dp[i + 1][0] = min(dp[i][0] + a[i], dp[i][1] + a[i])
	dp[i + 1][1] = min(dp[i][0] + b[i] + c, dp[i][1] + b[i])
for i in range(n):
	print(min(dp[i]), end=' ')
print()


from sys import stdin, stdout
import sys
from bisect import bisect_left, bisect_right
import gc
gc.disable()
(n, c) = list(map(int, stdin.readline().split()))
arr = list(map(int, stdin.readline().split()))
brr = list(map(int, stdin.readline().split()))
dp = [[0 for x in range(2)] for y in range(n)]
dp[0][1] = c
for i in range(1, n):
	dp[i][0] = min(dp[i - 1][0] + arr[i - 1], dp[i - 1][1] + arr[i - 1])
	dp[i][1] = min(dp[i - 1][0] + c + brr[i - 1], dp[i - 1][1] + brr[i - 1])
for i in range(n):
	print(min(dp[i]), end=' ')


import sys
input = lambda : sys.stdin.readline().rstrip('\r\n')
from math import log, ceil
from collections import defaultdict
(n, c) = map(int, input().split())
dp = [[float('inf'), float('inf')] for _ in range(n)]
dp[0][0] = 0
dp[0][1] = c
a = [0] + [int(x) for x in input().split()]
b = [0] + [int(x) for x in input().split()]
for i in range(1, n):
	dp[i][0] = min(dp[i][0], dp[i - 1][0] + a[i])
	dp[i][0] = min(dp[i][0], dp[i - 1][1] + a[i])
	dp[i][1] = min(dp[i][1], dp[i - 1][1] + b[i])
	dp[i][1] = min(dp[i][1], dp[i - 1][0] + b[i] + c)
print(*[min(x[0], x[1]) for x in dp])


import sys
input = sys.stdin.readline

def main():
	(N, C) = [int(x) for x in input().split()]
	A = [int(x) for x in input().split()]
	B = [int(x) for x in input().split()]
	dp = [0] * 2
	ans = 0
	print(ans, end=' ')
	is_use_elev = False
	dp[0] = A[0]
	dp[1] = B[0] + C
	print(min(dp[0], dp[1]), end=' ')
	for i in range(1, N - 1):
		x = min(dp[0], dp[1]) + A[i]
		y = min(dp[0] + C, dp[1]) + B[i]
		print(min(x, y), end=' ')
		dp[0] = x
		dp[1] = y
main()


(n, c) = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
ans = [float('INF') for i in range(n)]
ans1 = [float('INF') for i in range(n)]
ans1[0] = c
ans[0] = 0
for i in range(1, n):
	ans[i] = min(ans[i], ans[i - 1] + a[i - 1])
	ans[i] = min(ans[i], ans1[i - 1] + a[i - 1])
	ans1[i] = min(ans1[i], ans1[i - 1] + b[i - 1])
	ans1[i] = min(ans1[i], ans[i - 1] + b[i - 1] + c)
for i in range(n):
	print(min(ans[i], ans1[i]), end=' ')


mod = 10 ** 9 + 7
import sys
sys.setrecursionlimit(10 ** 6)
from sys import stdin, stdout
import bisect
from bisect import bisect_left as bl
from bisect import bisect_right as br
import itertools
import collections
import math
import heapq
import random

def modinv(n, p):
	return pow(n, p - 2, p)

def ncr(n, r, p):
	t = fact[n] * (ifact[r] * ifact[n - r] % p) % p
	return t

def cin():
	return map(int, sin().split())

def ain():
	return list(map(int, sin().split()))

def sin():
	return input()

def inin():
	return int(input())

def GCD(x, y):
	while y:
		(x, y) = (y, x % y)
	return x

def main():
	(n, k) = cin()
	a = ain()
	b = ain()
	ans = [0]
	x = 0
	y = k
	for i in range(n - 1):
		xx = x
		x = min(x + a[i], y + a[i])
		y = min(y + b[i], xx + b[i] + k)
		z = min(x, y)
		ans.append(z)
	print(*ans)
py2 = round(0.5)
if py2:
	from future_builtins import ascii, filter, hex, map, oct, zip
	range = xrange
import os, sys
from io import IOBase, BytesIO
BUFSIZE = 8192

class FastIO(BytesIO):
	newlines = 0

	def __init__(self, file):
		self._file = file
		self._fd = file.fileno()
		self.writable = 'x' in file.mode or 'w' in file.mode
		self.write = super(FastIO, self).write if self.writable else None

	def _fill(self):
		s = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
		self.seek((self.tell(), self.seek(0, 2), super(FastIO, self).write(s))[0])
		return s

	def read(self):
		while self._fill():
			pass
		return super(FastIO, self).read()

	def readline(self):
		while self.newlines == 0:
			s = self._fill()
			self.newlines = s.count(b'\n') + (not s)
		self.newlines -= 1
		return super(FastIO, self).readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.getvalue())
			(self.truncate(0), self.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		if py2:
			self.write = self.buffer.write
			self.read = self.buffer.read
			self.readline = self.buffer.readline
		else:
			self.write = lambda s: self.buffer.write(s.encode('ascii'))
			self.read = lambda : self.buffer.read().decode('ascii')
			self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
import sys

class ostream:

	def __lshift__(self, a):
		sys.stdout.write(str(a))
		return self
cout = ostream()
endl = '\n'

def readnumbers(zero=0):
	conv = ord if py2 else lambda x: x
	A = []
	numb = zero
	sign = 1
	i = 0
	s = sys.stdin.buffer.read()
	try:
		while True:
			if s[i] >= b'0'[0]:
				numb = 10 * numb + conv(s[i]) - 48
			elif s[i] == b'-'[0]:
				sign = -1
			elif s[i] != b'\r'[0]:
				A.append(sign * numb)
				numb = zero
				sign = 1
			i += 1
	except:
		pass
	if s and s[-1] >= b'0'[0]:
		A.append(sign * numb)
	return A
main()


import sys
input = sys.stdin.readline
print = sys.stdout.write
(n, c) = map(int, input().split(' '))
stairs = list(map(int, input().split(' ')))
elevator = list(map(int, input().split(' ')))
print('0 ')
(s, e) = (0, c)
for i in range(n - 1):
	ts = min([s, e]) + stairs[i]
	te = min([e, s + c]) + elevator[i]
	(s, e) = (ts, te)
	print(str(min([s, e])) + ' ')


(n, c) = list(map(int, input().split()))
a = list(map(int, input().split()))
b = list(map(int, input().split()))
(dp1, dp2) = ([0] * n, [0] * n)
dp2[0] = c
p = 0
for i in range(1, n):
	dp1[i] = min(dp1[i - 1], dp2[i - 1]) + a[i - 1]
	dp2[i] = min(dp2[i - 1] + b[i - 1], dp1[i - 1] + b[i - 1] + c)
for i in range(n):
	print(min(dp1[i], dp2[i]), end=' ')


import sys
import bisect as bi
import math
from collections import defaultdict as dd
import heapq
import itertools
input = sys.stdin.readline
from random import randint
mo = 10 ** 9 + 7

def cin():
	return map(int, sin().split())

def ain():
	return list(map(int, sin().split()))

def sin():
	return input()

def inin():
	return int(input())
for _ in range(1):
	(n, c) = cin()
	a = ain()
	b = ain()
	ans = [0] * n
	t0 = [0] * n
	t1 = [0] * n
	t1[0] = c
	for i in range(0, n - 1):
		t0[i + 1] = min(t0[i], t1[i]) + a[i]
		t1[i + 1] = min(t0[i] + b[i] + c, t1[i] + b[i])
		ans[i + 1] = min(t0[i + 1], t1[i + 1])
	print(*ans)


(n, c) = [int(i) for i in input().split()]
b = [int(i) for i in input().split()]
a = [int(i) for i in input().split()]
dp = [[0, 0] for i in range(n + 1)]
dp[1][0] = 50000000
dp[1][1] = 0
for i in range(2, n + 1):
	dp[i][0] = min(dp[i - 1][0] + a[i - 2], dp[i - 1][1] + c + a[i - 2])
	dp[i][1] = min(dp[i - 1][0] + b[i - 2], dp[i - 1][1] + b[i - 2])
[print(min(dp[i]), end=' ') for i in range(1, n + 1)]
print()