Min Operations

Min Operations
hard

Two natural numbers \(A\) and \(B\) are given, each having the same number of digits. In one move, it is allowed either to change the value of any digit of \(A\), or to reverse the order of digits in \(A\). The first operation costs \(X\) riyals, and the second one costs \(Y\) riyals. What is the minimum amount of money needed to obtain number \(B\) from number \(A\)?

Numbers \(A\) and \(B\) are not bigger than \(10^{18}\), and numbers \(X\) and \(Y\) are not bigger than \(1000\).

If this seems too hard, you can try first to solve this task assuming \(X=1\) and \(Y=1000\).