5297: 合影(specail judge)

内存限制:256 MB 时间限制:1 S 标准输入输出
题目类型:传统 评测方式:文本比较 上传者:
提交:11 通过:4

题目描述

     一天,几个朋友在一个聚会上相遇,他们很久没有见面了,所以他们决定一起拍一张合影。

      在照片上,用一个像素矩形来描述每个人所占的区域,即第i个朋友占用区域用宽wi,高hi的矩形来描述。

在合影中,大家站成一排,因此包括所有被拍照的朋友在内的照片的最小像素矩阵大小是W×H,其中W是所有被拍照的朋友的宽度之和,H是所有被拍照的朋友的最大高度。

      通常情况下,朋友们拍了n张照片,第j(1≤j≤n)照片中除了第j位朋友之外的所有人都拍了,因为他是摄影师。



      输出每张照片的最小尺寸,以像素为单位。



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 wi pixels and height hi 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≤jn) photo had everybody except for the j-th friend as he was the photographer.
Print the minimum size of each made photo in pixels.
Input
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 wi,hi (1≤wi≤10,1≤hi≤1000) − the width and height in pixels of the corresponding rectangle.
Output
Print n space-separated numbers b1,b2,...,bn, where bi − the total number of pixels on the minimum photo containing all friends expect for the i-th one.
Examples
Input
3
1 10
5 5
10 1
Output
75 110 60 
Input
3
2 1
1 2
2 1
Output
6 4 6 

输入格式

第一行包含整数 n (2≤n≤200000) - 朋友的数量。
然后 n 行如下:第 i 行包含有关第 i 个朋友的信息。该行包含一对整数 wi,hi (1≤wi≤10,1≤hi≤1000) − 相应矩形的宽度和高度(以像素为单位)。

输出格式

输出 n 个空格分隔的数字 b1,b2,...,bn,其中 bi − 包含所有朋友的最小照片上第 i 个期望的像素总数。
例子
输入
Input
3
1 10
5 5
10 1
Output
75 110 60 
Input
3
2 1
1 2
2 1
Output
6 4 6 


输入样例 复制

3
1 10
5 5
10 1

输出样例 复制

75 110 60