Minimum Cost To Make Two Strings Identical

easy
1. You are given two strings S1, S2, and two numbers x and y.
2. The cost of deleting a character from S1 is x and the cost of deleting a character from S2 is y.
3. You can delete characters from both the strings.
4. You have to find the minimum cost required to make the given two strings identical.

Input Format

Two Strings S1, S2 Two numbers x and y

Output Format

A number representing the minimum cost of making the given two strings identical.

Constraints

1 <= length of strings S1 and S2 <= 1000
1 <= x,y <= 1000

Example

Input
sea
eat
10
7
Output
17
Previous
Minimum Ascii Delete Sum For Two Strings
Next
Distinct Transformations

Related Questions