1483 Hard to Play II

Time Limit : 2000/1000 MS(Java/Others) | Memory Limit : 65536/32768 KB(Java/Others)

Submits : 1 | Solved : 1

Description

MightyHorse is playing a music game called osu!.

After playing for several months, MightyHorse discovered the way of calculating score in osu!:

1. While playing osu!, player need to click some circles following the rhythm. Each time a player clicks, it will have three different points: 300, 100 and 50, deciding by how clicking timing fits the music.

2. Calculating the score is quite simple. Each time player clicks and gets P points, the total score will add P, which should be calculated according to following formula:

P = Point * (Combo * 2 + 1)

Here Point is the point the player gets (300, 100, 50 or 0 if the player misses the note) and Combo is the number of consecutive circles the player gets points previously - That means if the player doesn't miss any circle and clicks the ith circle, Combo should be i - 1. But once the player misses the note, the combo becomes 0 immediately.

MightyHorse thinks that the game is very hard to play. But he is more interested in another problem: What's the maximum and minimum total score a player can get if he only knows the number of 300, 100 and 50 points the player gets and the number of the notes the player misses in one play?


Input

There are multiple test cases.

The first line of input is an integer T (1 ≤T ≤ 300), indicating the number of test cases.

For each test case, there is only one line contains three integers: A (0 ≤A ≤ 500) - the number of 300 point he gets, B (0 ≤B ≤ 500) - the number of 100 point he gets, C (0 ≤C ≤ 500) - the number of 50 point he gets and K (0 ≤K ≤ 100) - the number of the notes the player misses.


Output

For each test case, output a line contains two integers, describing the minimum and maximum total score the player can get.


Sample Input

1
2 1 1 1

Sample Output

1050 3950

HINT


Source

ZJU

[ Top ] | [ Submit ]