#include <bits/stdc++.h>
using namespace std;
int main() {
  int a, b, c, x, y, n, m;
  if (x > y) {
    n = x - y;
    m = y * b;
  } else if (x < y) {
    n = y - x;
    m = x * a;
  }
  cout << n * c + m << endl;
  return 0;
}
