Under construction

Still being built. Things may change

What Is in the Apple Box? Cash?

Interview

Time limit1sMemory limit1024 MB

Summary
Given apple and pear juice boxes with their sizes, compute the total mass of the boxes and the market value of the apples inside.
Level

Easy2 of 10

Topics
Implementation, Math
Solved
No attempts yet

Problem

On a fresh day, Hey is chatting with Beusil over Calvados at a cafe.

Beusil: "We're so busy making a living that it's been ages since we last met..."

Hey: "Right. Prices have gone up so much lately, and it's hard to buy anything easily."

Beusil: "I went to the market yesterday and couldn't buy freely. Pears are expensive too, and 33 apples cost 12 00012\,000 won..."

Hey: "Oh! Speaking of apples, I was about to leave the house when..."

The topic is rising prices, where everything goes up except salaries...,

Above all, the box of Doo-Sik's father that held the 'apple box' and the pear juice boxes blocked the front door. Hey nearly got trapped inside and almost couldn't come to the cafe!!

(Picture of the front door blocked by boxes)

Hey: "The 'Gunwi Yunha Apple' that Doo-Sik's father sent, the one that started opening a new horizon of apples no one can taste anywhere in the universe...

Thanks to its unusual growing method, each apple is a cube measuring 12 cm12\,\mathrm{cm} in width, height, and length, with a constant mass of 500 g500\,\mathrm{g}. The packaging is a specially made box with a mass of 1 000 g1\,000\,\mathrm{g}, so it ships safely.

Dad doesn't usually send much, even though he loves sending things. But the pear juice box that came with it was full of juice, and I have no idea where he bought it."

Hey explained the 'apple box' that had blocked the door in great detail. Beusil suddenly wondered how heavy the boxes blocking the door were.

Given the number and types of boxes and their sizes, calculate the mass of the boxes blocking the door.

The 'apple box' holds as many apples as possible, with the apples parallel to the sides of the box. Each pear juice box holds 5050 pear juices of 120 g120\,\mathrm{g} each, regardless of its size. Ignore the mass of the boxes themselves.

Also, we cannot know how much cash was in the 'apple box'. Instead, for Hey, who loves cash, simply calculate the value of the apples at the market price of apples.

Input

The first line contains the number of boxes NN. (1≤N≤100)(1 \leq N \leq 100)

From the second line, NN lines follow, each describing one box. Each box is described by a character TT for its type, and three integers WW, HH, and LL for its width, height, and length. TT, WW, HH, and LL are separated by spaces. (10≤W,H,L≤100)(10 \leq W, H, L \leq 100)

TT consists only of A, which stands for apple, and B, which stands for pear.

WW, HH, and LL are integers in cm\mathrm{cm}.

Output

On the first line, print the mass of the boxes blocking the door in g\mathrm{g}.

On the second line, print the value of the apples in won, calculated simply at the market price of apples.

Hint

Doo-Sik's grandfather farms apples in Gunwi, and Yunha is his grandfather's name.

However, this has nothing to do with the 'Gunwi Yunha Apple' described in the problem.

Gunwi apples stimulate gastric juice secretion, which aids digestion, and they increase iron absorption. They also ease tension caused by stress, making them a beneficial fruit. They are grown on the slopes of Mount Palgong, which sits higher than the plains and has well-developed sandy soil. The climate is cooler than in other areas, so the flesh is firm, the juice is abundant, and the aroma is good.

-[Naver Knowledge Encyclopedia] Gunwi Apple-

Examples2

  1. Example 1

    Input
    2
    A 30 15 15
    B 10 10 10
    
    Expected output
    8000
    8000
    
  2. Example 2

    Input
    5
    A 22 14 10
    A 52 36 12
    B 30 15 23
    B 20 40 30
    A 88 64 44
    
    Expected output
    73500
    468000