Problem: Today Oz is playing with his game-board. He has N coins of type-1 and M coins of type-2. Also the game-board has N squares of type-1 and M squares of type-2. In this game Oz must place one coin into each square. After placing all coins Oz will get a score based on his coin placement strategy . 

His score calculation is like this : If type-1 square contains a type-1 coin then he will get A points, if type-2 square contains a type-2 coin then he will get B points and in all other cases, he will get C points.
Oz's total game score will be sum of scores of all squares. Help Oz to earn maximum game points with his game-board.

Input :

The first line contains the number of test cases T . 

Each test case consists of five space separated integers - N, M, A, B and C. 

Output :

For each test case output maximum game points that Oz can earn.

Constraints :

1 ≤  T ≤ 100

1 ≤ N, M ≤ 10^9

-10^4  ≤ A, B, C ≤ 10^4

SAMPLE INPUT
2
3 4 500 800 600
1 5 10 -20 -30

SAMPLE OUTPUT
4700
-90

Explanation

For first sample :

With optimal strategy Oz will place 3 coins of type-1 into 3 squares of type-1 getting score =500+500+500 = 1500
and he will place 4 coins of type-2 into 4 squares of type-2 getting score = 800+800+800+800 = 3200
so total score will be 1500+3200 =4700
He cannot get better then this in any other coin placement strategy.

Solution (in PYTHON):

Solution:
'''
# Read input from stdin and provide input before running code

name = raw_input('What is your name?\n')
print 'Hi, %s.' % name
'''



a = raw_input()
ultimate_list=[]
reser_value = 0
final_value = []
for i in range(0,int(a)):
	value = raw_input()
	value = value.split()
	value = [ int(i) for i in  value ]
	ultimate_list.append(value)
count = 0	

for i in ultimate_list:
	count = 0
	value = 0
	replace_value = 0
	replace_value2 = 0
	for j in i[0:2]:
		count = count + 1 
		if count == 1:
			value = value + int(j) * i[2]
		#replacement code
			if i[0] < i[1]:
					val = int(i[1]) - int(i[0])
					a = i[1] - int(val)
					final = (int(j) * i[4]) + (a * i[4]) + (int(val) * i[3])
			if i[0] > i [1]:
					val = int(i[0]) - int(i[1])
					a = i[0] - int(val)
					final = (int(a) * i[4]) + (i[1] * i[4]) + (int(val) * i[2])	
			if i[0] == i [1]:		
				    final = (i[0] * i[4]) + (i[1] * i[4])
		if count == 2:
			value = value + int(j) * i[3]
			#replacement count
			
	if final > value : 
		final_value.append(final)
	else:
		final_value.append(value)
			
for i in final_value:
	print i