You are given two integers x and y. You can perform two types of operations: 

  1. Pay a dollars and increase or decrease any of these integers by 1. For example, if x = 0 and y = 7 there are four possible outcomes after this operation: 
    * x = 0, y = 6; 
    * x = 0, y = 8; 
    * x = -1, y = 7; 
    * x = 1, y = 7. 

  2. Pay b dollars and increase or decrease both integers by 1. For example, if x = 0 and y = 7 there are two possible outcomes after this operation: 
    * x = -1, y = 6; 
    * x = 1, y = 8. 



Your goal is to make both given integers equal zero simultaneously, i.e. x = y = 0. There are no other requirements. In particular, it is possible to move from x=1, y=0 to x=y=0.

Calculate the minimum amount of dollars you have to spend on it.

Input

The first line contains one integer t (1 ≤ t ≤ 100) — the number of testcases.

The first line of each test case contains two integers x and y (0 ≤ x, y ≤ 10^9).

The second line of each test case contains two integers a and b (1 ≤ a, b ≤ 10^9).

Output

For each test case print one integer — the minimum amount of dollars you have to spend.

Example

Input


2
1 3
391 555
0 0
9 4


Output


1337
0

Note

In the first test case you can perform the following sequence of operations: first, second, first. This way you spend 391 + 555 + 391 = 1337 dollars.

In the second test case both integers are equal to zero initially, so you dont' have to spend money.
from sys import stdin
#from collections import Counter
#from math import ceil,log

def list_int():
	s=stdin.readline()[:-1]
	return list(map(int, s.split()))
def list_float():
	s=stdin.readline()[:-1]
	return list(map(float, s.split()))
def list_str():
	s=stdin.readline()[:-1]
	return list(s.split())
def space_int():
	s=stdin.readline()[:-1]
	return map(int, s.split())
def space_float():
	s=stdin.readline()[:-1]
	return map(float, s.split())
def space_str():
	s=stdin.readline()[:-1]
	return s.split()
def _int():
	s=stdin.readline()[:-1]
	return int(s)
def _str():
	s=stdin.readline()[:-1]
	return s
def _float():
	s=stdin.readline()[:-1]
	return float(s)
def _gcd(a, b):
	if(a==0):
		return b 
	return _gcd(b%a,a)
def _sieve(n): 
	prime=[True for i in range(n+1)]
	p=2
	while(p*p<=n): 
		if (prime[p]==True): 
			for i in range(p*p,n+1,p): 
				prime[i]=False
		p+=1
	prime[0]=False
	prime[1]=False
	return prime 

alpha=['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z']
nums=[0,1,2,3,4,5,6,7,8,9]
maxi=-(2**32)
mini=2**32
mod=10**9+7

#_______________________________________________________________________________________________________________________________________

for _ in range(int(input())):
	x,y=space_int()
	a,b=space_int()
	if((x>0 and y>0) or (x<0 and y<0)):
		c1=min(x,y)
		c2=max(x,y)
		ans1=(b*c1)+a*(c2-c1)
		ans2=a*(abs(x)+abs(y))
	else:
		ans1=a*(abs(x)+abs(y))
		ans2=ans1
	print(min(ans1,ans2))