Ash like soup very much! So, on the Raksha Bandhan day, his sister gave him a soup maker as a gift. Soup maker in the ith hour will make volume  Vi liters of soup and pours it in a bowl.
Each hour, the Volume of soup in every bowl is reduced due to evaporation. More precisely, when the temperature on a given hour is Ti, the Volume of soup in every bowl will reduce its volume by Ti. If this would reduce the volume of soup to or below zero, Bowl gets empty. All bowls are independent of each other.
Note that the Volume of soup in every bowl made in an hour i already lose part of its volume at the same hour. In an extreme case, this may mean that there is no soup left in the bowl at the end of a particular hour.
You are given the initial volumes of soup in bowls and the temperature on each hour. Determine the total volume of soup evaporated in each hour.
Input
The first line contains a single integer N (1 ≤ N ≤ 10^5) — the number of hours.
The second line contains N integers V 1, V 2, …, V N (0 ≤ V i ≤ 10^9), where V i is the initial volume of soup made in an hour i.
The third line contains N integers T 1, T 2, …, T N (0 ≤ T i ≤ 10^9), where T i is the temperature in an hour i.
Output
Output a single line with N integers, where the i-th integer represents the total volume of soup melted in an hour i.
Examples
Input
3
10 10 5
5 7 2
Output
5 12 4
Input
5
30 25 20 15 10
9 10 12 4 13
Output
9 20 35 11 25
Note
In the first sample, In the first hour, 10 liters of soup is prepared, which evaporates to the size of 5 at the same hour. In the second hour, another 10 liters of soup is made. Since it is a bit warmer than the hour before, the first bowl gets empty while the second bowl shrinks to 3. At the end of the second hour, only one bowl with 3 liters soup is left. In the third hour, another bowl with less volume of soup is made, but as the temperature dropped too, both bowls survive till the end of the hour.

Source: codechef | Difficulty: UNKNOWN_DIFFICULTY


Solutions:
def solve():
	n = int(input())
	l1 = list(map(int, input().split()))
	l2 = list(map(int, input().split()))
	ans = []
	for i in range(n):
		c = 0
		for j in range(i + 1):
			if l1[j] <= l2[i]:
				c += l1[j]
				l1[j] = 0
			else:
				l1[j] -= l2[i]
				c += l2[i]
		ans.append(c)
	print(*ans)
solve()


n = int(input())
v = [int(x) for x in input().split()]
t = [int(x) for x in input().split()]
a = []
for i in range(n):
	a.append(v[i])
	c = 0
	for j in range(len(a)):
		k = a[j] - t[i]
		if k >= 0:
			c += t[i]
			a[j] = k
		else:
			c += a[j]
			a[j] = 0
	print(c, end=' ')


x = int(input())
sop = [int(i) for i in input().split()]
tem = [int(j) for j in input().split()]
for i in range(x):
	sm = 0
	for j in range(i + 1):
		if sop[j] >= tem[i]:
			sm += tem[i]
			sop[j] -= tem[i]
		else:
			sm += sop[j]
			sop[j] = 0
	print(sm, end=' ')


t = int(input())
s = list(map(int, input().split()))
e = list(map(int, input().split()))
if t == 0 or t == 1:
	print(0)
else:
	for i in range(t):
		c = 0
		p = s[0:i + 1]
		for j in range(len(p)):
			if p[j] >= e[i]:
				c += e[i]
				s[j] -= e[i]
			else:
				c += p[j]
				s[j] = 0
		print(c, end=' ')


n = int(input())
s = [int(j) for j in input().split()]
t = [int(j) for j in input().split()]
l = []
for i in range(n):
	te = t[i]
	l.append(s[i])
	l1 = []
	ans = 0
	for i in l:
		if i > te:
			ans += te
			l1.append(i - te)
		else:
			ans += i
	l = l1
	print(ans, end=' ')


n = int(input())
vol = list(map(int, input().split()))
temp = list(map(int, input().split()))
i = 0
count = 0
while i < len(temp):
	j = i
	count = 0
	while j >= 0 and i < len(temp):
		if vol[j] < temp[i] and vol[j] != 0:
			count += vol[j]
			vol[j] = 0
		elif vol[j] >= temp[i] and vol[j] != 0:
			vol[j] = vol[j] - temp[i]
			count += temp[i]
		j -= 1
	print(count, end=' ')
	i += 1


n = int(input())
v = list(map(int, input().split()))
t = list(map(int, input().split()))
for i in range(n):
	ans = 0
	for j in range(0, i + 1):
		if v[j] <= 0:
			continue
		if t[i] <= v[j]:
			ans += t[i]
			v[j] = v[j] - t[i]
		else:
			ans += v[j]
			v[j] = 0
	print(ans, end=' ')


import sys
list_of_lists = []
for line in sys.stdin:
	new_list = [int(elem) for elem in line.split()]
	list_of_lists.append(new_list)
