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*<sub class="lower-index">*i*</sub> pixels and height *h*<sub class="lower-index">*i*</sub> 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* ≤ 200 000) — 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*<sub class="lower-index">*i*</sub>, *h*<sub class="lower-index">*i*</sub> (1 ≤ *w*<sub class="lower-index">*i*</sub> ≤ 10, 1 ≤ *h*<sub class="lower-index">*i*</sub> ≤ 1000) — the width and height in pixels of the corresponding rectangle.
import random
import math

import itertools
def all_lucky(arr, n):
    m = [10*j+n for j in range(1,n)]
    for q in m:
        arr.append(q)
    for mi in range(n-1):
        k = 2
        while m[mi]*k < 10*n:
            m.append(m[mi]*k)
            arr.append(m[mi]*k)
            k+=1
    l = len(m)
    p = len(arr)
    #print(m)
    #print(arr)
    for i in range(p):
        for k in range(l):
            if arr[i] + m[k]< 10*n:
                arr.append(arr[i]+m[k])
    #print(arr)
    return arr

def main():
    t = int(input())
    W = [0]
    H = [0]
    mh1 = 0
    mh2 = 0
    for _ in range(t):
        w, h = list(map(int, input().split()))
        W.append(W[-1]+ w)
        H.append(h)
        if h > mh1:
            mh2 = mh1
            mh1 = h
        else:
            if h> mh2:
                mh2 = h

    s = ''
    for i in range(1,t+1):
        nw = W[-1]-W[i]+W[i-1]
        nh = mh2 if H[i] == mh1 else mh1
        s += str(nw*nh)+ ' '
    print(s)







if __name__ == "__main__":
    main()