프로그램 명: coci_popust
제한시간: 2 초

[문제 요약] 모든 음식들에는 두 가지 가격표가 있습니다.

가격표A는 가장 처음 주문하는 음식에 적용되고 가격표B는 다른 음식들에게 적용됩니다. 1개, 2개, 3개 ... N개의 음식을 주문하는 모든 경우에 대해 지불해야하는 돈을 최소화해 출력하세요


Mirko is hungry as a bear, scratch that, programmer and has stumbled upon a local restaurant. The restaurant offers N meals and has an interesting pricing policy: each meal i has two assigned prices, Ai and Bi. Mirko pays A only for the first ordered meal, while B prices apply for all other meals.

Mikro can't decide how many meals to order. In order to make his decision easier, he has asked you to compute, for each k between 1 i N (inclusive), the minimum total price for k ordered meals. Mirko doesn't care which particular meals he orders or in which order he orders them, however he won't order the same meal twice. Order, order, order.

입력

출력

Output must consist of N lines, where line k contains the minimum price for ordering exactly k different meals.

입출력 예

input

3 
10 5 
9 3 
10 5

output

9 
13 
18

input

2 
100 1 
1 100

output

1 
2

input

5 
1000000000 1000000000 
1000000000 1000000000 
1000000000 1000000000 
1000000000 1000000000 
1000000000 1000000000

output

1000000000 
2000000000 
3000000000 
4000000000 
5000000000

Clarification of the first example:
k = 1: Mirko pays A2 = 9 for the starting meal 2. k = 2: Mirko pays A1 = 10 for the starting meal 1, then B2 = 3 for meal 2. k = 3: Mirko pays A1 = 10 for the starting meal 1, then B2 = 3 for meal 2, and finally B3 = 5 for meal 3.
출처:coci/2012-2013/contest2 4/6
요약:ladown21

[질/답] [제출 현황] [푼 후(0)]
[ 채 점 ] [홈으로]  [뒤 로]