volume = list_of_lists[1]
temperature = list_of_lists[2]
after_volume = []
temp_deduction = 0
total_reduction = []
for i in range(list_of_lists[0][0]):
	for x in range(len(after_volume)):
		if after_volume[x] - temperature[i] < 0:
			temp_deduction += after_volume[x]
			after_volume[x] = 0
		else:
			temp_deduction += temperature[i]
			after_volume[x] = after_volume[x] - temperature[i]
	if volume[i] - temperature[i] < 0:
		temp_deduction += volume[i]
		after_volume[x] = 0
	else:
		temp_deduction += temperature[i]
		after_volume.append(volume[i] - temperature[i])
	total_reduction.append(temp_deduction)
	temp_deduction = 0
print(*total_reduction)


t = 1
for t_cases in range(t):
	n = int(input())
	v = list(map(int, input().split()))
	t = list(map(int, input().split()))
	for i in range(0, n):
		temp = 0
		for j in range(0, i + 1):
			if v[j] >= t[i]:
				temp += t[i]
			else:
				temp += v[j]
			v[j] = max(0, v[j] - t[i])
		print(temp, end=' ')


n = int(input())
B = [int(i) for i in input().split()]
t = [int(i) for i in input().split()]
o = []
for i in range(n):
	x = t[i]
	s = 0
	for j in range(i + 1):
		if B[j] > x:
			B[j] = B[j] - x
			s += x
		else:
			s += B[j]
			B[j] = 0
	o.append(s)
for i in o:
	print(i, end=' ')


n = int(input())
v = list(map(int, input().split()))
t = list(map(int, input().split()))
m = []
for i in range(n):
	s = 0
	for j in range(i + 1):
		e = v[j]
		v[j] = v[j] - t[i]
		if v[j] < 0:
			v[j] = 0
		loss = e - v[j]
		s = s + loss
	m.append(s)
print(*m)


def __starting_point():
	n = int(input())
	v = list(map(int, input().split()))
	t = list(map(int, input().split()))
	l = []
	ans = []
	for i in range(n):
		cancel = 0
		if i == 0:
			if v[i] <= t[i]:
				cancel += v[i]
				v[i] -= v[i]
			else:
				cancel += t[i]
				v[i] -= t[i]
			l.append(v[i])
			ans.append(cancel)
		else:
			l.append(v[i])
			j = 0
			while j < len(l):
				if l[j] == 0:
					l.pop(j)
					j -= 1
				elif l[j] <= t[i]:
					cancel += l[j]
					l[j] -= l[j]
				else:
					cancel += t[i]
					l[j] -= t[i]
				j += 1
			ans.append(cancel)
	print(*ans)
__starting_point()


import os
import sys
import math
from itertools import *
from io import BytesIO, IOBase
from collections import *
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))
mod = 10 ** 9 + 7
pi = 3.141592653589793

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

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

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

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

def pf(ans):
	return sys.stdout.write(str(ans) + '\n')

def gcd(a, b):
	if a == 0:
		return b
	elif b == 0:
		return a
	if a > b:
		return gcd(a % b, b)
	else:
		return gcd(a, b % a)

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

def LogN(a, b):
	return math.log(a) / math.log(b)

def fpow(a, b):
	res = 1
	while b > 0:
		if b & 1:
			res = res * a
		a = a * a
		b >>= 1
	return res

def sieve(n):
	m = (n - 1) // 2
	b = [True] * m
	(i, p, ps) = (0, 3, [2])
	while p * p < n:
		if b[i]:
			ps.append(p)
			j = 2 * i * i + 6 * i + 3
			while j < m:
				b[j] = False
				j = j + 2 * i + 3
		i += 1
		p += 2
	while i < m:
		if b[i]:
			ps.append(p)
		i += 1
		p += 2
	return ps

def solve():
	n = i1()
	l1 = arr()
	l2 = arr()
	ans = []
	for i in range(n):
		c = 0
		for j in range(i + 1):
			if l1[j] <= l2[i]:
				c += l1[j]
				l1[j] = 0
			else:
				l1[j] -= l2[i]
				c += l2[i]
		ans.append(c)
	print(*ans)
solve()


t = int(input())
lst = list(map(int, input().split()))
lst1 = list(map(int, input().split()))
for i in range(len(lst)):
	q = 0
	for j in range(i + 1):
		if lst[j] <= lst1[i]:
			q += lst[j]
			lst[j] = 0
		else:
			q += lst1[i]
			lst[j] -= lst1[i]
	print(q, end=' ')


n = int(input())
soup = list(map(int, input().split()))
evap = list(map(int, input().split()))
for i in range(n):
	summ = 0
	for j in range(i + 1):
		if soup[j] >= evap[i]:
			summ += evap[i]
			soup[j] -= evap[i]
		else:
			summ += soup[j]
			soup[j] = 0
	print(summ, end=' ')


n = int(input())
import heapq as hq
heap = []
temp = 0
ans = [-1 for _ in range(n)]
V = [int(x) for x in input().split()]
T = [int(x) for x in input().split()]
for i in range(n):
	prevtemp = temp
	temp += T[i]
	hq.heappush(heap, V[i] + prevtemp)
	curr = 0
	while len(heap) and heap[0] <= temp:
		m = hq.heappop(heap)
		curr += m - prevtemp
	curr += len(heap) * T[i]
	ans[i] = curr
print(' '.join([str(x) for x in ans]))