#include <bits/stdc++.h>
using namespace std;
void solve() {
  long long int x, y;
  cin >> x >> y;
  if (x > y) swap(x, y);
  long long int a, b;
  long long int coins = 0;
  cin >> a >> b;
  coins = abs(x) * a + abs(y) * a;
  coins = min(coins, abs(x - y) * a + abs(y) * b);
  coins = min(coins, abs(x - y) * a + abs(x) * b);
  cout << coins << endl;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int t;
  cin >> t;
  while (t--) {
    solve();
  }
}
