String Transformation

You are given 2 Strings A and B. You have to transform A to become B.
Following are the type of transformation possible:
1. pick an alphabet and replace all occurrences of this alphabet in the string by the next alphabet in the sequence[a,b,c,d----y,z]. Note that the next alphabet for z is a. The whole operation counts as one operation with Cost C is given as input.
2.pick an alphabet and replace all occurrences of this alphabet in the string by the previous alphabet in the sequence[a,b,c,d----y,z]. Note that the next alphabet for a is z. The whole operation counts as one operation with Cost D is given as input.
You have to return the minimum cost to transform A to B. if it's not possible return -1
Example:
A: "ab"
B: "cc"
C:2
D:5
Answer : 4
we need two C operations "ab" -->"bb"-->"cc"
Note that the last step of converting all b to c counts as one operation