Photo to Remember

题意翻译

某一天,n个朋友在一起聚会,他们已经很久没见了,于是他们决定拍照留念。 简单的说,拍照的时候,每个人有一个高度和宽度,第i个的高度和宽度分别是hi和wi。这些人排成一条直线,照片的最小的面积必须包含所有的的人,所以照片的面积是W*H,W是所有人的宽度之和,H是所有人中高度最高的那个人的高度。现在想要知道当第i个人不在照片中的时候,照片的最小面积是多少。 输入 第一行是一个正整数N,表示人的数量。 接下来N行,每行两个整数wi和hi,分别表示每个人的宽度和高度。 数据范围:2<=N<=200000,1<=wi<=10,1<=hi<=1000。 输出 包含b1,b2,b3。。Bn,bi表示第i个人不在照片中的时候,照片的最小面积。

题目描述

One day $ n $ friends met at a party, they hadn't seen each other for a long time and so they decided to make a group photo together. Simply speaking, the process of taking photos can be described as follows. On the photo, each photographed friend occupies a rectangle of pixels: the $ i $ -th of them occupies the rectangle of width $ w_{i} $ pixels and height $ h_{i} $ pixels. On the group photo everybody stands in a line, thus the minimum pixel size of the photo including all the photographed friends, is $ W×H $ , where $ W $ is the total sum of all widths and $ H $ is the maximum height of all the photographed friends. As is usually the case, the friends made $ n $ photos — the $ j $ -th ( $ 1<=j<=n $ ) photo had everybody except for the $ j $ -th friend as he was the photographer. Print the minimum size of each made photo in pixels.

输入输出格式

输入格式


The first line contains integer $ n $ ( $ 2<=n<=200000 $ ) — the number of friends. Then $ n $ lines follow: the $ i $ -th line contains information about the $ i $ -th friend. The line contains a pair of integers $ w_{i},h_{i} $ ( $ 1<=w_{i}<=10,1<=h_{i}<=1000 $ ) — the width and height in pixels of the corresponding rectangle.

输出格式


Print $ n $ space-separated numbers $ b_{1},b_{2},...,b_{n} $ , where $ b_{i} $ — the total number of pixels on the minimum photo containing all friends expect for the $ i $ -th one.

输入输出样例

输入样例 #1

3
1 10
5 5
10 1

输出样例 #1

75 110 60 

输入样例 #2

3
2 1
1 2
2 1

输出样例 #2

6 4 6